dini help
#1

hello i need help to save this "pcash"

i have register system with dialog but i dont know where to put it in when they connect/register

is it under onplayerconnect or under ondialogresponse..?

ive got this under ondialogresponse the login dialog

pawn Код:
GivePlayerPCash(playerid, dini_Int(file, "PCash"));
here is onplayerdisconnect

http://pastebin.com/JCsXfEK3

please help me how to save it
Reply
#2

anyone?
Reply
#3

Show player dialog when he connects. And OnDialogResponse give him his cash.
Reply
#4

you mean the dialog under "onplayerconnect" ?
Reply
#5

Quote:
Originally Posted by xir
Посмотреть сообщение
you mean the dialog under "onplayerconnect" ?
Yup. Something like:
pawn Код:
public OnPlayerConnect(playerid)
{
    ShowPlayerDialog(playerid, ..................);
    return 1;
}
+

Your OnPlayerDisconnect code is kinda buggy.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(!fexist(file))// this shoud be like this.
    {//                 because it file doesn't exitst than you will create one.
          dini_Create(file);
    }
    dini_IntSet(file, "PCash", GetPlayerPCash(playerid));
    ResetPlayerPCash(playerid);
    return 1;
}
Reply
#6

http://pastebin.com/tt7kgmJp
Reply
#7

You don't need to always define player name and string if you define it once.
I fixed your code a little:

pawn Код:
public OnPlayerConnect(playerid)
{
    new name[MAX_PLAYER_NAME], file[128], string[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if (!dini_Exists(file))
    {
        format(string, sizeof(string), "The username %s is not in the datebase please register", name);
        SendClientMessage(playerid, White, string);
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Account", "Register account\n\nEnter password:", "Register", "Quit");
    }
    if(fexist(file))
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Account", "Login to your account\n\nEnter your password:", "Login", "Quit");
        format(string, sizeof(string), "The username %s is registered login to your account", name);
        SendClientMessage(playerid, Green, string);
    }
    return 1;
}
And now you need to code OnDialogResponse()
Reply
#8

oh ok, so the problem was the onplayerdisconnect? Or you need the ondialogrepsonse too?
Reply
#9

Give me your OnDialogResponse code.
Reply
#10

http://pastebin.com/DW8Fz73S

maybe some missing brackets but dont mind because i took it out of GM
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)