GetTickCount()
#5

Alternatively you could use:
pawn Код:
forward ResetRob(playerid);
public ResetRob(playerid)
{
        HasRobbedShopRecently[playerid] = 0;
}
pawn Код:
stock IsNearStore(playerid)
{
        if(IsPlayerInRangeOfPoint(playerid, 5, ##COORDX##, ##COORDY##, ##COORDZ##)) return 1; // Store 1 replace COORDX, Y and Z with the coordinates of the shop.
        if(IsPlayerInRangeOfPoint(playerid, 5, ##COORDX##, ##COORDY##, ##COORDZ##)) return 1; // Store 2 replace COORDX, Y and Z with the coordinates of the shop.
        if(IsPlayerInRangeOfPoint(playerid, 5, ##COORDX##, ##COORDY##, ##COORDZ##)) return 1; // Store 3 replace COORDX, Y and Z with the coordinates of the shop.
        if(IsPlayerInRangeOfPoint(playerid, 5, ##COORDX##, ##COORDY##, ##COORDZ##)) return 1; // Store 4 replace COORDX, Y and Z with the coordinates of the shop.
        return 0;
}

pawn Код:
CMD:rob(playerid, params[])
{
        if(HasRobbedShopRecently[playerid] != 0) return SendClientMessage(playerid, -1, "You have already robbed a shop the last 60 seconds."); // if the value is not 0, show this message.
        if(!IsNearStore(playerid)) return SendClientMessage(playerid, -1, "You are not near a store.");
        HasRobbedShopRecently[playerid] = 1; // Shop has been robbed recently.
        new rand, str[100];
        rand = random(2000);
        GivePlayerMoney(playerid, rand); // Give a random value between 1-2000.
        format(str, sizeof(str), "You have robbed the shop and you managed to take $%i.", rand); // format the string
        SendClientMessage(playerid, -1, str); // send the string
        SetTimerEx("ResetRob", 60000, false, "i", playerid); // Set a non-looping timer on 60000 ms (60 sec) to ResetRob(playerid);
        return 1;
}
Sorry if there is any mistakes, I just made this here and now without compiling.
Reply


Messages In This Thread
GetTickCount() - by Admigo - 20.09.2012, 20:08
Re: GetTickCount() - by Admigo - 20.09.2012, 20:34
Re: GetTickCount() - by ViniBorn - 20.09.2012, 20:53
Re: GetTickCount() - by ReneG - 20.09.2012, 21:04
Re: GetTickCount() - by Chriham3 - 20.09.2012, 21:38
Re: GetTickCount() - by YourLord - 20.09.2012, 21:42
Re: GetTickCount() - by ReneG - 20.09.2012, 21:46
Re: GetTickCount() - by Admigo - 21.09.2012, 14:50
Re: GetTickCount() - by YourLord - 21.09.2012, 17:14

Forum Jump:


Users browsing this thread: 1 Guest(s)