21.12.2017, 21:59
pawn Код:
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;
}
TextDraws in InizioBici are showing but the timer is not starting.
Help me please