Ban Reason Not Appearing -
GoldZoroGrab - 25.03.2013
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
Re: Ban Reason Not Appearing -
Rock - 25.03.2013
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!
Re: Ban Reason Not Appearing -
GoldZoroGrab - 26.03.2013
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
Re: Ban Reason Not Appearing -
GoldZoroGrab - 26.03.2013
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
Re: Ban Reason Not Appearing -
GoldZoroGrab - 26.03.2013
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 ?
Re: Ban Reason Not Appearing -
GoldZoroGrab - 26.03.2013
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
Re: Ban Reason Not Appearing -
Riddick94 - 26.03.2013
pawn Код:
SInfo[player][BReason] = reason;
Isn't it gonna save only one letter?
Re: Ban Reason Not Appearing -
GoldZoroGrab - 26.03.2013
Quote:
Originally Posted by Riddick94
pawn Код:
SInfo[player][BReason] = reason;
Isn't it gonna save only one letter?
|
huh?
Re: Ban Reason Not Appearing -
GoldZoroGrab - 26.03.2013
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?
Re: Ban Reason Not Appearing -
TomatoRage - 26.03.2013
I can give you mine but its on dcmd