SA-MP Forums Archive
Simple help me please - 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: Simple help me please (/showthread.php?tid=273640)



Simple help me please - Davz*|*Criss - 02.08.2011

hey guys this is the function i am creating it

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == 520)
    {
      if(!pRank[playerid] = 3; SendClientMessage(playerid, 0xFF0000FF, "You need to be Level: 3 to use this vehicle");
    }
    return 1;
}
And when player enter hydra it show him that message you need to be level 3 to use this vehicle.

I got actually ranks in my script.

so i want to set this hydra only for rank 3


thanks


Re: Simple help me please - Calgon - 02.08.2011

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate) {
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520 && newstate == 2) {
        if(pRank[playerid] != 3) {
            SendClientMessage(playerid, 0xFF0000FF, "You need to be Level: 3 to use this vehicle");
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
The code above will work if the player is only level 3, if you want to check if the player is level 3 or higher, use this code:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate) {
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520 && newstate == 2) {
        if(pRank[playerid] >= 3) {
            SendClientMessage(playerid, 0xFF0000FF, "You need to be Level: 3 to use this vehicle");
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}



Re: Simple help me please - Davz*|*Criss - 02.08.2011

Its not working, When i enter nothing.


Re: Simple help me please - Calgon - 02.08.2011

What's the value of your 'pRank'? Also, just copy the code from OnPlayerStateChange in to your current OnPlayerStateChange callback, instead of just copying all of the code.