Ban Reason Not Appearing
#1

Hey guys...

when an admin bans a player (including writing the reason) when the players relog it tells him you are banned etc.... reason: (not written)

check

pawn Код:
command(ban, playerid, params[])
{
    if(sscanf(params, "is[128]", player, reason)) return SendClientMessage(playerid, ROJOO,"USAGE: /ban [id] [reason]");
    {
        SInfo[player][BReason] = reason;
        kick(player);
    }
    return 1;
}
pawn Код:
enum PlayerInfo
{
    BReason[128]
}
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    new str2[128];
    INI_String("BanReason",str2,128);
    SInfo[playerid][BReason]=str2;
    return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
    if(SInfo[playerid][Banned] == 1)
    {
        new string[254];
        format(string, sizeof(string), "You Are Banned From The Server (Reason: %s)", SInfo[playerid][BReason]);
        SendClientMessage(playerid, COLOR_RED, string);
    }
    return 1;
}
NOTE: It tells me "You Are Banned From The Server (Reason: )" when i'm banned without writing the reason -_-

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteString(File,"Reason",SInfo[playerid][BReason]);
    INI_Close(File);
    return 1;
}
WHAT IS THE PROBLEM? WHY IT ISN'T WRITING THE REASON WHEN PLAYER CONNECTS AND HE IS BANNED??
NOTE: the reason is written in the scriptfile (player STats)

when player is banned and enter game and for ex the ban reason is Hack it
says :
You Are Banned From The Server (Reason: )
it didn't write reason: Hack
Reply
#2

pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    new str2[128];
    INI_String("Reason",str2,128);
    SInfo[playerid][BReason]=str2;
    return 1;
}
In INI_String you had BanReason but in INI_WriteString had just Reason, the must be the same!
Reply
#3

Quote:
Originally Posted by Rockk
Посмотреть сообщение
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    new str2[128];
    INI_String("Reason",str2,128);
    SInfo[playerid][BReason]=str2;
    return 1;
}
In INI_String you had BanReason but in INI_WriteString had just Reason, the must be the same!
huh? what do you mean? what should i change now? give me the code with it's change
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
"INI_String" actually hides a "return", you need to save to the global directly. I am very aware that this is quite bad design, but other designs are actually worse - your way would blank out the string if there was a second entry in the INI.
bro will you re-write for me what is wrong with the fixed one?
i mean cop my code that i wrote with the correction
so i know my mistake
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Just do:

pawn Код:
INI_String("Reason", SInfo[playerid][BReason], 128);
I don't know why you introduced that second variable in the first place.
OnPlayerDissconnect ?
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
What, no, where you had it before - don't move it!
huh? man i understand nothing now LoL

tell me what i change exactly and from wich place
please be specific
Reply
#7

pawn Код:
SInfo[player][BReason] = reason;
Isn't it gonna save only one letter?
Reply
#8

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
pawn Код:
SInfo[player][BReason] = reason;
Isn't it gonna save only one letter?
huh?
Reply
#9

Quote:
Originally Posted by ******
Посмотреть сообщение
You need to change just ONE thing and I told you EXACTLY what to change it too - how are you confused?
bro, will you give me the wrong code in my script and give me the correction?
Reply
#10

I can give you mine but its on dcmd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)