Vehicles and permissions
#1

I need one function which ejects player from vehicle if he didn't have needed skin...
P.S when player enter vehicle i need text when he got ejected. ex: You can't drive this..
Reply
#2

Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == 2)
{
 if(!GetPlayerSkin == theskinidyouwant)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "You can't drive this vehicle.");
}
}
}
This should work.
Reply
#3

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == vid //Fill in the vehicle id
    {
        if(GetPlayerSkin(playerid) != skin) //Fill in the skin
        {
            RemovPlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xFF0000FF, "you cant drive this");
        }
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by AeroBlast
View Post
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == vid //Fill in the vehicle id
    {
        if(GetPlayerSkin(playerid) != skin) //Fill in the skin
        {
            RemovPlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xFF0000FF, "you cant drive this");
        }
    }
    return 1;
}
I was got this error

Code:
C:\Users\Root\Desktop\Serveris\gamemodes\Untitled.pwn(207) : error 029: invalid expression, assumed zero
Reply
#5

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == vid) //Fill in the vehicle id
    {
        if(GetPlayerSkin(playerid) != skin) //Fill in the skin
        {
            RemovPlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xFF0000FF, "you cant drive this");
        }
    }
    return 1;
}
Reply
#6

Damn guys thats not working, i was not ejected from car if i didn't got skin 27
Reply
#7

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == vid) //Fill in the vehicle id
    {
        if(GetPlayerSkin(playerid) != skin) //Fill in the skin
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xFF0000FF, "you cant drive this");
        }
    }
    return 1;
}
Forgot the e in RemovePlayerFromVehicle.. :/
Reply
#8

Quote:
Originally Posted by AeroBlast
View Post
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == vid) //Fill in the vehicle id
    {
        if(GetPlayerSkin(playerid) != skin) //Fill in the skin
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xFF0000FF, "you cant drive this");
        }
    }
    return 1;
}
Forgot the e in RemovePlayerFromVehicle.. :/
Not that i mean
When iam enter vehicle without skin 27 iam still can enter, but i want to enter vehicle (only) with skin 27
Reply
#9

For any vehicle or just for a specific vehicle?
Reply
#10

Quote:
Originally Posted by [PC]henkie[NL]
View Post
For any vehicle or just for a specific vehicle?
for specific
Reply
#11

Did you replace the 'vid' in if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == vid) with that vehicle ID?
Reply
#12

Quote:
Originally Posted by AeroBlast
View Post
Did you replace the 'vid' in if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == vid) with that vehicle ID?
yes!
Reply
#13

Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == 2)
	{
		if(GetPlayerSkin(playerid) == skin %% GetVehicleModel(GetPlayerVehicleID(playerid)) == car)// replace skin with the skin id you want, replace car with the carmodel id you want.
		{
			SendClientMessage(playerid, color, "Welcome to your car!"); // Replace color with the color you want
		}
		else
		{
		    RemovePlayerFromVehicle(playerid);
		    SendClientMessage(playerid, color, "You are not allowed to drive this car!"); //replace color with the color you want
		}
	}
	return 1;
}
That should work.
Reply
#14

Quote:
Originally Posted by [PC]henkie[NL]
View Post
Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == 2)
	{
		if(GetPlayerSkin(playerid) == skin %% GetVehicleModel(GetPlayerVehicleID(playerid)) == car)// replace skin with the skin id you want, replace car with the carmodel id you want.
		{
			SendClientMessage(playerid, color, "Welcome to your car!"); // Replace color with the color you want
		}
		else
		{
		    RemovePlayerFromVehicle(playerid);
		    SendClientMessage(playerid, color, "You are not allowed to drive this car!"); //replace color with the color you want
		}
	}
	return 1;
}
That should work.
error:

Code:
C:\Users\Root\Desktop\Serveris\gamemodes\Untitled.pwn(214) : error 029: invalid expression, assumed zero
C:\Users\Root\Desktop\Serveris\gamemodes\Untitled.pwn(214) : warning 215: expression has no effect
C:\Users\Root\Desktop\Serveris\gamemodes\Untitled.pwn(214) : error 001: expected token: ";", but found ")"
C:\Users\Root\Desktop\Serveris\gamemodes\Untitled.pwn(214) : error 029: invalid expression, assumed zero
C:\Users\Root\Desktop\Serveris\gamemodes\Untitled.pwn(214) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#15

Quote:
Originally Posted by Artie_Scorpion
View Post
error:

Code:
C:\Users\Root\Desktop\Serveris\gamemodes\Untitled.pwn(214) : error 029: invalid expression, assumed zero
C:\Users\Root\Desktop\Serveris\gamemodes\Untitled.pwn(214) : warning 215: expression has no effect
C:\Users\Root\Desktop\Serveris\gamemodes\Untitled.pwn(214) : error 001: expected token: ";", but found ")"
C:\Users\Root\Desktop\Serveris\gamemodes\Untitled.pwn(214) : error 029: invalid expression, assumed zero
C:\Users\Root\Desktop\Serveris\gamemodes\Untitled.pwn(214) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Did you copied properly? Because when I compile, it totally works. Did you replace the skin etc, like i said in the comments?
Reply
#16

Quote:
Originally Posted by [PC]henkie[NL]
View Post
Did you copied properly? Because when I compile, it totally works. Did you replace the skin etc, like i said in the comments?


Reply
#17

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        if(GetPlayerSkin(playerid) == skin && GetVehicleModel(GetPlayerVehicleID(playerid)) == car)// replace skin with the skin id you want, replace car with the carmodel id you want.
        {
            SendClientMessage(playerid, color, "Welcome to your car!"); // Replace color with the color you want
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, color, "You are not allowed to drive this car!"); //replace color with the color you want
        }
    }
    return 1;
}
There was: '%%'. It should be: '&&'.
Reply
#18

whoops, sorry, i pressed the wrong button on my keyboard xd it must be &&, i'm sorry. The rest of the script should work.
Reply
#19

Quote:
Originally Posted by Artie_Scorpion
View Post
for specific
Do This

pawn Code:
//Put This At The Top
new vtest;
//Put vtest = CreateVehicle(520, 1946.0304, -2346.7761, 14.5325, 0.0000, -1, -1, 100);
//public OnGameModeInit()
//{
    // Don't use these lines if it's a filterscript
//  SetGameModeText("Blank Script");
//  vtest = CreateVehicle(520, 1946.0304, -2346.7761, 14.5325, 0.0000, -1, -1, 100);
//  return 1;
//}
//This is the hydra it will spawn at LS airport just past the main entrance
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == vtest //Fill in the vehicle id
    {
        if(GetPlayerSkin(playerid) != 26) //Fill in the skin
        {
            RemovPlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xFF0000FF, "you cant drive this");
        }
    }
    return 1;
}
Reply
#20

Quote:
Originally Posted by Ultra-Gaming
View Post
Do This

pawn Code:
//Put This At The Top
new vtest;
//Put vtest = CreateVehicle(520, 1946.0304, -2346.7761, 14.5325, 0.0000, -1, -1, 100);
//public OnGameModeInit()
//{
    // Don't use these lines if it's a filterscript
//  SetGameModeText("Blank Script");
//  vtest = CreateVehicle(520, 1946.0304, -2346.7761, 14.5325, 0.0000, -1, -1, 100);
//  return 1;
//}
//This is the hydra it will spawn at LS airport just past the main entrance
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == vtest //Fill in the vehicle id
    {
        if(GetPlayerSkin(playerid) != 26) //Fill in the skin
        {
            RemovPlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xFF0000FF, "you cant drive this");
        }
    }
    return 1;
}
Thanks for beating a dead horse.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)