SA-MP Forums Archive
carid problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: carid problem (/showthread.php?tid=419410)



carid problem - TuTh - 28.02.2013

i replaced the id's with "taxicar" and don't work.why don't removing me from vehicle?

Код:
    TaxiCar[0] = AddStaticVehicleEx(420,-1970.5817,102.6015,27.4704,88.1076,-1, -1, 40000);//Taxi/*Taxi*/
	TaxiCar[1] = AddStaticVehicleEx(420,-1970.4128,84.7318,27.4523,90.8564,-1, -1, 40000);//Taxi/*Taxi*/
	TaxiCar[2] = AddStaticVehicleEx(420,-1970.2133,89.0358,27.4672,88.8046,-1, -1, 40000);//Taxi //CAR ID 85/*Taxi*/
	TaxiCar[3] = AddStaticVehicleEx(420,-1970.7659,98.5678,27.4736,89.6067,-1,-1,40000);//Taxi	


	}
		if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10) { }
		{
            if(PlayerInfo[playerid][pRank] < 4)
            {
                if(newcar == TaxiCar[0] || newcar == TaxiCar[1])
			    {
				    SendClientMessage(playerid, COLOR_GREY, "   Your Rank is to Low !");
                    RemovePlayerFromVehicle(playerid);
				}
			}
	    }



Respuesta: carid problem - CrossOv3r - 28.02.2013

How are you defined the variable
pawn Код:
newcar
Uh?

PD: Also in which callback is this code? .... OnPlayerEnterVehicle?


Re: carid problem - Patrick - 28.02.2013

Try This

PS: Whole Code are included there Enjoy!

pawn Код:
new TaxiCar[4];
public OnFilterscriptInit()//can be also change into OnGameModeInit if you want to add it to your gamemode
{
    TaxiCar[0] = AddStaticVehicleEx(420,-1970.5817,102.6015,27.4704,88.1076,-1, -1, 40000);//Taxi/*Taxi*/
    TaxiCar[1] = AddStaticVehicleEx(420,-1970.4128,84.7318,27.4523,90.8564,-1, -1, 40000);//Taxi/*Taxi*/
    TaxiCar[2] = AddStaticVehicleEx(420,-1970.2133,89.0358,27.4672,88.8046,-1, -1, 40000);//Taxi //CAR ID 85/*Taxi*/
    TaxiCar[3] = AddStaticVehicleEx(420,-1970.7659,98.5678,27.4736,89.6067,-1,-1,40000);//Taxi
    return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{  
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10)
        {
            if(PlayerInfo[playerid][pRank] < 4)
            {
                if(GetPlayerVehicleID(playerid) == TaxiCar[0] || GetPlayerVehicleID(playerid) == TaxiCar[1])
                {
                    SendClientMessage(playerid, COLOR_GREY, "Your Rank is to Low !");
                    RemovePlayerFromVehicle(playerid);
                }
            }
        }
    }
    return 1;
}
Cheers
PDS2012



Re: carid problem - TuTh - 28.02.2013

@CrossOv3r

the callback is on
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER) //buggy dont finnish
{

and newcar = GetPlayerVehicleID(playerid);

i don't understand why it's working with id's and with "taxicar" don't work