Timer Help
#1

So basicly this is almost finished dropcar cmd but.. The thing is that as you might see there is timer which should set 20 mins between each /dropcar. But it doesen't ;/ So i wanted to ask what is the problem. ( I am not haveing any errors)

PHP код:
CMD:dropcar(playeridparams[])
{
    new 
string[128];
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    else if(
dropping[playerid] == false)
    {
        
format(stringsizeof(string), "You need to wait {FF6347}%d{33CCFF} more seconds before doing dropcar again."DropTime[playerid]);
        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
    }
    if(
GetPlayerVehicleID(playerid) != 0)
    {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid2505.8506, -2629.014413.29445);
        
SendClientMessage(playeridCOLOR_LIGHTBLUE"Deliver car to the Los Santos Docks!");
        
dropping[playerid] = true;
    }
    return 
1;

PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
        if(
dropping[playerid] == true)
        {
            
DisablePlayerCheckpoint(playerid);
            new 
vehicleid GetPlayerVehicleID(playerid);
            new 
string[128], playerbamount;
            
amount random (100);
            
format(stringsizeof(string), "*You've earned {FF6347}$%d{33CCFF} from dropping a car!"amount);
            
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
            
GiveDodMoney(playerbamount);
            
SetVehicleToRespawn(vehicleid);
            
dropping[playerid] = true;
            
DropTime[playerid] = 60*20;
            
SetTimerEx("DropcarTime"1000false"i"playerid);
            
            
    } 
Reply
#2

Guys Plss i need help to fix the timer ;/

dropping and DropTimer are the things on which you need to look at.
Reply
#3

What errors you got list them
Reply
#4

Show your DropcarTime function
Reply
#5

Quote:
Originally Posted by ManGoe
Посмотреть сообщение
What errors you got list them
I told before that there are no errors.

Quote:
Originally Posted by biker122
Посмотреть сообщение
Show your DropcarTime function
On Defines "new DropTime[MAX_PLAYERS]
On Variables "DropTime[playerid] = 0;


This fixed the problem so the time is now counting.
PHP код:
forward DropcarTime(playerid);
public 
DropcarTime(playerid)
{
    
DropTime[playerid] --;
    if(
DropTime[playerid] < 0)
    {
        
DropTime[playerid] = 0;
    }
    if(
DropTime[playerid] > 0)
    {
        
SetTimerEx("DropcarTime"1000false"i"playerid);
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)