SA-MP Forums Archive
>>Help<< - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: >>Help<< (/showthread.php?tid=93270)



>>Help<< - RyDeR` - 24.08.2009

Hello I've this in mine command, When I type /dm15 for ex. It will show a textdraw for 12 seconds. But if I type another command ex. /dm14 everything is ok the text will change to but the timer set not again,

You know what I mean?
No? I type /dm15 timer will count 12 seconds but when i type /dm14 ex. inside the 12 seconds the timer will not count again from 0 And so is there a problem like The textdraw show ex. 5 seconds. Or something else.

My command.

Код:
if(!strcmp(cmd, "/dm15", true))
{
	ResetPlayerWeapons(playerid);
	SetPlayerInterior(playerid, 0);
	GivePlayerWeapon(playerid, 9, 1);
	SetPlayerHealth(playerid, 100.0);
	SetPlayerPos(playerid, -924.0569, 2675.6586, 42.3703);
	GetPlayerName(playerid, var0, 25);
	format(var1, 256, "%s DM15'e (Testere) gecis yapti(/dm15).", var0);
	TextDrawSetString(Text:Bilgi,var1);
	TextDrawShowForAll(Text:Bilgi);
	SetTimer("Silici",12000,0);
	return 1;
}



Re: >>Help<< - James_Alex - 24.08.2009

easy to do
create a bool
then when the player types the cmd change the bool to true
then when he typr the cmd check if the bol is false
try this
pawn Код:
// add this in the top of the scrit
new bool:tCmd[MAX_PLAYERS];
// then this is your cmd
if(!strcmp(cmd, "/dm15", true))
{
if(tCmd[playerid] == false)
{  
ResetPlayerWeapons(playerid);
SetPlayerInterior(playerid, 0);
GivePlayerWeapon(playerid, 9, 1);
SetPlayerHealth(playerid, 100.0);
SetPlayerPos(playerid, -924.0569, 2675.6586, 42.3703);
GetPlayerName(playerid, var0, 25);
format(var1, 256, "%s DM15'e (Testere) gecis yapti(/dm15).", var0);
TextDrawSetString(Text:Bilgi,var1);
TextDrawShowForAll(Text:Bilgi);
SetTimerEx("Silici",12000,0, "i", playerid); // here try "SetTimerEx" it's better and it juste hide the text for player
tCmd[playerid] = true;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You cannot type a dm command again before 12 seconds !");
}
return 1;
}

// this is what you have to put in the timer
public Silici(playerid)
{
// bla bla bla(your script functions
tCmd[playerid] = false;
return 1;



Re: >>Help<< - RyDeR` - 24.08.2009

Quote:
Originally Posted by ► James_Alex
easy to do
create a bool
then when the player types the cmd change the bool to true
then when he typr the cmd check if the bol is false
try this
pawn Код:
// add this in the top of the scrit
new bool:tCmd[MAX_PLAYERS];
// then this is your cmd
if(!strcmp(cmd, "/dm15", true))
{
if(tCmd[playerid] == false)
{  
ResetPlayerWeapons(playerid);
SetPlayerInterior(playerid, 0);
GivePlayerWeapon(playerid, 9, 1);
SetPlayerHealth(playerid, 100.0);
SetPlayerPos(playerid, -924.0569, 2675.6586, 42.3703);
GetPlayerName(playerid, var0, 25);
format(var1, 256, "%s DM15'e (Testere) gecis yapti(/dm15).", var0);
TextDrawSetString(Text:Bilgi,var1);
TextDrawShowForAll(Text:Bilgi);
SetTimerEx("Silici",12000,0, "i", playerid); // here try "SetTimerEx" it's better and it juste hide the text for player
tCmd[playerid] = true;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You cannot type a dm command again before 12 seconds !");
}
return 1;
}

// this is what you have to put in the timer
public Silici(playerid)
{
// bla bla bla(your script functions
tCmd[playerid] = false;
return 1;
Thank you..