OnPlayerExitVehicle question
#1

Okay here i am... i have a Street Cleaner Job and i want it to make when i exit vehicle ( id 505-510 ) it close all my checkpoints... how can i do that?

This is my OnPlayerExitVehicle script


Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
	if (GetPlayerState(playerid) == 1)
	{
		return 1;
	}
	if(gGas[playerid] == 1)
	{
	  GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Je izasao iz Vozila", 500, 3);
	}
	return 1;
}
Please help! Thanks for reading!
Reply
#2

I'm not sure how reliable exit vehicle is, but you could use OnPlayerStateChange, and compare the oldstate to PLAYER_STATE_DRIVER (to check if they've been "demoted" from driving the car, to some other state)

Then within that you need to see if the player is on the job, by comparing a variable of some kind eg:

pawn Код:
if (IsWorking[playerid] == 1)
//destroy checkpoints
If you're asking how to remove checkpoints, see this: DisablePlayerCheckpoint

If this does not answer your question, either post again or message me or something..

EDIT: blah forget the OnPlayerStateChangeStuff, forgot you wanted to compare the vehicleid... Using OnPlayerExitVehicle should be fine, just compare the vehicle model to the numbers desired:

pawn Код:
new temp = GetVehicleModel(vehicleid);
if(temp >=505 && <=510)
{
//blah
}
Reply
#3

I know DisablePlayerCheckpoint but im having trouble with removing them when exiting the vehicle... dont want it to be anything with Job... just need to disable all Checkpoints after exiting vehicle ID 500-501 for example...
Reply
#4

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
new temp = GetVehicleModel(vehicleid);
if(temp >=505 && <=510)
 {
 DisablePlayerCheckpoint(playerid);
 }
}
Very basic, but I think it'll do what you're after.. unless i've misunderstood.

I don't guarantee this is 100% correct, I didn't test it with pawn, I scripted it on here..
Reply
#5

If you have more checkpoints you will get to see the next one.. correct? or.. am I wrong? I have never worked with this kind of system so i don't know.

If you are using a timer, you need to kill that timer so that it does not recreate the checkpoint. If you use something else (and my theory is correct ) than you should use a loop that loops through the next checkpoints and disables them
Reply
#6

Thanks guys, i got this problem solved!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)