Код:
if(strcmp(cmd, "/drag", true) == 0)
{
if(IsSpawned[playerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
return 1;
}
if(Jailed[playerid] ==1) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
return 1;
}
if(gTeam[playerid] != TEAM_SWAT) {
SendClientMessage(playerid,COLOR_ERROR,"You are not S.W.A.T. Only S.W.A.T can use this command");
return 1;
}
if(InDerby[playerid] == 1) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /drag (id)");
return 1;
}
giveplayerid = strval(tmp);
if(!IsPlayerConnected(giveplayerid)) {
format(string, sizeof(string), "ID (%d) is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
new oname[24];
new pname[24];
GetPlayerName(playerid,oname, 24);
GetPlayerName(giveplayerid, pname, 24);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /drag (id) ID Must be a number");
return 1;
}
if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 4) {
format(string, sizeof(string), "%s(%d) Is not close enough you cannot drag that player",pname, giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
if(InAdminMode[giveplayerid] == 1337) {
format(string, sizeof(string), "%s(%d) Is a server Admin. He / She is in Admin Mode. You cannot use this command on this player at this time",pname, giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
format(string, sizeof(string), "(ADMIN MODE) %s(%d) Has attempted to drag you. You are in Admin mode. You cannot be dragged",oname,playerid);
SendClientMessage(giveplayerid, 0xFF7F50AA, string);
return 1;
}
if(Jailed[giveplayerid] == 1) {
format(string, sizeof(string), "%s(%d) Is in jail. You cannot drag a prisoner",pname, giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
if(IsPlayerInAnyVehicle(playerid)) {
SendClientMessage(playerid, COLOR_ERROR, "You are in a vehicle.Get out to use /drag (id)");
return 1;
}
if(IsPlayerInAnyVehicle(giveplayerid)) {
SendClientMessage(playerid, COLOR_ERROR, "That player is already in a vehicle");
return 1;
}
if(gTeam[playerid] >= 3) // complete
{
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Dragged_|");
format(string, sizeof(string), "%s(%d): has Dragged you,use /breakcuffs to attempt an escape!",oname, playerid);
SendClientMessage(giveplayerid, COLOR_DODGERBLUE, string);
TogglePlayerControllable(giveplayerid, 0);
PutPlayerInVehicle(giveplayerid,KidCar[playerid],1);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +5);
coprank[playerid] +=1;
SendClientMessage(playerid, 0xA9A9A9AA, "|_Suspect Detained_|");
format(string, sizeof(string), "You have Dragged %s(%d).drive him straight to the pd to hand him over", pname, giveplayerid);
SendClientMessage(playerid, COLOR_DODGERBLUE, string);
format(string, sizeof(string), "%s(%d) has grabbed %s(%d) and thrown him into his car!",oname,playerid,pname,giveplayerid);
SendClientMessageToAll(0x00C7FFAA, string);
{
if(gTeam[playerid] == TEAM_COP && gTeam[playerid] == TEAM_ARMY && gTeam[playerid] == TEAM_CIA && gTeam[playerid] == TEAM_SWAT) {
SendClientMessage(giveplayerid, COLOR_ROYALBLUE,"DISPATCH: A S.W.A.T Officer has took a suspect into custody all units be aware do not shoot the S.W.A.T Officer");
}
}
}
return 1;
}