08.06.2017, 22:14
(
Последний раз редактировалось Zmith; 09.06.2017 в 10:37.
)
I was updating my pawno\include folder and deleted all the includes (there was a ton of includes I didn't believe were required) and started fresh with the updated includes.
(!)My gamemode finally complied and all seemed well. However, player data is now failing to save and I've tried fixing it myself but I can't find the problem. I'm assuming I am missing an essential include which I cannot recover :/
My includes: http://i.imgur.com/jJuxu7n.png
My plugins: http://i.imgur.com/68SOYU2.png
Also; the .ini file(s) update after changes ingame (admin, kills etc) but gmx and reconnecting they all will reset.
Any suggestions/solutions?
(!)My gamemode finally complied and all seemed well. However, player data is now failing to save and I've tried fixing it myself but I can't find the problem. I'm assuming I am missing an essential include which I cannot recover :/
My includes: http://i.imgur.com/jJuxu7n.png
My plugins: http://i.imgur.com/68SOYU2.png
PHP код:
#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf2>
#include "../include/gl_common.inc"
PHP код:
enum PlayerInfo
{
Pass[129],
Adminlevel,
Premlevel,
CharSkin,
CharMoney,
CharScore,
CharKills,
CharDeaths,
IsJailed,
}
PHP код:
forward loadaccount_user(playerid, name[], value[]);
public loadaccount_user(playerid, name[], value[])
{
printf("%s -> %s", name, value);
INI_String("Password", pInfo[playerid][Pass], 129);
INI_Int("Adminlevel" ,pInfo[playerid][Adminlevel]);
INI_Int("Premlevel", pInfo[playerid][Premlevel]);
INI_Int("CharSkin", pInfo[playerid][CharSkin]);
INI_Int("CharMoney", pInfo[playerid][CharMoney]);
INI_Int("CharScore", pInfo[playerid][CharScore]);
INI_Int("CharKills", pInfo[playerid][CharKills]);
INI_Int("CharDeaths", pInfo[playerid][CharDeaths]);
INI_Int("IsJailed", pInfo[playerid][IsJailed]);
return 1;
}
PHP код:
public OnPlayerConnect(playerid)
{
format(string2, sizeof(string2), "{A9C4E4}# [Server] %s {EAEAEA}has connected to the server.", GetName(playerid));
SendClientMessageToAll(COLOR_SERVER ,string2);
SetTimerEx("ClearScreen", 1, false, "i", playerid);
new string1[300]; new registerid; new loginid; new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
format(string1, sizeof(string1), "{EAEAEA}Enter your password below to login!", GetName(loginid), loginid);
ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "{A9C4E4}Server {EAEAEA}- Login:", string1, "Login", "Quit");
}
else
{
format(string, sizeof(string), "{EAEAEA}Enter a password below to register!", GetName(registerid), registerid);
ShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_PASSWORD, "{A9C4E4}Server {EAEAEA}- Register:", string, "Register", "Quit");
return 1;
}
PHP код:
stock save(playerid)
{
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file, "Character");
INI_WriteInt(file, "Adminlevel", pInfo[playerid][Adminlevel]);
INI_WriteInt(file, "Premlevel", pInfo[playerid][Premlevel]);
INI_WriteInt(file, "CharSkin", pInfo[playerid][CharSkin]);
INI_WriteInt(file, "CharMoney", GetPlayerMoney(playerid));
INI_WriteInt(file, "CharScore", GetPlayerScore(playerid));
INI_WriteInt(file, "CharKills", pInfo[playerid][CharKills]);
INI_WriteInt(file, "CharDeaths", pInfo[playerid][CharDeaths]);
INI_WriteInt(file, "IsJailed", pInfo[playerid][IsJailed]);
INI_Close(file);
return 1;
}
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == REGISTER_DIALOG)
{
if(!response)return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
new string[300];
new registerid;
format(string, sizeof(string), "{EAEAEA}Hello, {A9C4E4}%s{EAEAEA}.\n\nPlease enter a password below.", GetName(registerid));
ShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_PASSWORD, "{A9C4E4}Server {EAEAEA}- Register:", string, "Register", "Quit");
return 1;
}
new hashpass[129];
WP_Hash(hashpass, sizeof(hashpass), inputtext);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file, "Character");
INI_WriteString(file, "Password", hashpass);
INI_WriteInt(file, "Adminlevel", 0);
INI_WriteInt(file, "Premlevel", 0);
INI_WriteInt(file, "CharSkin", 60);
INI_WriteInt(file, "CharMoney", 15000);
INI_WriteInt(file, "CharScore", 1);
INI_WriteInt(file, "CharKills", 1);
INI_WriteInt(file, "CharDeaths", 1);
INI_WriteInt(file, "IsJailed", 0);
INI_Close(file);
new rstring[200];
new registerid;
format(rstring, sizeof(rstring), "{A9C4E4}Server {EAEAEA}- You have successfully registered, {A9C4E4}%s{EAEAEA}!", GetName(registerid));
SendClientMessage(playerid, COLOR_SERVER, "Reminder: {EAEAEA}The server is currently underdevelopment - You might experience bugs");
SendClientMessage(playerid, COLOR_GREEN, rstring);
muted[playerid] = 0;
return 1;
}
}
if(dialogid == LOGIN_DIALOG)
{
if(!response)return Kick(playerid);
if(response)
{
new hashpass[129];
WP_Hash(hashpass, sizeof(hashpass), inputtext);
if(!strcmp(hashpass, pInfo[playerid][Pass]))
{
new loginid = playerid;
new lstring[300];
INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
SetPlayerScore(playerid, pInfo[playerid][CharScore]);
GivePlayerMoney(playerid, pInfo[playerid][CharMoney]);
format(lstring, sizeof(lstring), "{EAEAEA}Welcome Back, {A9C4E4}%s{EAEAEA}. {EAEAEA}You have successfully logged in!", GetName(loginid));
SendClientMessage(playerid, COLOR_SERVER, "Reminder: {EAEAEA}The server is currently underdevelopment - You might experience bugs");
SendClientMessage(playerid, COLOR_GREEN, lstring);
muted[playerid] = 0;
}
else
{
new string1[300];
format(string1, sizeof(string1), "{EAEAEA}Enter your password below to login!", GetName(playerid), playerid);
ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "{A9C4E4}Server - {EAEAEA}Login:", string1, "Login", "Quit");
SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: Wrong Password!");
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
Any suggestions/solutions?