admincar restrict by vehicle color
#1

hey guys,
i will restrict my vehicles by vehicle color.
If the vehilce color1 and color2 is black, than only a admin can enter the vehicle. other play will be removed outiside.

my code:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new color1, color2;
    color1 = 0;
    color2 = 0;
    if(newstate == PLAYER_STATE_DRIVER)
	{
		if(GetVehicleColor(GetPlayerVehicleID(playerid), color1, color2))
	    {
	         if(SpielerInfo[playerid][pAdmin] < 6)
	         {
	             RemovePlayerFromVehicle(playerid);
	             SendClientMessage(playerid, red, "{FF0000}[SERVER] {FFFFFF}Only for Admin");
	         }
	    }
 	}
	return 1;
}
but it will not work, it remove alle player form all vehicles abov admin lvl 6.. i will it only vor vehicles witch is black colored. i dont know how to code this.

i use this include: https://sampforum.blast.hk/showthread.php?tid=235398

hope for help
Reply
#2

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new color1, color2;
    if(newstate == PLAYER_STATE_DRIVER)
	{
GetVehicleColor(GetPlayerVehicleID(playerid),color1,color2);// Should be Indented, but this sets color1 & color2
		if( color1==1 && color2==1 && SpielerInfo[playerid][pAdmin]<6 )
	    {
	             RemovePlayerFromVehicle(playerid);
	             SendClientMessage(playerid, red, "{FF0000}[SERVER] {FFFFFF}Only for Admin");
	    }
 	}
	return 1;
}
Kinda rushing this, but give this a shot, you must first store the colors of the car to color1 and color2 by using GetVehicleColor() and then check if those colors are black along with if the player is admin etc.
Reply
#3

thx your are the best
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)