SA-MP Forums Archive
[CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld (/showthread.php?tid=86066)



[CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld - Basss - 11.07.2009

Hey,
i have a little problem.. my races starts in Virtual Worlds so nobody can kill them and no wrong spawned car can block the street..
My problem is if somebody leaves the car in the race he won't set in the normal Virtualworld i tested all. But he dont set back.
I used SetPlayerVirtualWorld and SetVehicleVirtualWorld under OnPlayerStateChange.. but nothing happens with the worlds.. hes allready in the racevirtualworld. I dont nґknow if its an regular samp bug but i think.. Please help.


Re: [CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld - MenaceX^ - 11.07.2009

When does a player leave a race?


Re: [CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld - Basss - 11.07.2009

if he get out of the car..


Re: [CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld - Basss - 11.07.2009

all is ok if he hit the last cp.. he will set back in normal virtual world. if he do /raceexit the same or die.. only at OnPlayerStateChange he dont


Re: [CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld - MenaceX^ - 11.07.2009

Show the code of OnPlayerStateChange.


Re: [CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld - Basss - 11.07.2009

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new str[80];
	if (newstate == 2 || newstate == 3)
	{
 	format(str, sizeof(str), "~b~~h~~h~%s",VehNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
 	GameTextForPlayer(playerid, str, 5000, 1);
	}

	if (MotoGP[playerid] == 1 && (newstate == 1 && oldstate == 2))
 	{
		new string[128];
		new string2[128];
		StartTime[playerid] = 0;
		RaceTime[playerid] = 0;
 	  new pName[MAX_PLAYER_NAME];
		JoinedRace[playerid] = 0;
		MotoGate[playerid] = 1;
		MotoGP[playerid] = 0;
		JoinedRace[playerid] = 0;
		raceplayers--;
		DisablePlayerRaceCheckpoint(playerid);
		GetPlayerName(playerid,pName,sizeof(pName));
  		format(string,sizeof(string),"RENNINFO: %s ist aus dem Rennen ausgeschieden! [Ьbrige Spieler: %d]",pName,raceplayers);
  		format(string2,sizeof(string2),"RACENEWS: %s is eliminated from the race! [left players: %d]",pName,raceplayers);
  		SendLanguageMessageToAll(GELB,string,string2);
		RaceExit2[playerid] = SetTimerEx("RaceExit",500,1,"d",playerid);
		if(raceplayers < 1)
		{
		SendLanguageMessageToAll(GELB,"RENNINFO: Das Rennen ist beendet!","The race is finished!");
		rennengestartet = 0;
		raceplayers = 0;
		racelist = 1;
		KillTimer(Rennen);
 		}
	}
Код:
public RaceExit(playerid)
{
	if(GetPlayerVirtualWorld(playerid == 0))
	{
	KillTimer(RaceExit2[playerid]);
	}
	if(IsPlayerInAnyVehicle(playerid))
 	{
	SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),0);
	SetPlayerVirtualWorld(playerid,0);
	}else{
	SetPlayerVirtualWorld(playerid,0);
	}
	return 1;
}



Re: [CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld - MenaceX^ - 11.07.2009

I didn't bother reading the code, you posted whole OnPlayerStateChange, I meant to the part of the race only.
Try using OnPlayerExitVehicle.


Re: [CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld - Basss - 11.07.2009

this is only the part of the race o.O


Re: [CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld - Basss - 11.07.2009

problem resolved.. thx for helping but i did it by myself

~close


Re: [CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld - MenaceX^ - 11.07.2009

Just want to mention:
Double posting is not allowed, you should've edited the posts instead.