Timer not starting
#4

here is a proper indentation for the code
PHP код:
forward InizioBici(playerid);
public 
InizioBici(playerid)
{
    
Lorenzo[playerid] = SetTimerEx("Mobike1", 1000, true, "d", playerid);
    new 
vid = GetPlayerVehicleID(playerid);
    
TextDrawShowForPlayer(playerid, Textdrawbike0);
    
TextDrawShowForPlayer(playerid, Textdrawbike1);
    
PlayerTextDrawShow(playerid, Textdrawbike2[playerid]);
    
PlayerTextDrawShow(playerid, Textdrawbike3[playerid]);
    
GetVehicleParamsEx(VeicoloAffittato[playerid], Engine[vid], Lights[vid], alarm[vid], doors[vid], bonnet[vid], boot[vid], objective[vid]);
    
SetVehicleParamsEx(VeicoloAffittato[playerid], 1, Lights[vid], alarm[vid], doors[vid], bonnet[vid], boot[vid], objective[vid]);
    return 
1;
}
forward Mobike1(playerid);
public 
Mobike1(playerid)
{
    new 
ore[MAX_PLAYERS], minuti[MAX_PLAYERS], secondi[MAX_PLAYERS];
    new 
string[126], str[126], str1[126];
    new 
prezzo1[MAX_PLAYERS];
    new 
prezzo[MAX_PLAYERS];
    
prezzo1[playerid] = ore[playerid]*60+minuti[playerid];
    
prezzo[playerid] = prezzo1[playerid]/15;
    if(
VeicoloAffittato[playerid] > 1)
    {
        if(
Character[playerid][Bank] < prezzo[playerid]/2)
        {
            
TextDrawHideForPlayer(playerid, Textdrawbike0);
            
TextDrawHideForPlayer(playerid, Textdrawbike1);
            
PlayerTextDrawHide(playerid, Textdrawbike2[playerid]);
            
PlayerTextDrawHide(playerid, Textdrawbike3[playerid]);
            
format(string, sizeof(string), "Hai terminato i soldi sul conto in banca. Hai speso $%d.", prezzo[playerid]*2);
            
SendClientMessage(playerid, COLOR_WHITE, string);
            
Character[playerid][Bank] -= prezzo[playerid]/2;
            
KillTimer(Lorenzo[playerid]);
            return 
1;
            }
        if(
ore[playerid] == 0 && minuti[playerid] == 0 && secondi[playerid] > 0)
        {
            
secondi[playerid]++;
            
format(str, sizeof(str), "Tempo trascorso: %ds", secondi[playerid]);
            
PlayerTextDrawSetString(playerid,Textdrawbike2[playerid], str);
            
format(str1, sizeof(str1), "Costo: %d$", prezzo[playerid]*2);
            
PlayerTextDrawSetString(playerid, Textdrawbike3[playerid], str);
            return 
1;
            }
        else if(
secondi[playerid] == 60)
        {
            
secondi[playerid] = 0;
            
minuti[playerid] ++;
            
format(str, sizeof(str), "Tempo trascorso: %dm %ds",minuti[playerid],secondi[playerid]);
            
PlayerTextDrawSetString(playerid, Textdrawbike2[playerid], str);
            
format(str1, sizeof(str1), "Costo: %d$", prezzo[playerid]*2);
            
PlayerTextDrawSetString(playerid, Textdrawbike3[playerid], str);
            return 
1;
            }
        else if(
minuti[playerid] == 60)
        {
            
minuti[playerid] = 0;
            
ore[playerid]++;
            
format(str, sizeof(str), "Tempo trascorso: %so %dm %ds", ore[playerid], minuti[playerid], secondi[playerid]);
            
PlayerTextDrawSetString(playerid, Textdrawbike2[playerid], str);
            
format(str1, sizeof(str1), "Costo: %d$", prezzo[playerid]*2);
            
PlayerTextDrawSetString(playerid, Textdrawbike3[playerid], str);
            return 
1;
            }
        else if(
VeicoloAffittato[playerid] == 0)
        {
            
TextDrawHideForPlayer(playerid, Textdrawbike0);
            
TextDrawHideForPlayer(playerid, Textdrawbike1);
            
PlayerTextDrawHide(playerid, Textdrawbike2[playerid]);
            
PlayerTextDrawHide(playerid, Textdrawbike3[playerid]);
            
format(string, sizeof(string), "Hai terminato il noleggio. Hai speso $%d che ti sono stati addebitati sulla carta di credito.", prezzo[playerid]*2);
            
SendClientMessage(playerid, COLOR_WHITE, string);
            
Character[playerid][Bank] -= prezzo[playerid]*2;
            
KillTimer(Lorenzo[playerid]);
            return 
1;
            }
        }
    return 
1;
} 
Regarding your problem, where do you call the Callback InizioBici(playerid) ?
Reply


Messages In This Thread
Timer not starting - by alanhutch - 21.12.2017, 21:59
Re: Timer not starting - by RowdyrideR - 21.12.2017, 22:41
Re: Timer not starting - by alanhutch - 22.12.2017, 05:17
Re: Timer not starting - by RogueDrifter - 22.12.2017, 05:21
Re: Timer not starting - by alanhutch - 22.12.2017, 07:09
Re: Timer not starting - by RogueDrifter - 22.12.2017, 07:29
Re: Timer not starting - by alanhutch - 22.12.2017, 07:35
Re: Timer not starting - by RowdyrideR - 23.12.2017, 04:14
Re: Timer not starting - by alanhutch - 23.12.2017, 12:17

Forum Jump:


Users browsing this thread: 1 Guest(s)