cuff command crashes player
#1

When a law enforcement officer cuffs a civilian, the civilian crashes

Please help

I have tried to fix it for a long time, but just wont work

PHP код:
CMD:cuff(playerid,params[])
{
    new 
string[128];
    if(
sscanf(params"u"ID))
    {
        
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /cuff (Player Name/ID)");
        return 
1;
    }
    if(
gTeam[playerid] != POLICE && gTeam[playerid] != ARMY && gTeam[playerid] != SWAT)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can place cuffs on suspects.");
        return 
1;
    }
    if(!
IsPlayerConnected(ID))
    {
        
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot cuff 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 place cuffs on him.",GetName(ID),ID);
        
SendClientMessage(playerid,COLOR_ERROR,string);
        return 
1;
    }
    if(
gTeam[ID] == POLICE || gTeam[ID] == ARMY || gTeam[ID] == SWAT)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You cannot place other Law Enforcement officer in cuffs.");
        return 
1;
    }
    if(
IsCuffed[ID] == 1)
    {
        
format(string,sizeof(string),"%s(%d) is already cuffed. You don't want to waste a second pair of cuffs on them.",GetName(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 place a suspect in cuffs 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 place a suspect in cuffs while they are in a vehicle. Get them to exit the vehicle first.");
        return 
1;
    }
    if(
playerid == ID)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You cannot put cuffs on yourself.");
        return 
1;
    }
    new 
crand random(100);
    if(
GetDistanceBetweenPlayers(playerid,ID) <= && crand 30)
    {
        
SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Suspect Cuffed_]]");
        
format(string,sizeof(string),"You have placed cuffs on %s(%d)! They can no longer move.",GetName(ID),ID);
        
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        
SendClientMessage(ID,COLOR_DEADCONNECT,"[[_Placed in handcuffs_]]");
        
format(string,sizeof(string),"Law enforcement officer %s(%d) has placed you in handcuffs! You cannot move! You will be auto uncuffed in 30 seconds.",GetName(playerid),playerid);
        
SendClientMessage(ID,COLOR_LIGHTBLUE,string);
        
TogglePlayerControllable(ID,0);
        
LoopingAnim(ID"SPECIAL_ACTION_CUFFED""cower"3.010000); // Taking Cover
        
IsCuffed[ID] =1;
        
CuffTime[ID] =30;
        return 
1;
    }
    return 
1;

Reply
#2

Quote:
Originally Posted by BossZk
Посмотреть сообщение
When a law enforcement officer cuffs a civilian, the civilian crashes

Please help

I have tried to fix it for a long time, but just wont work

PHP код:
CMD:cuff(playerid,params[])
{
    new 
string[128];
    if(
sscanf(params"u"ID))
    {
        
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /cuff (Player Name/ID)");
        return 
1;
    }
    if(
gTeam[playerid] != POLICE && gTeam[playerid] != ARMY && gTeam[playerid] != SWAT)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can place cuffs on suspects.");
        return 
1;
    }
    if(!
IsPlayerConnected(ID))
    {
        
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot cuff 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 place cuffs on him.",GetName(ID),ID);
        
SendClientMessage(playerid,COLOR_ERROR,string);
        return 
1;
    }
    if(
gTeam[ID] == POLICE || gTeam[ID] == ARMY || gTeam[ID] == SWAT)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You cannot place other Law Enforcement officer in cuffs.");
        return 
1;
    }
    if(
IsCuffed[ID] == 1)
    {
        
format(string,sizeof(string),"%s(%d) is already cuffed. You don't want to waste a second pair of cuffs on them.",GetName(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 place a suspect in cuffs 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 place a suspect in cuffs while they are in a vehicle. Get them to exit the vehicle first.");
        return 
1;
    }
    if(
playerid == ID)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You cannot put cuffs on yourself.");
        return 
1;
    }
    new 
crand random(100);
    if(
GetDistanceBetweenPlayers(playerid,ID) <= && crand 30)
    {
        
SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Suspect Cuffed_]]");
        
format(string,sizeof(string),"You have placed cuffs on %s(%d)! They can no longer move.",GetName(ID),ID);
        
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        
SendClientMessage(ID,COLOR_DEADCONNECT,"[[_Placed in handcuffs_]]");
        
format(string,sizeof(string),"Law enforcement officer %s(%d) has placed you in handcuffs! You cannot move! You will be auto uncuffed in 30 seconds.",GetName(playerid),playerid);
        
SendClientMessage(ID,COLOR_LIGHTBLUE,string);
        
TogglePlayerControllable(ID,0);
        
LoopingAnim(ID"SPECIAL_ACTION_CUFFED""cower"3.010000); // Taking Cover
        
IsCuffed[ID] =1;
        
CuffTime[ID] =30;
        return 
1;
    }
    return 
1;

Try use the crashdetect plugin and post what it says
Reply
#3

pawn Код:
SetPlayerSpecialAction(ID,SPECIAL_ACTION_CUFFED);
Reply
#4

LoopingAnim(ID, "SPECIAL_ACTION_CUFFED", "cower", 3.0, 1, 0, 0, 0, 0); // Taking Cover

Invalid libraries crash the player.
Reply
#5

so stupid of me-.- thankssss for the help guys appreciate it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)