SA-MP Forums Archive
dini help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: dini help (/showthread.php?tid=221328)



dini help - xir - 05.02.2011

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


Re: dini help - xir - 05.02.2011

anyone?


Re: dini help - xRyder - 05.02.2011

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


Re: dini help - xir - 05.02.2011

you mean the dialog under "onplayerconnect" ?


Re: dini help - xRyder - 05.02.2011

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;
}



Re: dini help - xir - 05.02.2011

http://pastebin.com/tt7kgmJp


Re: dini help - xRyder - 05.02.2011

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()


Re: dini help - xir - 05.02.2011

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


Re: dini help - xRyder - 05.02.2011

Give me your OnDialogResponse code.


Re: dini help - xir - 05.02.2011

http://pastebin.com/DW8Fz73S

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