30.09.2015, 22:17
hi everyone i need hellp im trying to don that when a cop presse ALT <KEY_WALK> the player near of playerid get cuffed and when it pressed again he will be send to jail but it work only on ID:0
please help
please help
PHP код:
//cuff
public :confused:(playerid, newkeys, oldkeys)
{
new string[128];
if(newkeys == KEY_WALK)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(CommandsBlocked[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"[ERROR] Your commands are blocked, You cannot use commands.");
return 1;
}
if(InDuel[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You cannot use commands while on duel, Use /leave to exit the duel.");
return 1;
}
if(pInfo[playerid][Spawned] != 1)
{
SendClientMessage(playerid,COLOR_ERROR,"[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,"[ERROR] You are kidnapped. You cannot use this command.");
return 1;
}
if(IsFrozen[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You have been frozen by a Server Administrator. You cannot use this command.");
return 1;
}
if(AccInfo[i][OnDuty] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You cannot use this command on this player because they are in Administrator mode.");
return 1;
}
if(gTeam[playerid] != COP && gTeam[playerid] != ARMY && gTeam[playerid] != CIA && gTeam[playerid] != FBI)
{
return 1;
}
if(i == playerid)
{
return 1;
}
if(GetDistanceBetweenPlayers(playerid,i) > 4)
{
format(string,sizeof(string),"[ERROR] %s[%d] is too far away. You cannot reach him to place cuffs on him.",GetName(i),i);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetPlayerWantedLevel(i) == 0)
{
format(string,sizeof(string),"[ERROR] %s[%d] is innocent. use /cuff to place cuffs on him.",GetName(i),i);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(gTeam[i] == COP || gTeam[i] == ARMY || gTeam[i] == CIA || gTeam[i] == FBI)
{
SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You cannot cuff other Law Enforcement officers. You might lose your job for that ...");
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You cannot place a suspect in cuffs while in a vehicle. Exit the vehicle first.");
return 1;
}
if(GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You cannot place a suspect in cuffs while they are in a vehicle. Get them to exit the vehicle first.");
return 1;
}
if(pInfo[i][Spawned] != 1)
{
format(string,sizeof(string),"[ERROR] %s(%d) is not spawned. You cannot place cuffs on dead people ..",GetName(i),i);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsFrozen[i] == 1)
{
format(string,sizeof(string),"[ERROR] %s(%d) is frozen by a Server Administrator. You cannot place cuffs them.",GetName(i),i);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsCuffed[i] == 1 && cuff_arrest_time[i] != 0) return 1;
if(IsCuffed[i] == 1 && cuff_arrest_time[i] == 0)
{
ARREST(playerid,i);
}
CUFF(playerid,i);
}
}
return 1;
}