setvehicletorespawn
#1

i have another problem after it happend the vehicle does not respawn...

Код:
if(newstate == PLAYER_STATE_ONFOOT && isDelivering[playerid] == 1)
	{
		new playerveh = GetPlayerVehicleID(playerid);
		SendClientMessage(playerid, COLOR_NEWS, "You left your bike, and failed the mission");
		DisablePlayerCheckpoint(playerid);
		isDelivering[playerid] = 0;
		LCP[playerid] = 0;
		KillTimer(pizzatimer[playerid]);
		TextDrawSetString(Textdraw38[playerid], "");
		TogglePlayerControllable(playerid, 1);
		TextDrawHideForPlayer(playerid,Textdraw38[playerid]);
		
		
		PutPlayerInVehicle(playerid, playerveh, 0);
		TogglePlayerControllable(playerid,1);
		SetVehicleToRespawn(playerveh);
	}
Reply
#2

You're trying to respawn 'playerveh' which you've defined using GetPlayerVehicleID. Great, except you're calling that code once the player is already on foot (so they aren't in a vehicle anymore) and 'playerveh' is returning as zero.
Reply
#3

Well, what do you expect? OnPlayerStateChange is called AFTER the state is changed thus GetPlayerVehicleID will just return 0. Use OnPlayerExitVehicle instead.
Edit: Slightly too slow.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)