Aller au contenu
San Andreas Multiplayer

dth_tdselect 1.0.0

   (0 avis)

C_far
  • Trouver leurs autres fichiers

À propos de ce fichier

dth_tdselect.inc v0.5

Cette include vous permet de mieux organiser votre code, dans le cas où vous utilisez beaucoup de TextDraws sélectionnables.

2 fonctions et 1 callback.

 

  • dth_TextDrawSetSelectable :
    • ID du textdraw
    • Sélection
    • Nom d'appel

 

Retourne : Pas de valeur spécifique.

Utilisation :

 

#include 
#include 

new
	Text:Bouton;

public OnGameModeInit()
{
	Bouton = TextDrawCreate(545.0, 410.0, "Bouton Yolooo");
    TextDrawTextSize(Bouton, 635.000000, 30.000000);
    TextDrawBackgroundColor(Bouton, -1);
    TextDrawColor(Bouton, 0xFF0000FF);
    TextDrawSetShadow(Bouton, 5);
    TextDrawSetOutline(Bouton, 1);
    TextDrawFont(Bouton, 1);
    TextDrawSetProportional(Bouton, 1);
    TextDrawLetterSize(Bouton, 0.340001, 2.999999);
    dth_TextDrawSetSelectable(Bouton, 1, Test1); // <--------

	return 1;
}

 

dth_PlayerTextDrawSetSelectable :

 

  • ID du joueur
  • ID du textdraw
  • Sélection
  • Nom d'appel

 

Retourne : Pas de valeur spécifique.

Utilisation :

 

 
#include 
#include 

new
	PlayerText:Bouton;

public OnPlayerConnect(playerid)
{
	Bouton2 = CreatePlayerTextDraw(playerid, 557.0, 360.0, "Bouton aha");
    PlayerTextDrawTextSize(playerid, Bouton2, 637.0, 30.0);
    PlayerTextDrawBackgroundColor(playerid, Bouton2, -1);
    PlayerTextDrawColor(playerid, Bouton2, 0x228301FF);
    PlayerTextDrawSetShadow(playerid, Bouton2, 5);
    PlayerTextDrawSetOutline(playerid, Bouton2, 1);
    PlayerTextDrawFont(playerid, Bouton2, 1);
    PlayerTextDrawSetProportional(playerid, Bouton2, 1);
    PlayerTextDrawLetterSize(playerid, Bouton2, 0.340001, 2.999999);
    dth_PlayerTextDrawSetSelectable(playerid, Bouton2, 1, Test2); // <--------

	return 1;
}		

 

OnPlayerCancelSelectByEchap:

 

  • ID du joueur

 

 

L'appel de la fonction fonctionne comme zcmd/easydialog ou mon autre include (dth_countdown).

Je vous montre un exemple, vous comprendrez :

 

 
#include 
#include 

main(){}

new
	Text:Bouton1,
	PlayerText:Bouton2;

public OnGameModeInit()
{
	Bouton1 = TextDrawCreate(545.0, 410.0, "Bouton Yolooo");
    TextDrawTextSize(Bouton1, 635.000000, 30.000000);
    TextDrawBackgroundColor(Bouton1, -1);
    TextDrawColor(Bouton1, 0xFF0000FF);
    TextDrawSetShadow(Bouton1, 5);
    TextDrawSetOutline(Bouton1, 1);
    TextDrawFont(Bouton1, 1);
    TextDrawSetProportional(Bouton1, 1);
    TextDrawLetterSize(Bouton1, 0.340001, 2.999999);
    dth_TextDrawSetSelectable(Bouton1, 1, Test1);

	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/select", true) == 0)
		return SelectTextDraw(playerid, 0xFF4040AA);

	if(strcmp(cmdtext, "/deselect", true) == 0)
		return CancelSelectTextDraw(playerid);

	return SendClientMessage(playerid, -1, "Commande inconnue.");
}

public OnPlayerConnect(playerid)
{
	Bouton2 = CreatePlayerTextDraw(playerid, 557.0, 360.0, "Bouton aha");
    PlayerTextDrawTextSize(playerid, Bouton2, 637.0, 30.0);
    PlayerTextDrawBackgroundColor(playerid, Bouton2, -1);
    PlayerTextDrawColor(playerid, Bouton2, 0x228301FF);
    PlayerTextDrawSetShadow(playerid, Bouton2, 5);
    PlayerTextDrawSetOutline(playerid, Bouton2, 1);
    PlayerTextDrawFont(playerid, Bouton2, 1);
    PlayerTextDrawSetProportional(playerid, Bouton2, 1);
    PlayerTextDrawLetterSize(playerid, Bouton2, 0.340001, 2.999999);
    dth_PlayerTextDrawSetSelectable(playerid, Bouton2, 1, Test2);	

	return 1;
}

public OnPlayerSpawn(playerid)
{
	TextDrawShowForPlayer(playerid, Bouton1);
	PlayerTextDrawShow(playerid, Bouton2);
	return 1;
}

TDS:Test1(playerid)
{
	return SendClientMessage(playerid, -1, "Tu cliques sur le bouton 1");
}

PTDS:Test2(playerid)
{
	return SendClientMessage(playerid, -1, "Tu cliques sur le bouton 2");
}

public OnPlayerCancelSelectByEchap(playerid)
{
	return SendClientMessage(playerid, -1, "Vous venez de presser Echap et vous n'êtes plus en mode de sélection.");
}

 

Lien GitHub : https://github.com/Dutheil/DTH/blob/mas ... select.inc




Retour utilisateur

Vous pouvez donner un avis uniquement après avoir téléchargé le fichier.

Il n’y a aucun avis à afficher.

×
×
  • Créer...