on player enter vehicle job help
#1

Hello again, been trying to set up a very simple job script as a test as still learning to script.

I am trying to make it so when you get into a road sweeper it shows you some checkpoints to follow, then at the end you get paid.
the checkpoints work, just not when you enter the road sweeper.
here is the code so far.

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
		if(IsPlayerInVehicle(playerid, 5))
		{
   	switch (gPlayerClass[playerid]) {
	  case 0:
	    {
				gPlayerCheckpointStatus[playerid] = a;
				SetPlayerCheckpoint(playerid,2469.1475,1322.0675,10.4613,5.0);
			}
		}
}

		return 1;
}
and for the checkpoints we have:

Код:
public OnPlayerEnterCheckpoint(playerid)

{
				switch (gPlayerCheckpointStatus[playerid])
			 	{
		case a:
		  {
	      SetPlayerCheckpoint(playerid,2479.0896,1310.7059,10.3827, 5.0);
	      gPlayerCheckpointStatus[playerid] = b;
			}
		case b:
		  {
	      SetPlayerCheckpoint(playerid,2524.4277,1264.8644,10.3773, 5.0);
	      gPlayerCheckpointStatus[playerid] = c;
			}
		case c:
		  {
	      SetPlayerCheckpoint(playerid,2524.4277,1264.8644,10.3773, 5.0);
	      gPlayerCheckpointStatus[playerid] = d;
			}
		case d:
		  {
	      SetPlayerCheckpoint(playerid,2605.0200,1220.7946,10.3762, 5.0);
	      gPlayerCheckpointStatus[playerid] = e;
			}
		case e:
		  {
	      SetPlayerCheckpoint(playerid,2580.1274,1195.5510,10.3770, 5.0);
	      gPlayerCheckpointStatus[playerid] = f;
			}
		case f:
		  {
	      SetPlayerCheckpoint(playerid,2525.5796,1184.9374,10.4612, 5.0);
	      gPlayerCheckpointStatus[playerid] = g;
			}
		case g:
		  {
	      SetPlayerCheckpoint(playerid,2525.7312,1105.6997,10.3763, 5.0);
	      gPlayerCheckpointStatus[playerid] = h;
			}
    case h:
		  {
	      SetPlayerCheckpoint(playerid,2525.6943,1042.0247,10.3761, 5.0);
	      gPlayerCheckpointStatus[playerid] = bubble;
			}
		case bubble:
		  {
	      SetPlayerCheckpoint(playerid,2501.3740,1015.2286,10.3795, 5.0);
	      gPlayerCheckpointStatus[playerid] = j;
			}
		case j:
		  {
	      SetPlayerCheckpoint(playerid,2427.0015,1009.4689,10.5104, 5.0);
	      gPlayerCheckpointStatus[playerid] = k;
			}
		case k:
		  {
	      SetPlayerCheckpoint(playerid,2438.0674,950.9582,10.3771, 5.0);
	      gPlayerCheckpointStatus[playerid] = l;
			}
    case l:
		  {
	      SetPlayerCheckpoint(playerid,2502.9734,951.0641,10.3782, 5.0);
	      gPlayerCheckpointStatus[playerid] = m;
			}
		case m:
		  {
	      SetPlayerCheckpoint(playerid,2549.9026,966.2288,10.3699, 5.0);
	      gPlayerCheckpointStatus[playerid] = n;
			}
    case n:
		  {
	      SetPlayerCheckpoint(playerid, 2568.0083,1010.5892,10.5134, 5.0);
	      gPlayerCheckpointStatus[playerid] = o;
			}
		case o:
		  {
	      SetPlayerCheckpoint(playerid,2609.4746,1054.5164,10.3772, 5.0);
	      gPlayerCheckpointStatus[playerid] = p;
			}
		case p:
		  {
	      SetPlayerCheckpoint(playerid,2609.6333,1229.4449,10.3776, 5.0);
	      gPlayerCheckpointStatus[playerid] = q;
			}
		case q:
		  {
	      SetPlayerCheckpoint(playerid,2630.3811,1271.8402,10.3762, 5.0);
	      gPlayerCheckpointStatus[playerid] = r;
			}
    case r:
		  {
	      SetPlayerCheckpoint(playerid,2585.1150,1315.3558,10.4237, 5.0);
	      gPlayerCheckpointStatus[playerid] = s;
			}
		case s:
		  {
	      SetPlayerCheckpoint(playerid,2471.9414,1317.6454,10.4912, 5.0);
	      gPlayerCheckpointStatus[playerid] = t;
			}
		case t:
		  {
	      SetPlayerCheckpoint(playerid,2471.4775,1338.0422,10.5224, 5.0);
	      gPlayerCheckpointStatus[playerid] = t;
	      GivePlayerMoney(playerid, 100);
	      SendClientMessage(playerid, 0x9932CCFF, "You have recieved $100 for clearing Las Venturas's Streets.");
				DisablePlayerCheckpoint(playerid);
			}
		 	}
				return 1;
}
if the checkpoints where set to "onplayerspawn" then it all works ok, i just need some help on how to make them work when you get in the road sweeper.

Thanks in advance.
Glob.
Reply
#2

Correct vehicle ID is 5? Correct gPlayerClass is 0?
Reply
#3

yes the vehicle id and gplayerclass is correct.

when i get in the roadsweeper nothing happens
Reply
#4

Use OnPlayerStateChange instead of OnPlayerEnterVehicle (a player isn't in the vehicle when they are entering it!)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)