Time Trial Race problem
#1

Hi everyone, this is the first time i post here so i hope i don't make any mistakes.

So basically i created a script inside my gamemode that let you play a "Time Trial Race", everything is fine if i do it and i'm alone (id: 0) but when a friend of mine comes (id: 1) and tries to get in to the race he gets teleported but the script won't execute the countdown so the 'public LVTrack(playerid);' cannot be executed.

Here's the script, hope you can help me

Код:
if (strcmp("/timetrial", cmdtext, true, 10) == 0)
	{
        if(IsPlayerInDM[playerid] == 1)
	    {
	    SendClientMessage(playerid,Red,"[Errore]: Non puoi entrare nella Race, sei nel Deathmatch! usa /leavedm");
	    } else {
	    
		if(Racer[playerid] == 0)
		{
		
        if(IsPlayerInAnyVehicle(playerid))
	    {
	    if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 411) {
	    
		LoadRace(playerid,"LasVenturasSprint");//secondo me il bug e' quiLoadRace(255,"DriftPark1");//secondo me il bug e' qui
	    TogglePlayerControllable(playerid,0);
		new vehicleid = GetPlayerVehicleID(playerid);
		//id dell'evento = 1
		Racer[playerid] = 1;
		//countdown
		SetTimer("Five", 1000, 0);
 	    SetTimer("Four", 2000, 0);
 	    SetTimer("Three", 3000, 0);
        SetTimer("Two", 4000, 0);
        SetTimer("One", 5000, 0);
 	    SetTimer("GoGoGo", 6000, 0);
 	    //messaggio
 	    new string[256];
        format(string, sizeof(string),"{00FF22}[Race]:{FFFFFF} Gara: {00CED1}%s{FFFFFF} Record: {00FF22}%d secondi {FFFFFF}di {F81414}%s ", CurrentRace, RaceInfo[rBestRaceTime], RaceInfo[rBest]);
     	SendClientMessage(playerid,White,string);
		SendClientMessage(playerid,Lightblue,"[Race]:{FFFFFF} Tra 5 secondi avra' inizio la gara, tieniti pronto e rimani all'interno del Checkpoint!");
		//tele veicolo
		SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 1);
		SetPlayerVirtualWorld(playerid,1); // Setta il player nel virtual world 1 per evitare di avere altri giocatori attorno
		SetVehiclePos(vehicleid, 2126.5879,1927.0288,10.3990);
		SetVehicleZAngle(vehicleid,359.1035);
		SetCameraBehindPlayer(playerid);
      	} else {
      	SendClientMessage(playerid,Lightblue,"[!]:{FFFFFF} Puoi entrare in questa gara solo con l'Infernus, procuratene una!");
      	}
		} else {
		SendClientMessage(playerid,Red,"[!]: Devi essere in un veicolo per poter partecipare alla gara!");
		}
		} else {
		SendClientMessage(playerid,Red,"[!]: Stai gia' partecipando alla gara e non puoi usare questo comando!");
		}
		}
Код:
public GoGoGo(playerid)
{
    if(Racer[playerid] == 1)
	{
	PlayerPlaySound(playerid, 1057, 0.0, 0.0, 10.0);
	TogglePlayerControllable(playerid,1);
	LVTrack(playerid);
	}
	return 1;
}
Код:
public LVTrack(playerid)
{
    StartPlayerRace(playerid);
    DisablePlayerRaceCheckpoint(playerid);
    SetPlayerRaceCheckpoint(playerid, 0, 2126.5310,2233.9612,10.3989, 2031.0769,2360.5205,10.3991, 10.0);
    
    
	return 1;
	}
Reply
#2

GoGoGo function has parameter in it, you should use SetTimerEx for that.
Код:
SetTimerEx("GoGoGo", 6000, 0, "d", playerid);
And, also you don't need to make a different timer per countdown, you can simply make 1 repeated timer, and kill the timer if the countdown is 0.
Reply
#3

Quote:
Originally Posted by X337
Посмотреть сообщение
GoGoGo function has parameter in it, you should use SetTimerEx for that.
Код:
SetTimerEx("GoGoGo", 6000, 0, "d", playerid);
And, also you don't need to make a different timer per countdown, you can simply make 1 repeated timer, and kill the timer if the countdown is 0.
Thanks, it worked! You're awesome! +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)