SA-MP Forums Archive
Get player banned reason - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Get player banned reason (/showthread.php?tid=352386)



Get player banned reason - MarinacMrcina - 19.06.2012

Hi,I'm making my server ban system and when a player is banned it succesfuly sets his ban reason in playername.txt

pawn Код:
BanReason=Speedhack
Now I want when a player connets that the ban reason is shown to him but i don't know how.

Thanks!


Re: Get player banned reason - Kindred - 19.06.2012

What file saving system are you using? (y_ini, dini, etcetra)


Re: Get player banned reason - MarinacMrcina - 19.06.2012

Yes I'm using dini.

I set the reason with sscanf and saved with dini
pawn Код:
dini_Set(file,"Reason",reason);



Re: Get player banned reason - Kindred - 19.06.2012

pawn Код:
dini_Int(file, "Reason");
Use that to get the reason.

For example...

pawn Код:
new name[MAX_PLAYER_NAME];
format(file,sizeof(file),"LOCATIONHERE/%s.ini", GetPlayerName(playerid, name, sizeof(name)));
if(dini_Exists(file))
{
    if(banvariablehere = 1) //or something
    {
        format(string, sizeof(string), "You are banned.  Reason: %s", dini_Int(file, "Reason"));
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    //Login dialog or whatever
}
Near the login dialog thing or something.

Never used dini, not sure if I did this correctly. Like I said, just an example.


Re: Get player banned reason - LaGrande - 19.06.2012

lol "Reason" is not an integer, u gotta use dini_Get


Re: Get player banned reason - MarinacMrcina - 19.06.2012

I did that like you said
pawn Код:
if(PlayerInfo[playerid][Baned] == 1)
    {
        new file[64];
        new string1[128];
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid,name,sizeof(name));
        format(file,sizeof(file),"/users/%s.txt",name);
        SendClientMessage(playerid,RED,"Your account is banned on this server!");
        format(string1,sizeof(string1),"Ban reason: %s", dini_Int(file, "Reason"));
        SendClientMessage(playerid,RED,string1);
    }
It only shows like this

pawn Код:
Ban reason:



Re: Get player banned reason - Vince - 19.06.2012

Quote:
Originally Posted by LaGrande
Посмотреть сообщение
lol "Reason" is not an integer, u gotta use dini_Get
That.


Re: Get player banned reason - MarinacMrcina - 19.06.2012

Yeah I'm blind,works fine now +rep for you all!


Re: Get player banned reason - MarinacMrcina - 19.06.2012

1 more question,how can I unban a player by his name when he is not online?


Re: Get player banned reason - TheArcher - 19.06.2012

Get the name from the file and if the variable is true (that is banned) unban him.