Can you explain
#1

I want to prevent simple player to enter in vehicle like hydra, hunter , tank etc
can you explain how can I do this
Reply
#2

Use "OnPlayerStateChange", "GetVehicleModel" and "RemovePlayerFromVehicle"

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATER_DRIVER)) //Checks if hes new state is driver
    {
        new model = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(model == 425 || model == 520 || model == 432) //Checks if the modelid is hunter, hydra & tank
        {
            SendClientMessage(playerid, 0xFFFFFFAA, "You are not allowed to drive this vehicle!"); //Just send a message to inform him about he is not allowed to drive this vehicle
            RemovePlayerFromVehicle(playerid); //Removed the player from the vehicle
        }
    }
    return 1;
}
Reply
#3

Showing this can you help more?
Код:
C:\DOCUME~1\Prabhat\Desktop\WORLDS~1.5\FILTER~1\LuxAdmin.pwn(8395) : error 017: undefined symbol "PLAYER_STATER_DRIVER"
C:\DOCUME~1\Prabhat\Desktop\WORLDS~1.5\FILTER~1\LuxAdmin.pwn(8395) : error 029: invalid expression, assumed zero
Reply
#4

Just an litte type error ^^

This should work:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER) //Checks if hes new state is driver
    {
        new model = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(model == 425 || model == 520 || model == 432) //Checks if the modelid is hunter, hydra & tank
        {
            SendClientMessage(playerid, 0xFFFFFFAA, "You are not allowed to drive this vehicle!"); //Just send a message to inform him about he is not allowed to drive this vehicle
            RemovePlayerFromVehicle(playerid); //Removed the player from the vehicle
        }
    }
    return 1;
}
Reply
#5

Thanks buddy it works fine !!!!!
Reply
#6

pawn Код:
if (AccInfo[playerid][pVip] < 1 || AccInfo[playerid][Level] < 5 )
    {
if(newstate == PLAYER_STATE_DRIVER) //Checks if hes new state is driver
    {
        new model = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(model == 425 || model == 520 || model == 432) //Checks if the modelid is hunter, hydra & tank
        {
            SendClientMessage(playerid, 0xFFFFFFAA, "This vehicle is only for VIPs!"); //Just send a message to inform him about he is not allowed to drive this vehicle
            RemovePlayerFromVehicle(playerid); //Removed the player from the vehicle
        }
    }
Working for admins but not for VIPs what to do
Reply
#7

pawn Код:
if(AccInfo[playerid][pVip] < 1 || AccInfo[playerid][Level] < 5 )
    {
if(newstate == PLAYER_STATE_DRIVER) //Checks if hes new state is driver
    {
        new model = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(model == 425 || model == 520 || model == 432) //Checks if the modelid is hunter, hydra & tank
        {
            SendClientMessage(playerid, 0xFFFFFFAA, "This vehicle is only for VIPs!"); //Just send a message to inform him about he is not allowed to drive this vehicle
            RemovePlayerFromVehicle(playerid); //Removed the player from the vehicle
        }
    }
line
pawn Код:
if (AccInfo[playerid][pVip] < 1 || AccInfo[playerid][Level] < 5 )
is
pawn Код:
if(accinfo[playerid][pVip] is LESS THAN 1 || AccInfo[playerid][Level] LESS THAN 5)
Working code:
pawn Код:
if (AccInfo[playerid][pVip] >= 1 || AccInfo[playerid][Level] >= 5 )
    {
if(newstate == PLAYER_STATE_DRIVER) //Checks if hes new state is driver
    {
        new model = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(model == 425 || model == 520 || model == 432) //Checks if the modelid is hunter, hydra & tank
        {
            SendClientMessage(playerid, 0xFFFFFFAA, "This vehicle is only for VIPs!"); //Just send a message to inform him about he is not allowed to drive this vehicle
            RemovePlayerFromVehicle(playerid); //Removed the player from the vehicle
        }
    }
Peace
Reply
#8

You're checking if the Player's VIP level is lower than 1.
No idea too, why you don't want admin level 5 or higher cannot use it.

Replace :
pawn Код:
if (AccInfo[playerid][pVip] < 1 || AccInfo[playerid][Level] < 5 )
With :
pawn Код:
if ( AccInfo[ playerid ][ pVip ] >= 1 || AccInfo[ playerid ][ Level ] > 0 )
Reply
#9

Quote:
Originally Posted by Basicz
Посмотреть сообщение
You're checking if the Player's VIP level is lower than 1.
No idea too, why you don't want admin level 5 or higher cannot use it.

Replace :
pawn Код:
if (AccInfo[playerid][pVip] < 1 || AccInfo[playerid][Level] < 5 )
With :
pawn Код:
if ( AccInfo[ playerid ][ pVip ] > 1 || AccInfo[ playerid ][ Level ] <= 5 )
Lol I was 3 seconds faster
Reply
#10

Max, on that code admins that have level lower than 5 cannot use it, I don't think ma_proking wants it like that.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)