02.08.2014, 16:56
Car Lock System by Wizdo
What does it do?
This script locks your car by pressing LALT and unlocks it by pressing TAB
Download link:
http://pastebin.com/RHXw7CUY
Download link:
http://pastebin.com/RHXw7CUY
#include <a_samp>
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new PlayerVehLocked[MAX_PLAYERS];
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_ACTION))//TAB KEY
{
if (IsPlayerInAnyVehicle(playerid))
{
if(PlayerVehLocked[playerid] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,false,false);
GameTextForPlayer(playerid, "Unlocked", 5000, 3);
}
else if(PlayerVehLocked[playerid] == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,false,true);
GameTextForPlayer(playerid, "Locked", 5000, 3);
}
}
}
return 1;
}
//Press Tab to lock/unlock