06.07.2014, 01:52
(
Последний раз редактировалось UserName31; 06.07.2014 в 02:32.
)
Dini Saving Money Issued
it Wont load cash or save -_-
hello i am working on a gamemode that used to have Pvar saving and loading, i dint like the pvar just cause it wouldnt save when disconnect so now i decided to change it to dini, i made some variable for example HasCondom that will save but the money wont save i have completely updated my dini and the plugins to latest the pwno is converting the files with out n errors here is part of my codes
the variables
login and register sysytem
on dialog respond to DIALOG_REGISTER AND DIALOG_LOGIN
OnPlayerDisconnect
i tryed looking result but nun worked
oh and incase here are my includes
my server.cfg
it Wont load cash or save -_-
hello i am working on a gamemode that used to have Pvar saving and loading, i dint like the pvar just cause it wouldnt save when disconnect so now i decided to change it to dini, i made some variable for example HasCondom that will save but the money wont save i have completely updated my dini and the plugins to latest the pwno is converting the files with out n errors here is part of my codes
the variables
PHP код:
enum pInfo
{
pPass,
pHasCondom,
pPackCondom,
pCash,
Spawned,
}
new AccountInfo[MAX_PLAYERS][pInfo];
PHP код:
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), scriptfiles, name);
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{9ACD32}ILSR - Register{FFFFFF}", "You have joined under a non registered account\nPlease make sure that all mods are turned off\nPlease enter your password below:\n\n(NOTE: Enter the password you will remember)", "Register", "Quit");
}
if(fexist(file))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "{9ACD32}ILSRP - Login{FFFFFF}", "{FFFFFF}You have rejoined under a registered account\nPlease make sure that all mods are turned off\nPlease enter your password below:\n\n(NOTE: Entering a wrong password, gets you IP blocked){FFFFFF}", "Login", "Quit");
}
PHP код:
new string[200];
if (dialogid == DIALOG_LOGIN)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), scriptfiles, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Welcome back!", "Welcome back to ILSRP!\n\nType in your password below to login", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Welcome back!", "Welcome back to ILSRP!\n\nType in your password below to login", "Login", "Leave");
}
else
{
SetTimerEx("SkipSpawn",3,0,"i",playerid);//It's required to have atleast 1 millisecond
TogglePlayerSpectating(playerid, 0);
gPlayerLogged[playerid] = 1;
AccountInfo[playerid][pHasCondom] = dini_Int(file, "HasCondom");
AccountInfo[playerid][pPackCondom] = dini_Int(file, "PackCondom");
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
AccountInfo[playerid][pCash] = dini_Int(file, "Money");
}
}
if (dialogid == DIALOG_REGISTER)
{
SetTimerEx("SkipSpawn",3,0,"i",playerid);//It's required to have atleast 1 millisecond
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), scriptfiles, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{9ACD32}ILSRP - Register{FFFFFF}", "{FFFFFF}You have joined under a non registered account\nPlease make sure that all mods are turned off\nPlease enter your password below:\n\n(NOTE: Enter the password you will remember){FFFFFF}", "Register", "Quit");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "HasCondom",AccountInfo[playerid][pHasCondom] = 0);
dini_IntSet(file, "PackCondom",AccountInfo[playerid][pPackCondom] = 0);
dini_IntSet(file, "Money",AccountInfo[playerid][pCash] = 1500);
gPlayerLogged[playerid] = 1;
}//End of Register Dialog*/
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), scriptfiles, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "HasCondom", AccountInfo[playerid][pPackCondom]);
dini_IntSet(file, "PackCondom",AccountInfo[playerid][pPackCondom]);
dini_IntSet(file, "Money", AccountInfo[playerid][pCash]);
}
for(new i = 0; i < sizeof(Objects); i++) ////Xobj
{
if(Player[playerid][view][i])
{
Player[playerid][view][i] = false;
DestroyPlayerObject(playerid,Player[playerid][objid][i]);
}
}
new string[200];
PLAYERLIST_authed[playerid]=false;
switch(reason)
{
case 0: format(string, 200, "%s has left the server. (Timeout)", PlayerInfo(playerid));
case 1: format(string, 200, "%s has left the server. (Left)", PlayerInfo(playerid));
case 2: format(string, 200, "%s has left the server. (Kicked)", PlayerInfo(playerid));
}
SendClientMessageToAll(COLOR_DEADCONNECT, string);
playerCheckpoint[playerid] =0;
gPlayerLogged[playerid] = 0;
RemoveVariables(playerid);
return 1;
}
oh and incase here are my includes
PHP код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <dudb>
#include <gvar>
#include <time>
#include <dprops>
#include <utils>
#include <dini>
PHP код:
echo Executing Server Config...
lanmode 0
rcon_password 87232
maxplayers 160
port 7780
hostname *Iron* Los Santos RolePlay[Under-Manufacturer!]
gamemode0 1.2
filterscripts
announce 0
query 1
chatlogging 0
weburl www.sanloscnr.forumotion.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 0
logtimeformat [%H:%M:%S]
plugins sscanf gvar streamer Whirlpool