SA-MP Forums Archive
Can you explain - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Can you explain (/showthread.php?tid=263475)



Can you explain - MA_proking - 22.06.2011

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


Re: Can you explain - Laronic - 22.06.2011

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;
}



Re: Can you explain - MA_proking - 22.06.2011

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



Re: Can you explain - Laronic - 22.06.2011

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;
}



Re: Can you explain - MA_proking - 22.06.2011

Thanks buddy it works fine !!!!!


Re: Can you explain - MA_proking - 22.06.2011

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


Re: Can you explain - Max_Coldheart - 22.06.2011

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


Re: Can you explain - Basicz - 22.06.2011

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 )



Re: Can you explain - Max_Coldheart - 22.06.2011

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


Re: Can you explain - Basicz - 22.06.2011

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