Faction/Job vehicles
#1

Can anyone give me an idea on how to make a pickup, that when picked up it spawns a vehicle that nobody but you can enter it. What I tried doing is creating a variable, let's just say pizzaboy[MAX_PLAYERS];

When you enter a pickup, it spawns the car and everything is ok, but there is one problem though. I've made more cars: sweeper[MAX_PLAYERS], tractor[MAX_PLAYERS]. And now when I enter one of them, sometimes they get the wrong callback (I enter the sweeper and it acts as if its the pizzaboy). Does anyone know what am I doing wrong? Maybe you have a better idea.

Here's some code:

Pizzaboy pickup code:
Код:
if(pickupid == ppizzaboy)
    {
    if(pInfo[playerid][Darbas] == DARBAS_PICININKAS || pInfo[playerid][Admin] >= 2)
    {
    if(IsValidVehicle(pizzaboy[playerid])){ DestroyVehicle(sweeper[playerid]); }
    pizzaboy[playerid] = CreateVehicle(448,218.9097,-180.5808,1.1772,85.6636,3,6,-1);
    PutPlayerInVehicle(playerid,pizzaboy[playerid],0);
    }
	else
	{
	//bla bla bla not a pizzaguy
	}
    }
now here's the OnPlayerStateChange callback

Код:
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
	{
	
    if(GetPlayerVehicleID(playerid) == sweeper[playerid])
    {
    if(pInfo[playerid][Darbas] == DARBAS_SLAVEJAS || pInfo[playerid][Admin] >= 2)
    {
	//bla bla sweeper
    }
    else
    {
	KickPlayerOutOfVehicle(playerid); 
	//bla bla wrong job mate
 	}
    }

    else if(GetPlayerVehicleID(playerid) == pizzaboy[playerid]) //pizzaboy
	{
 	if(pInfo[playerid][Darbas] == DARBAS_PICININKAS || pInfo[playerid][Admin] >= 2)
 	{
 	//Bla bla pizzaguy stuff	
	}
	else
	{
	KickPlayerOutOfVehicle(playerid);
	//Bla bla not your car
	}
	}
Reply


Messages In This Thread
Faction/Job vehicles - by siemka321 - 25.11.2014, 13:07
Re: Faction/Job vehicles - by dusk - 25.11.2014, 13:23
Re: Faction/Job vehicles - by siemka321 - 25.11.2014, 13:34
Re: Faction/Job vehicles - by siemka321 - 25.11.2014, 19:31
Re: Faction/Job vehicles - by Steven82 - 25.11.2014, 21:00
Re: Faction/Job vehicles - by siemka321 - 25.11.2014, 21:08
Re: Faction/Job vehicles - by siemka321 - 26.11.2014, 13:29

Forum Jump:


Users browsing this thread: 1 Guest(s)