command crashes server
#1

help>?

pawn Код:
CMD:cuff(playerid, params[])
{
    new id, Float:x, Float:y, Float:z,Float:angle, idname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF00AAFF, "*USAGE: /cuff [playerid / part of name]");
    else if(gTeam[playerid] != TEAM_COPS) return SendClientMessage(playerid, 0xFF00AAFF, "*ERROR: You are not a Police Officer!");
    else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF00AAFF, "*ERROR: Player is not connected,Invalid playerid Or Is Yourself!");
    else if(IsPlayerInRangeOfPoint(id, 10, x, y, z)) return SendClientMessage(playerid, COLOR_GREY, "Player is not close enough!");
    else
    {
        GetPlayerName(playerid, name, sizeof(name));
        GetPlayerName(id, idname, sizeof(idname));
        GetPlayerPos(id,x,y,z);
        GetPlayerFacingAngle(id, angle);

        TogglePlayerControllable(id,false);
        SendClientMessage(playerid, COLOR_GREY, "You Have Cuffed Citizen %s(%d)!");
        SendClientMessage(id, COLOR_GREY, "You've Been Cuffed By Officer %s(%d)!");
        SetPlayerPos(playerid,x+0.5,y,z);
        SetPlayerFacingAngle(playerid, angle);
        OnePlayAnim(playerid, "PYTHON", "python_crouchreload", 2.0, 0, 0, 0, 0, 0);
        IsAnim[playerid] = 1;
    }
    return 1;
}

CMD:uncuff(playerid, params[])
{
    new id, Float:x, Float:y, Float:z, idname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF00AAFF, "*USAGE: /uncuff [playerid / part of name]");
    else if(gTeam[playerid] != TEAM_COPS) return SendClientMessage(playerid, 0xFF00AAFF, "*ERROR: You are not a Police Officer!");
    else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF00AAFF, "*ERROR: Player is not connected,Invalid playerid Or Is Yourself!");
    else if(IsPlayerInRangeOfPoint(id, 100, x, y, z)) return SendClientMessage(playerid, COLOR_GREY, "Player is not close enough!");
    else
    {
        GetPlayerName(playerid, name, sizeof(name));
        GetPlayerName(id, idname, sizeof(idname));

        TogglePlayerControllable(id,true);
        SendClientMessage(playerid, COLOR_GREY, "You Have Cuffed Citizen %s(%d)!");
        SendClientMessage(id, COLOR_GREY, "You've Been Cuffed By Officer %s(%d)!");
        IsAnim[playerid] = 0;
    }
    return 1;
}
Reply
#2

Which of those 2 commands crash the server?
Reply
#3

well i cant test the uncuff but the cuff crashes idk about the uncuff
Reply
#4

Dont know if it can cause a crash, but those lines wont work as you want them to:

pawn Код:
SendClientMessage(playerid, COLOR_GREY, "You Have Cuffed Citizen %s(%d)!");
        SendClientMessage(id, COLOR_GREY, "You've Been Cuffed By Officer %s(%d)!");
the %s and %d have to be replaced first, using format, maybe samp cant handle them in an unformated message.

pawn Код:
new text[64];
format(text, 64, "You Have Cuffed Citizen %s(%d)!", idname, id);
SendClientMessage(playerid, COLOR_GREY, text);
format(text, 64, "You've Been Cuffed By Officer %s(%d)!", name, playerid);
SendClientMessage(id, COLOR_GREY, text);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)