Ban system- help.
#1

I'm tring to make my own system.
I made when the player connect this
pawn Код:
if(pInfo[playerid][Banned] == 1)
    {
        SendClientMessage(playerid,RED,"You're banned from this server, You can't join.");
        format(Jstring,sizeof(Jstring),"You're banned for reason: (%s).",pInfo[playerid][Breason]);
        SendClientMessage(playerid,RED,Jstring);
        SetTimerEx("ban2",1,0,"i",playerid);
    }
I made the public kick by the way.
but any time and in the player's value == 1
it doesn't work, and it shows the login dialog.
Reply
#2

Any ideas?
Reply
#3

ShowPlayerDialog(playerid, -1, DIALOG_STYLE_MSGBOX, "", "", "", "");

Add that before the timer, and see if it works
Reply
#4

Lemme add some thing, when i open the server and ban myself then i restart the game, it works. But when i restart the server it dont work.
Extra information, in my code i put the iniopen thing to be perm and to open it from the scripts files. If you want i will upload the code tomorrow
Reply
#5

If you're restarting the server, and it don't work, that could be a saving/loading issue.
Reply
#6

I will show the code to you tomorrow.
Reply
#7

pawn Код:
INI_Int("Banned",pInfo[playerid][Banned]);
    INI_String("Breason",pInfo[playerid][Breason],300);
Under my load stock.
Reply
#8

Quote:
Originally Posted by ZToPMaN
Посмотреть сообщение
pawn Код:
INI_Int("Banned",pInfo[playerid][Banned]);
    INI_String("Breason",pInfo[playerid][Breason],300);
Under my load stock.
Show us the save function. Also show us the line where you get the user file.
Reply
#9

COMMAND:
pawn Код:
CMD:ban(playerid,params[])
{
    if(pInfo[playerid][Admin] >= 3)
    {
        if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, RED,"Usage: /ban [id] [reason]");
       
        new INI:ban1 = INI_Open(Path(id));
        INI_SetTag(ban1, "Player's Data");
        INI_WriteInt(ban1, "Banned", 1);
        INI_WriteString(ban1, "Breason",reason);
        INI_Close(ban1);
        pInfo[id][Banned] = 1;
    }
    return 1;
}
Load stock:
pawn Код:
forward loadaccount_user(playerid, name[], value[]);
public loadaccount_user(playerid, name[], value[])
{
    INI_String("Password", pInfo[playerid][Pass],129);
    INI_Int("Money",pInfo[playerid][Money]);
    INI_Int("Scores",pInfo[playerid][Scores]);
    INI_Int("Kills",pInfo[playerid][Kills]);
    INI_Int("Deaths",pInfo[playerid][Deaths]);
    INI_Int("AdminLvl",pInfo[playerid][Admin]);
    INI_Int("Banned",pInfo[playerid][Banned]);
    INI_String("Breason",pInfo[playerid][Breason],300);
    return 1;
}
under on player dis
INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
INI_WriteString(file,"Breason",pInfo[playerid][Breason]);
any thing else?
Reply
#10

I suck at Y_Ini but try this
pawn Код:
forward loadaccount_user(playerid, name[], value[]);
public loadaccount_user(playerid, name[], value[])
{
    new INI:file = INI_Open(Path(id));
    if(file == INI_NO_FILE) print("playerfile not accessible");
    format(pInfo[playerid][Pass], 129, "%s", INI_String(file, "Password"));
    format(pInfo[playerid][Breason], 300, "%s", INI_String(file, "Breason"));
    pInfo[playerid][Money] = INI_Int(file, "Money");
    pInfo[playerid][Scores] = INI_Int(file, "Scores",);
    pInfo[playerid][Kills] = INI_Int(file, "Kills",);
    pInfo[playerid][Deaths] = INI_Int(file, "Deaths",);
    pInfo[playerid][Admin] = INI_Int(file, "AdminLvl",);
    pInfo[playerid][Banned] = INI_Int(file, "Banned",);
    return 1;
}
What Y_INI version do you use?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)