SA-MP Forums Archive
Easy question! - 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)
+--- Thread: Easy question! (/showthread.php?tid=425608)



Easy question! - LeeXian99 - 26.03.2013

Well, I wonder what's the 2 represented...

pawn Код:
if(newkeys & KEY_SUBMISSION)
    {
        if(GetPlayerState(playerid) == 2)
        {
            SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
            RepairVehicle(GetPlayerVehicleID(playerid));
            GameTextForPlayer(playerid, "Vehicle Fixed", 2000, 6);
            PlayerPlaySound(playerid, 1133, 0, 0, 10);
        }
    }
pawn Код:
if(newkeys & KEY_FIRE)
    {
        if(GetPlayerState(playerid) == ) //What to put here?
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
            PlayerPlaySound(playerid, 1133, 0, 0, 10);
        }
    }



Re: Easy question! - dusk - 26.03.2013

One of these
https://sampwiki.blast.hk/wiki/Playerstates


Re: Easy question! - UberSocks - 26.03.2013

Player states are represented as an integer. You can find a list of them here:

https://sampwiki.blast.hk/wiki/Playerstates

According to that article, the code is looking to see if the player is the driver of any vehicle.


Re: Easy question! - Om3n - 26.03.2013

https://sampwiki.blast.hk/wiki/Playerstates


Re: Easy question! - LeeXian99 - 26.03.2013

Thanks, dusk.


Re: Easy question! - Dzines4SAMP - 26.03.2013

Quote:
Originally Posted by LeeXian99
Посмотреть сообщение
Well, I wonder what's the 2 represented...

pawn Код:
if(newkeys & KEY_SUBMISSION)
    {
        if(GetPlayerState(playerid) == 2)
        {
            SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
            RepairVehicle(GetPlayerVehicleID(playerid));
            GameTextForPlayer(playerid, "Vehicle Fixed", 2000, 6);
            PlayerPlaySound(playerid, 1133, 0, 0, 10);
        }
    }
pawn Код:
if(newkeys & KEY_FIRE)
    {
        if(GetPlayerState(playerid) == ) //What to put here?
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
            PlayerPlaySound(playerid, 1133, 0, 0, 10);
        }
    }
For the 1st one, if you press 2 in a vehicle, your vehicle will get fixed (2 can be of Numpad also)

For the 2nd one, if you press Left Alt, a Nitro will be added to your vehicle, only if you are in a vehicle.

For those both codes, you need to be in a vehicle of them to work

Or, it just represents https://sampwiki.blast.hk/wiki/Playerstates