what function should i use?
#1

i was curious cause im working on a VIP system right? and DMing isnt allowed on my server and i want to make VIP only vehicles. and i want to make it so if a player tried to get in that specific vehicle it will remove them from it, soo i was just wondering what function i should use to make the vehicle of course im going to use "GetPlayerVehicleID" but the paramaters dont have any thing about the veh ID. help plox?
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle
Reply
#3

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
giving links dont really help and im not that illiterate with this language and plus im already using that one lol , i want to remove the players from specific vehicles. how would i do that?

like for instance im trying this ATM

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerVipType(playerid, 0))
    if(GetPlayerVehicleID(playerid) == 1)
    if(vehid > 520)
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, COLOR_RED, "ERROR: This is a VIP only vehicle!");
    return 1;
}
but its not removing the player from the vehicle.
Reply
#4

Use timer for 4sec in on player enter vehicle.
Reply
#5

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerVipType(playerid, 0) && GetVehicleModel(vehicleid) > 520)
    {
        ClearAnimations(playerid);
        SendClientMessage(playerid, COLOR_RED, "ERROR: This is a VIP only vehicle!");
    }
    return 1;
}
Reply
#6

You can do it like this for restricting a single car on the whole server.

pawn Код:
new VIPCar1 = CreateVehicle Code over here;//Add this under OnGameModeInIt

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerVipType(playerid, 0))
    {
        if(IsPlayerInVehicle(playerid, VIPCar1)) // Checking the car is right or not.
        {
        SendClientMessage(playerid, COLOR_RED, "ERROR: This is a VIP only vehicle!");
        RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Reply
#7

OnPlayerEnterVehicle is called when a player STARTS to enter a vehicle. You should use OnPlayerStateChange, which will pass 'newstate' as 2 if they enter a vehicle as a driver, and if you use GetPlayerVehicleID you can check if it is a VIP vehicle or not, if so use RemovePlayerFromVehicle.
Reply
#8

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
You can do it like this for restricting a single car on the whole server.

pawn Код:
new VIPCar1 = CreateVehicle Code over here;//Add this under OnGameModeInIt

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerVipType(playerid, 0))
    {
        if(IsPlayerInVehicle(playerid, VIPCar1)) // Checking the car is right or not.
        {
        SendClientMessage(playerid, COLOR_RED, "ERROR: This is a VIP only vehicle!");
        RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
should it be like this?

pawn Код:
new VIPCar1 = 520;

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerVipType(playerid, 0))
    {
        if(IsPlayerInVehicle(playerid, VIPCar1)) // Checking the car is right or not.
        {
        SendClientMessage(playerid, COLOR_RED, "ERROR: This is a VIP only vehicle!");
        RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by xXitsgodzillaXx
Посмотреть сообщение
should it be like this?

pawn Код:
new VIPCar1 = 520;

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerVipType(playerid, 0))
    {
        if(IsPlayerInVehicle(playerid, VIPCar1)) // Checking the car is right or not.
        {
        SendClientMessage(playerid, COLOR_RED, "ERROR: This is a VIP only vehicle!");
        RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Like this:

pawn Код:
new VIPCar1 = CreateVehicle(490,2578.1166,-2431.7924,13.6278,314.8088,0,0,5 * 60  * 1000);
// Add the above line under OnGameModeInIt Callback.

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerVipType(playerid, 0))
    {
        if(IsPlayerInVehicle(playerid, VIPCar1)) // Checking the car is right or not.
        {
        SendClientMessage(playerid, COLOR_RED, "ERROR: This is a VIP only vehicle!");
        RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
EDIT:

But you should keep this in mind too.

Quote:
Originally Posted by MP2
Посмотреть сообщение
OnPlayerEnterVehicle is called when a player STARTS to enter a vehicle. You should use OnPlayerStateChange, which will pass 'newstate' as 2 if they enter a vehicle as a driver, and if you use GetPlayerVehicleID you can check if it is a VIP vehicle or not, if so use RemovePlayerFromVehicle.
Reply
#10

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Like this:

pawn Код:
new VIPCar1 = CreateVehicle(490,2578.1166,-2431.7924,13.6278,314.8088,0,0,5 * 60  * 1000);
// Add the above line under OnGameModeInIt Callback.

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerVipType(playerid, 0))
    {
        if(IsPlayerInVehicle(playerid, VIPCar1)) // Checking the car is right or not.
        {
        SendClientMessage(playerid, COLOR_RED, "ERROR: This is a VIP only vehicle!");
        RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
EDIT:

But you should keep this in mind too.
this is close to what i want. uh i want it to be it so that if they spawn one or if the find one they wont be able to get in, or get removed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)