Ah mais oui pardon j'avais oublié un morceau du script :s donc cela donne ça (mais ça fonctionne toujours pas :s) :
Ps : ce que je veux c'est que chaque puisse faire la commande et chaque joueur puisse son propre nombre de morts sur le compteur.
Alors voilou le code :
En haut du script il y a ca :
new comdm[MAX_PLAYERS];
new Text:textdr;
new textdra[MAX_PLAYERS];
new onoff[MAX_PLAYERS];
forward Timertext();
forward Timertext2(playerid);
Dans public OnPlayerCommandText il y a ca:
if(strcmp(cmdtext, "/stat-on") == 0)
{
if(onoff[playerid] == 1)
{
textdra[playerid] = 1;
format(string,sizeof(string),"DM : %d",comdm);
textdr = TextDrawCreate(503.000000,111.000000, string);
TextDrawAlignment(textdr,0);
TextDrawBackgroundColor(textdr,0x000000ff);
TextDrawFont(textdr,3);
TextDrawLetterSize(textdr,1.000000,1.000000);
TextDrawColor(textdr,0xffffffff);
TextDrawSetOutline(textdr,1);
TextDrawSetProportional(textdr,1);
TextDrawSetShadow(textdr,1);
if(textdra[playerid] == 1)
{
SetTimer("Timertext", 1, 1);
SetTimer("Timertext2", 2, 1);
}
}
if(onoff[playerid] == 0)
{
SendClientMessage(playerid, COLOR_ORANGE,"Vous avez déjà fait cette commande !");
}
onoff[playerid] = 0;
return 1;
}
if(strcmp(cmdtext, "/stat-off") == 0)
{
onoff[playerid] = 1;
textdra[playerid] = 0;
TextDrawHideForPlayer(playerid,textdr);
TextDrawDestroy(textdr);
SendClientMessage(playerid, COLOR_ORANGE, "Vous venez de désactiver le compteur de mort.");
return 1;
}
J'ai créer deux callbacks pour les timers :
public Timertext()
{
TextDrawDestroy(textdr);
return 1;
}
public Timertext2(playerid)
{
format(String,sizeof(String),"DM : %d",comdm);
textdr = TextDrawCreate(503.000000,111.000000, String);
TextDrawAlignment(textdr,0);
TextDrawBackgroundColor(textdr,0x000000ff);
TextDrawFont(textdr,3);
TextDrawLetterSize(textdr,1.000000,1.000000);
TextDrawColor(textdr,0xffffffff);
TextDrawSetOutline(textdr,1);
TextDrawSetProportional(textdr,1);
TextDrawSetShadow(textdr,1);
TextDrawShowForAll(textdr);
return 1;
}
Voilà alors si vous pouvez me dire pourquoi ca marche comme je veux ca serais sympas :D
Merci d'avance.
Cordialement, j0n.