players can type the command only one time no more
#1

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

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.");
Reply
#3

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

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

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

warning 225: unreachable code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)