SA-MP Forums Archive
If you want to enter a specific vehicle ID, you need a specific skin - 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: If you want to enter a specific vehicle ID, you need a specific skin (/showthread.php?tid=366039)



If you want to enter a specific vehicle ID, you need a specific skin - davelord - 05.08.2012

Title, basically. I've requested this before, but I can't manage to compile it to a script. If a player for example wears skin ID 280, or 281, he or she gets access to vehicle ID 596 and vehicle ID 597, anyone that could give me an example?


Re: If you want to enter a specific vehicle ID, you need a specific skin - Luis- - 05.08.2012

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER) {
        if(GetPlayerSkin(playerid, *SKINID*)) {
            /* Code here */
        }
        else {
            RemovePlayerFromVehicle(playerid);
        }  
    }
    return 1;
}
Something like this?


Re: If you want to enter a specific vehicle ID, you need a specific skin - davelord - 05.08.2012

Well, yeah, it should just be like that, but don't I have to define the vehicle ID somewhere? Lol.


Re: If you want to enter a specific vehicle ID, you need a specific skin - Luis- - 05.08.2012

I'm working on it now xD. Hold on


Re: If you want to enter a specific vehicle ID, you need a specific skin - AustinJ - 05.08.2012

How about something like this?

Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
	if(vehicleid == 596 || vehicleid == 597)
	{
		if(GetPlayerSkin(forplayerid) != 280 && GetPlayerSkin(forplayerid) != 281)
		{
			SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
		}
	}
}
Not tested or compiled.


Re: If you want to enter a specific vehicle ID, you need a specific skin - Luis- - 05.08.2012

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    new modelid = GetVehicleModel(vehicleid);
    if(newstate == PLAYER_STATE_DRIVER) {
        if(GetPlayerSkin(playerid) == *SKINID* && modelid == *MODELID*) {
            /* CODE */
        }
        else {
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Works correctly.


Re: If you want to enter a specific vehicle ID, you need a specific skin - davelord - 05.08.2012

Thanks both of you :3


Re: If you want to enter a specific vehicle ID, you need a specific skin - Luis- - 05.08.2012

Anytime


Re: If you want to enter a specific vehicle ID, you need a specific skin - davelord - 07.08.2012

- How am I supposed to add multipe skins to your code, Luis? :3


Re: If you want to enter a specific vehicle ID, you need a specific skin - Eminem 2ka9 - 07.08.2012

You can use this too!

Код:
if(GetVehicleModel(vehicleid) == 520)
	{
    if(GetPlayerScore(playerid) < 500 && GetPlayerSkin(playerid) != 121)
    {
        SendClientMessage(playerid, COLOR_RED, "MESSAGE");
        RemovePlayerFromVehicle(playerid);
    }
}