[CRITICAL] SetPlayerVirtualWorld / SetVehicleVirtualWorld
#1

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.
Reply
#2

When does a player leave a race?
Reply
#3

if he get out of the car..
Reply
#4

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
Reply
#5

Show the code of OnPlayerStateChange.
Reply
#6

Код:
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;
}
Reply
#7

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

this is only the part of the race o.O
Reply
#9

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

~close
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)