/unban Command unknown
#1

Hello. When I'm using the command on unknown player from the files it says invalid playername. however when im using the command on the actual real name which exists the server gives error. unknown command.

here is the crash output code:
pawn Код:
[debug] Run time error 6: "Invalid instruction"
[debug]  Unknown opcode 0x8209 at address 0x0000006F
[debug] AMX backtrace:
[debug] #0 0000006f in public cmd_unban () from LG-RP.amx
[debug] #1 native CallLocalFunction () [00472e50] from samp-server.exe
[debug] #2 0000646c in public OnPlayerCommandText (0x00000000, 0x0227979c) from LG-RP.amx
here is the command:
pawn Код:
CMD:unban(playerid, params[])
{
    new playerb, string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");

    if(sscanf(params, "s[32]", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /unban [name]");
    if(!fexist(UserDB(playerb))) return SendClientMessage(playerid, COLOR_GREY, "Invalid player name.");
    new INI:File = INI_Open(UserDB(playerb));
    INI_SetTag(File,"PlayerData");
    INI_WriteString(File, "BanReason", "None");
    INI_WriteString(File, "BannedBy", "None");
    INI_WriteInt(File, "Banned", 0);
    INI_Close(File);
    format(string, sizeof(string), "AdmWarn: %s has unbanned %s.", RPN(playerid), params);
    SendAdminMessage(COLOR_DARKRED, 1, string);
    format(string, sizeof(string), "AdmWarn: %s (%s) has unbanned %s (%s).", RPN(playerid), RPIP(playerid), params);
    return 1;
}
[NOTE]: In linux system this code crashes the server..
What is wrong? Anybody can tell me please?
Reply
#2

Quote:
Originally Posted by maximthepain
Посмотреть сообщение
Hello. When I'm using the command on unknown player from the files it says invalid playername. however when im using the command on the actual real name which exists the server gives error. unknown command.

here is the crash output code:
pawn Код:
[debug] Run time error 6: "Invalid instruction"
[debug]  Unknown opcode 0x8209 at address 0x0000006F
[debug] AMX backtrace:
[debug] #0 0000006f in public cmd_unban () from LG-RP.amx
[debug] #1 native CallLocalFunction () [00472e50] from samp-server.exe
[debug] #2 0000646c in public OnPlayerCommandText (0x00000000, 0x0227979c) from LG-RP.amx
here is the command:
pawn Код:
CMD:unban(playerid, params[])
{
    new playerb, string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");

    if(sscanf(params, "s[32]", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /unban [name]");
    if(!fexist(UserDB(playerb))) return SendClientMessage(playerid, COLOR_GREY, "Invalid player name.");
    new INI:File = INI_Open(UserDB(playerb));
    INI_SetTag(File,"PlayerData");
    INI_WriteString(File, "BanReason", "None");
    INI_WriteString(File, "BannedBy", "None");
    INI_WriteInt(File, "Banned", 0);
    INI_Close(File);
    format(string, sizeof(string), "AdmWarn: %s has unbanned %s.", RPN(playerid), params);
    SendAdminMessage(COLOR_DARKRED, 1, string);
    format(string, sizeof(string), "AdmWarn: %s (%s) has unbanned %s (%s).", RPN(playerid), RPIP(playerid), params);
    return 1;
}
[NOTE]: In linux system this code crashes the server..
What is wrong? Anybody can tell me please?
paste the RPN function.
Reply
#3

Quote:
Originally Posted by driftpower
Посмотреть сообщение
paste the RPN function.
pawn Код:
stock RPN(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}
For example im using /uban Leonardo_James... it says "unknown command".
Reply
#4

/uban or /unban? :P (kidding)

pawn Код:
CMD:unban(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    new playerb[MAX_PLAYER_NAME];
    if(sscanf(params, "s[24]", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /unban [name]");
    if(!fexist(UserDB(playerb))) return SendClientMessage(playerid, COLOR_GREY, "Invalid player name.");
    new INI:File = INI_Open(UserDB(playerb));
    INI_SetTag(File, "PlayerData");
    INI_WriteString(File, "BanReason", "None");
    INI_WriteString(File, "BannedBy", "None");
    INI_WriteInt(File, "Banned", 0);
    INI_Close(File);
    new string[100];
    format(string, sizeof(string), "AdmWarn: %s has unbanned %s.", RPN(playerid), playerb);
    SendAdminMessage(COLOR_DARKRED, 1, string);
    format(string, sizeof(string), "AdmWarn: %s (%s) has unbanned %s.", RPN(playerid), RPIP(playerid), playerb);
    //Nothing being done with the second string?
    return 1;
}
You were introducing 'playerb' as an integer when it should have been a string.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)