12.07.2015, 18:12
PHP код:
CMD:tie(playerid, params[])
{
new targetid;
new current_zone;
current_zone = Player_Zone[targetid];
new vehicle;
vehicle = GetPlayerVehicleID(playerid);
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, RED, "[USAGE]: /tie [name/id]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, RED, "Player not found.");
if(GetTeam{playerid} != CLASS_CIV) return SendClientMessage(playerid, RED, "Only civilians can use this command.");
if(GetTeam{targetid} == CLASS_MEDIC) return SendClientMessage(playerid, RED, "You cant kidnap medics.");
if(targetid == playerid) return SendClientMessage(playerid, RED, "You cant kidnap yourself");
if(!ProxDetectorS(5.0, playerid, targetid)) return SendClientMessage(playerid, RED, "That player is not close enough.");
if(!IsPlayerInAnyVehicle(targetid) && !IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "You both have to be in a vehicle.");
if(PlayerInfo[playerid][pRope] < 1) return SendClientMessage(playerid, RED, "You need rope to kidnap players.");
if(HasBeenTied{targetid} == true) return SendClientMessage(playerid, RED, "That player is already tied up.");
if(!IsPlayerInVehicle(targetid, vehicle)) return SendClientMessage(playerid, RED, "You both have to be in the same vehicle.");
if(GetPlayerState(targetid) == PLAYER_STATE_DRIVER) return SendClientMessage(playerid, RED, "You cant kidnap the driver.");
if(IsOnduty{targetid} == 1) return SendClientMessage(playerid, RED, "You cant kidnap On-Duty admins.");
if(IsAtEvent{targetid} == 1) return SendClientMessage(playerid, RED, "You cant kidnap players at events.");
if(IsAtEvent{targetid} == 0)
{
TogglePlayerControllable(targetid, false);
HasBeenTied{targetid} = true;
PlayerInfo[playerid][pCrimes] ++;
PlayerInfo[playerid][pRope] --;
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 4);
format(fstr, sizeof(fstr), "%s [%d] has just kidnapped you.", GetName(playerid), playerid);
SendClientMessage(targetid, RED, fstr);
GameTextForPlayer(targetid, "~r~Kidnapped", 3000, 5);
GameTextForPlayer(playerid, "~g~Player Tied Up", 3000, 5);
SendClientMessage(playerid, YELLOW, "You have successfully tied the player up.");
SendClientMessage(playerid, RED, "Kidnap [WANTED LEVEL INCREASED]");
format(fstr, sizeof(fstr), "[DISPATCH]: Suspect %s [%d] has just kidnapped %s [%d] at %s.", GetName(playerid), playerid, GetName(targetid), targetid, ZoneNames[current_zone][zone_name]);
CopRadio(BLUE, fstr);
}
else
{
SendClientMessage(playerid, RED, "You cant kidnap players at events.");
}
new astring[64];
format(astring, sizeof(astring),"%s [%d] typed: /tie %d", GetName(playerid), playerid, targetid);
SendAdminMessage(GREY, astring);
return true;
}