08.10.2009, 12:17
pawn Код:
if(strcmp(cmd, "/lock", true) == 0)
{
if(VehicleLockedPlayer[playerid] != 999) // Player has locked a vehicle.
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(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[carid] = 0;
VehicleLockedPlayer[playerid] = 999; //unlocked
return 1;
}
}
else if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
new Float:x,Float:y,Float:z;
GetVehiclePos(VehicleLockedPlayer[playerid], x, y, z);
if(PlayerToPoint(5.0,playerid, x, y, z))
{
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[carid] = 0;
VehicleLockedPlayer[playerid] = 999; //unlocked
return 1;
}
}
SendClientMessage(playerid, COLOR_GREY, "[Error:] You must unlock your previous vehicle");
return 1;
}
else // Player hasn't locked a vehicle.
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new carid = GetPlayerVehicleID(playerid);
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;
}
SendClientMessage(playerid, COLOR_GREY, "[Error:] The vehicle is locked already");
return 1;
}
SendClientMessage(playerid, COLOR_GREY, "[Error:] You must drive a vehicle to lock one");
return 1;
}
return 1;
}