24.10.2012, 19:28
full command for those who are wondering, I have no idea about it myself.. everything looks okay.
pawn Код:
dcmd_search(playerid,params[])
{
new string[128];
new ID;
if(sscanf(params, "u", ID))
{
SendClientMessage(playerid,COLOR_ERROR,"AeroBot: /search (Player Name/ID)");
return 1;
}
if(IsSpawned[playerid] != 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
return 1;
}
if(IsKidnapped[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You are kidnapped. You cannot use this command.");
return 1;
}
if(IsFrozen[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You have been frozen by a Server Administrator. You cannot use this command.");
return 1;
}
if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_CIA)
{
SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can search suspects.");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot search them",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) > 4)
{
format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to search him.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsCuffed[ID] == 0)
{
format(string,sizeof(string),"%s(%d) is not cuffed. You must cuff the player before trying to search them.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot search a suspect while in a vehicle. Exit the vehicle first.");
return 1;
}
if(GetPlayerState(ID) == PLAYER_STATE_DRIVER || GetPlayerState(ID) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot search a suspect while they are in a vehicle. Get them to exit the vehicle first.");
return 1;
}
if(playerid == ID)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot search yourself, i think you already know what you are carrying.");
return 1;
}
if(IsSpawned[ID] != 1)
{
format(string,sizeof(string),"%s(%d) is not spawned. You cannot search dead people ..",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsFrozen[ID] == 1)
{
format(string,sizeof(string),"%s(%d) is frozen by a Server Administrator. You cannot search them.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
SendClientMessage(ID,COLOR_DEADCONNECT,"[[_SEARCHED_]]");
format(string,sizeof(string),"Law Enforcement Officer %s(%d) has started to search you, better hope you are not carrying anything ilegal!",PlayerName(playerid),playerid);
SendClientMessage(ID,COLOR_DODGERBLUE,string);
if(HasWeed[ID] >= 1 || HasHeroin[ID] >= 1)
{
if(HasWeed[ID] >= 1)
{
format(string,sizeof(string),"[POLICE ACTION] Officer %s(%d) has searched %s(%d) and found %d grams of weed on them.",PlayerName(playerid),playerid,PlayerName(ID),ID,HasWeed[ID]);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
IncreaseWantedLevel(ID,4);
}
if(HasHeroin[ID] >= 1)
{
format(string,sizeof(string),"[POLICE ACTION] Officer %s(%d) has searched %s(%d) and found %d injections of heroin on them.",PlayerName(playerid),playerid,PlayerName(ID),ID,HasWeed[ID]);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
IncreaseWantedLevel(ID,4);
}
return 1;
}
format(string,sizeof(string),"[SEARCH] You have performed a search on %s(%d) but have found nothing ilegal.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_DODGERBLUE,string);
return 1;
}