OnPlayerKeyStateChange ID0 problem
#1

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

PHP код:
//cuff
public :confused:(playeridnewkeysoldkeys)
{
    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(
== 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] == && cuff_arrest_time[i] != 0) return 1;
            
            if(
IsCuffed[i] == && cuff_arrest_time[i] == 0)
            {
                    
ARREST(playerid,i);
            }
            
CUFF(playerid,i);
            
        }
    }
    return 
1;

Reply


Messages In This Thread
OnPlayerKeyStateChange ID0 problem - by ayoub001 - 30.09.2015, 22:17
Re: OnPlayerKeyStateChange ID0 problem - by jihadmeneer - 01.10.2015, 08:48
Re : Re: OnPlayerKeyStateChange ID0 problem - by ayoub001 - 01.10.2015, 12:35
Re: OnPlayerKeyStateChange ID0 problem - by jlalt - 01.10.2015, 13:00
Re: OnPlayerKeyStateChange ID0 problem - by Pottus - 01.10.2015, 13:07
AW: Re: OnPlayerKeyStateChange ID0 problem - by Kaliber - 01.10.2015, 13:16
Re: OnPlayerKeyStateChange ID0 problem - by Pottus - 01.10.2015, 13:58
Re: AW: Re: OnPlayerKeyStateChange ID0 problem - by ayoub001 - 01.10.2015, 15:14
Re: OnPlayerKeyStateChange ID0 problem - by Mowgli - 01.10.2015, 15:19
AW: Re: OnPlayerKeyStateChange ID0 problem - by Kaliber - 01.10.2015, 18:10

Forum Jump:


Users browsing this thread: 1 Guest(s)