Need help with a timering
#1

hey guys i need to know how am i abel to set like this that you end somethin if you write like /reward at the place then you get reward but that reward can get every hour so if you take once then you cant take it again in few sec?

Thanks for your help.
Reply
#2

pawn Код:
static stock
    g_LastReward[MAX_PLAYERS]
;

CMD:reward(playerid, params[])
{
    if (gettime() < g_LastReward[playerid])
        return SendClientMessage(playerid, -1, "You must wait 1 hour before your next reward.");

    // Your code here...
    g_LastReward[playerid] = gettime() + 3600;
    return 1;
}
Reply
#3

is it possibel you make it in strcmp? Thanks
Reply
#4

pawn Код:
if(strcmp("/reward", cmdtext, true) == 0)
{
    if (gettime() < g_LastReward[playerid])
        return SendClientMessage(playerid, -1, "You must wait 1 hour before your next reward.");

    // Your code here...
    g_LastReward[playerid] = gettime() + 3600;
    return 1;
}
Reply
#5

Thanks for the help worked well
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)