Command Help here.
#1

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;
}
Reply
#2

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;
}
Reply
#3

your one seems to not work..
Reply
#4

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
Reply
#5

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


gotta go school ill be on after school!
Reply
#6

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
Reply
#7

// 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
Reply
#8

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


Forum Jump:


Users browsing this thread: 4 Guest(s)