SA-MP Forums Archive
Command Help here. - 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: Command Help here. (/showthread.php?tid=156077)



Command Help here. - Lorenc_ - 20.06.2010

Hello its Lorenc, Just came back from a holiday and now i need your help.

Im making a objective command... Im wondering If someone is using the command Currently how do i return a msg saying "Someone is Using this command.. Wait 5 seconds.." When the person enters the command.

my command

Код:
dcmd_order(playerid, params[])
{
	#pragma unused params
 	ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "ORDER", "Type your objective for the Prisoners.\n Abusing will Suspend you.", "Submit", "Cancel");
	return 1;
}



Re: Command Help here. - Cameltoe - 20.06.2010

Make this variable:
Код:
new IsUsed;
When the Code is executed set IsUsed = 1;
and when the player is done executing the cmd set IsUsed = 0;

Код:
dcmd_order(playerid, params[])
{
if (IsUsed == 0){
	#pragma unused params
 	ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "ORDER", "Type your objective for the Prisoners.\n Abusing will Suspend you.", "Submit", "Cancel");}
else{
SendClientMessage(playerid,RED,"Somone is already using this cmd!");
}
	return 1;
}



Re: Command Help here. - Lorenc_ - 20.06.2010

your one seems to not work..


Re: Command Help here. - Cameltoe - 20.06.2010

Quote:
Originally Posted by » Lorenc « (back)
your one seems to not work..
- Ofc does it work.. you just implemented it the wrong way, or didn't get the idea


Re: Command Help here. - Lorenc_ - 20.06.2010

I did but im not sure, where should it be executed??


gotta go school ill be on after school!


Re: Command Help here. - Cameltoe - 20.06.2010

Quote:
Originally Posted by » Lorenc « (back)
I did but im not sure, where should it be executed??


gotta go school ill be on after school!
Well, i gotta sleep.

but heres a simple way to do this(it's noobish, but it's so you'll get a idea where to start):


Insert Quote
Make this variable:
Code:

new IsUsed;


When the Code is executed set IsUsed = 1;
and when the player is done executing the cmd set IsUsed = 0;

Code:

Код:
dcmd_order(playerid, params[])
{
if (IsUsed == 0){
	#pragma unused params
 	ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "ORDER", "Type your objective for the Prisoners.\n Abusing will Suspend you.", "Submit", "Cancel");}
else{
SendClientMessage(playerid,RED,"Somone is already using this cmd!");
}
	return 1;
}

dcmd_orderstop(playerid, params[])
{
if (IsUsed == 1){
	#pragma unused params
 	SendClientMessage(playerid,RED,"You stopped it and others can now use the /order cmd");
IsUsed = 0;
SendClientMessage(playerid,RED,"There are no orders!");
}
	return 1;
}
use your imagination and it will work


Re: Command Help here. - titanak - 20.06.2010

// top of script

pawn Код:
new IsUsed;
// dcmd
pawn Код:
dcmd_order(playerid, params[])
{
if (IsUsed == 0){
#pragma unused params
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "ORDER", "Type your objective for the Prisoners.\n Abusing will Suspend you.", "Submit", "Cancel");
SetTimerEx("stop",5000,0,"d",playerid);
}
else{
SendClientMessage(playerid,RED,"You Must Wait 5 Seconds to use this command again!");
}
return 1;
}

// script end i think
pawn Код:
forward stop(playerid);
public stop(playerid) {

IsUsed = 0; }

not tested but you can try


Re: Command Help here. - Lorenc_ - 21.06.2010

Im so Fucking Stupid i forgot to see the code LOL! thanks for help here guys!