pawn Code:
if(strcmp(cmd, "/lock", true) == 0)
{
new carid = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(VehicleLockedPlayer[playerid] != 999)
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You already locked this vehicle or another vehicle");
return 1;
}
if(VehicleLocked[carid] == 0)
{
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"locked his vehicle");
}
else
{
PlayerActionMessage(playerid,15.0,"locked her vehicle");
}
SendClientMessage(playerid, COLOR_WHITE, "[Info:] Vehicle Locked");
VehicleLocked[carid] = 1;
VehicleLockedPlayer[playerid] = carid;
}
}
else if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
new Float:x,Float:y,Float:z;
if(VehicleLockedPlayer[playerid] != 999)
{
GetVehiclePos(VehicleLockedPlayer[playerid], x, y, z);
}
if(VehicleLocked[VehicleLockedPlayer[playerid]])
{
if(PlayerToPoint(5.0,playerid,x,y,z) || GetPlayerVehicleID(playerid) == VehicleLockedPlayer[playerid])
{
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"unlocked his vehicle");
}
else
{
PlayerActionMessage(playerid,15.0,"unlocked her vehicle");
}
SendClientMessage(playerid, COLOR_WHITE, "[Info:] Vehicle Unlocked");
VehicleLocked[VehicleLockedPlayer[playerid]] = 0;
VehicleLockedPlayer[playerid] = 999;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not near the vehicle");
}
}
}
return 1;