07.06.2017, 22:18
I am using this for updating the textdraw so I need the id (or maybe I could LOOP for who is in the "raceid")
How do you mean it should be global variable ?
Код:
function RaceTime(raceid,playerid) { RaceInfo[raceid][racetime] ++; new time = GetTickCount() - RaceInfo[raceid][raceticktime]; if(floatround((RaceInfo[raceid][racetime] / 10), floatround_floor) >= RaceInfo[raceid][racetimeout]) StopRace(raceid); new string[512], minutes, seconds, miliseconds,hours; ms_to_time(time, hours, minutes, seconds, miliseconds); format(string, sizeof(string),"%s~n~Time:%d:%d:%d~n~Checkpoints:%d/%d",RaceInfo[raceid][racename],minutes,seconds,miliseconds,RaceCheckpoint[playerid]-2,RaceInfo[raceid][cpnum] - 1); PlayerTextDrawSetString(playerid,RaceTextDraw[playerid][0],string); return 1; }
Код:
function StartRace(raceid) { RaceInfo[raceid][racejoinable] = false; foreach(new i : Player) { if(InRace[i] != raceid) continue; if(IsPlayerInRaceCheckpoint(i) && (GetVehicleModel(GetPlayerVehicleID(i)) == RaceInfo[raceid][racevehicle])) { SetPVarInt(i,"raceID",raceid); CountDownForAll(sizeof(CDTxt)-1); } else { SendClientMessage(i, COLOR_RED, "You weren't in start checkpoint or you didn't have the right vehicle!"); RaceCheckpoint[i] = -1; InRace[i] = -1; RaceInfo[raceid][raceticktime] = 0; DisablePlayerRaceCheckpoint(i); new vehicleid = GetPlayerVehicleID(i); SetVehicleVirtualWorld(vehicleid, 0); SetPlayerVirtualWorld(i, 0); PutPlayerInVehicle(i, vehicleid, 0); } } return 1; }