can be used 1 time
#1

How to make
To command
pawn Код:
if (strcmp("/CMD, cmdtext, true, 4) == 0)
    {
        SetPlayerPos(playerid,X,Y,Z);
        return 1;
    }
can be used 1 time for 20 seconds ?
Reply
#2

pawn Код:
#define DELAY 20000 // 20 seconds...

new LastCommandUsed[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    LastCommandUsed[playerid]=GetTickCount()-DELAY;
    //etc.
    return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp("/tehcmds",cmdtext,true))
    {
        if(GetTickCount()-LastCommandUsed[playerid]<DELAY)
            return SendClientMessage(playerid,0xFF0000FF,"YOU CAN'T USE THAT OFTEN TEH COMMAND!!! D:");

        LastCommandUsed[playerid]=GetTickCount();
        SendClientMessage(playerid,0x00FF00FF,"You can use teh command in 20 seconds again :O");
        return 1;
    }
    return 0;
}
Reply
#3

[MG3]Double-O-Seven, Thank you very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)