SA-MP Forums Archive
players can type the command only one time no more - 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)
+--- Thread: players can type the command only one time no more (/showthread.php?tid=420287)



players can type the command only one time no more - ethhackerman - 04.03.2013

can anyone help me so players can type the command one time only?
example:
/money
you already taked the money


Re: players can type the command only one time no more - Doughty - 04.03.2013

Hello. Create new variable on the mode, like:
pawn Код:
new bool:GotMoney[MAX_PLAYERS];
OnPlayerConnect:
pawn Код:
GotMoney[playerid] = false;
Then do check in the command, if GotMoney return true he will get message.
pawn Код:
if(GotMoney[playerid]) return SendClientMessage(playerid, -1, "You already took the money.");



Re: players can type the command only one time no more - B-Matt - 04.03.2013

@Doughty: Last code should be:

if(GotMoney[playerid] == true) return SendClientMessage(playerid, -1, "You already took the money.");
and when you use /money you should put this:

pawn Код:
CMD:money(playerid, params[])
{
    if(...)
    GotMoney[playerid] = true;
    return 1;
}



Re: players can type the command only one time no more - Mmartin - 04.03.2013

Quote:
Originally Posted by B-Matt
Посмотреть сообщение
@Doughty: Last code should be:

if(GotMoney[playerid] == true) return SendClientMessage(playerid, -1, "You already took the money.");
and when you use /money you should put this:

pawn Код:
CMD:money(playerid, params[])
{
    if(...)
    GotMoney[playerid] = true;
    return 1;
}
Why'd his code be wrong? Comparing it to true is unnecessary.


Re: players can type the command only one time no more - ethhackerman - 04.03.2013

guys i am making just example ..... other example the thing i want and i dont use any zcmd etc...
if(!strcmp(cmdtext,"/entercard 00000", true )) u already typed this card....


Re: players can type the command only one time no more - ethhackerman - 04.03.2013

warning 225: unreachable code