24.09.2012, 06:26
(
Последний раз редактировалось clarencecuzz; 24.09.2012 в 07:10.
)
Recently I have run some tests on my server and found that none of my INI_ParseFile functions are working. I have just made a quick housing system which is not yet finished, but after I create my house, I try to load it under OnGameModeInit but I tried debugging it by adding print lines, however those do not show up.
Under OnGameModeInit()
Here's the function that's not working:
It should be saying 'House ID... Name loaded.'
This is what it currently says:
Also, my user stats will not load, and I'm not sure why. Once again, the INI_ParseFile function is failing.
Function:
Login and register dialogs:
Any help with this is appreciated, like I said, everything EXCEPT the INI_ParseFile functions are working. All the correct files exist, all plugins and includes are updated and recompiled. I am only running one gamemode, no filterscripts. If you can help me solve this, I will definitely supply you with reputation points. Thanks in advance.
Regards,
clarencecuzz.
Under OnGameModeInit()
pawn Код:
for(new i = 0; i < MAX_HOUSES; i++)
{
new string[30];
format(string,sizeof(string),HOUSEPATH,i);
if(fexist(string))
{
print("File exists."); //Debug
INI_ParseFile(string, "LoadHouse_%s", .bExtra = true, .extra = i);
if(House[i][Owned] == 0)
{
House[i][Pickup] = CreateDynamicPickup(1272, 1, House[i][PosX], House[i][PosY], House[i][PosZ]);
print("Pickup Created"); //Debug
}
else
{
House[i][Pickup] = CreateDynamicPickup(1273, 1, House[i][PosX], House[i][PosY], House[i][PosZ]);
print("Pickup Created Owned"); //Debug
}
format(string,sizeof(string),"House: %s\nOwner: %s\nID: %d",House[i][Name],House[i][OwnerName],i);
House[i][Label] = CreateDynamic3DTextLabel(string, green, House[i][PosX], House[i][PosY], House[i][PosZ], 100.00);
print("Text label created"); //Debug
continue;
}
continue;
}
pawn Код:
forward LoadHouse_data(houseid,name[],value[]);
public LoadHouse_data(houseid,name[],value[])
{
INI_Int("HouseName",House[houseid][Name]);
printf("House id %d Name loaded", houseid); //Debug
INI_Float("X",House[houseid][PosX]);
INI_Float("Y",House[houseid][PosY]);
INI_Float("Z",House[houseid][PosZ]);
INI_Int("Owned",House[houseid][Owned]);
INI_Int("OwnerName",House[houseid][OwnerName]);
INI_Int("Key1",House[houseid][Key1]);
INI_Int("Key2",House[houseid][Key2]);
INI_Int("Key3",House[houseid][Key3]);
return 1;
}
This is what it currently says:
Код:
[23:30:53] Number of vehicle models: 0 [23:30:53] Text label created [23:30:53] Pickup Created [23:30:53] File exists. [23:30:53] Text label created [23:30:53] Pickup Created [23:30:53] File exists. [23:30:53] Text label created [23:30:53] Pickup Created [23:30:53] File exists. [23:30:53] Text label created [23:30:53] Pickup Created [23:30:53] File exists. [23:30:53] Text label created [23:30:53] Pickup Created [23:30:53] File exists. [23:30:53] Text label created [23:30:53] Pickup Created [23:30:53] File exists. [23:30:53] Loaded 0 filterscripts. [23:30:53] --------------- [23:30:53] Filterscripts [23:30:53] [23:30:53] [23:30:53] Loaded: samp.ban [23:30:53] -------- [23:30:53] Ban list [23:30:53] [23:30:53] Loaded 3 plugins. [23:30:53] Loaded. [23:30:53] [23:30:53] ================== [23:30:53] [23:30:53] Whirlpool loaded [23:30:53] [23:30:53] ================== [23:30:53] [23:30:53] Loading plugin: Whirlpool.so [23:30:53] Loaded. *** Streamer Plugin v2.6.1 by Incognito loaded *** [23:30:53] [23:30:53] Loading plugin: streamer.so [23:30:53] Loaded. [23:30:53] =============================== [23:30:53] 0.3d-R2 500 Players "dnee" [23:30:53] © 2009 Alex "******" Cole [23:30:53] sscanf plugin loaded. [23:30:53] =============================== [23:30:53] [23:30:53] Loading plugin: sscanf.so [23:30:53] -------------- [23:30:53] Server Plugins [23:30:53] v0.3e-R2, ©2005-2012 SA-MP Team ---------------------- SA-MP Dedicated Server ---------- Loaded log file: "server_log.txt". ----------
Function:
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",Player[playerid][Password]);
print("Password Loaded"); //Debug
INI_Int("Cash",Player[playerid][Cash]);
print("Cash Loaded"); //Debug
INI_Int("Admin",Player[playerid][Admin]);
print("Admin Loaded"); //Debug
INI_Int("Kills",Player[playerid][Kills]);
INI_Int("Deaths",Player[playerid][Deaths]);
INI_Int("VIP",Player[playerid][pVip]);
INI_Int("Score",Player[playerid][Score]);
INI_Int("Helper",Player[playerid][Helper]);
INI_Int("Builder",Player[playerid][Builder]);
INI_Int("Member",Player[playerid][Member]);
print("Member Loaded"); //Debug
INI_Int("BanReason",Player[playerid][BanReason]);
INI_Int("LastLogin",Player[playerid][LastLogin]);
INI_Int("Caged",Player[playerid][Caged]);
INI_Int("Muted",Player[playerid][Muted]);
INI_Int("Banned",Player[playerid][Banned]);
print("Ban Loaded"); //Debug
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case REGISTER:
{
if(!response)
{
new string[105];
SendClientMessage(playerid, red, "You Have Been Kicked From The Server. You MUST Register And Login Before Playing.");
format(string,sizeof(string),"** Player %s Has Been Kicked From The Server | Reason: Failed To Register/Login **",pName(playerid));
SendClientMessageToAll(red, string);
return Kick(playerid);
}
if(response)
{
if(strfind(pName(playerid), "[AWP]", true) != -1)
{
if(Player[playerid][Member] < 1)
{
new string[105];
SendClientMessage(playerid, red, "Only Authorised AWP Clan Members Can Wear The [AWP] Tag.");
SendClientMessage(playerid, orange, "If You Think You Are Receiving This Message In Error, Please Contact An AWP Clan Administrator.");
format(string,sizeof(string),"%s Has Been Kicked From The Server Automatically | Reason: Unauthorised [AWP] Tag");
SendClientMessageToAll(red, string);
return Kick(playerid);
}
}
new buf[129];
if(!strlen(inputtext) || strlen(inputtext) < 4 || strlen(inputtext) > 24) return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, "{FF0000}INVALID PASSWORD","{FF0000}You Have Entered An Invalid Password.\n{00FF00}Please Note: Passwords Must Be At Least 4 To 24 Characters Long.\n{00F0F0}Please Enter Your Desired Password Below:","Accept","Leave");
WP_Hash(buf, sizeof(buf), inputtext);
printf("String %s Created", buf); //Debug
new INI:File = INI_Open(UserPath(playerid));
printf("User File Opened"); //Debug
INI_WriteString(File,"Password",buf);
printf("String %s Saved to User File",buf); //Debug
INI_Close(File);
printf("File Closed."); //Debug
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ResetUserStats(playerid);
SaveStats(playerid);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "{00FF00}CONFIRM PASSWORD","{00F0F0}Please Confirm Your Password By Typing It Below:","Accept","Leave");
}
}
case LOGIN:
{
new string[130];
if(!response)
{
SendClientMessage(playerid, red, "You Have Been Kicked From The Server. You MUST Register And Login Before Playing.");
format(string,sizeof(string),"** Player %s Has Been Kicked From The Server | Reason: Failed To Register/Login **",pName(playerid));
SendClientMessageToAll(red, string);
return Kick(playerid);
}
if(response)
{
new buf[129];
WP_Hash(buf, sizeof(buf), inputtext);
if(strcmp(Player[playerid][Password], buf, false) == 0)
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
if(strfind(pName(playerid), "[AWP]", true) != -1)
{
if(Player[playerid][Member] < 1)
{
SendClientMessage(playerid, red, "Only Authorised AWP Clan Members Can Wear The [AWP] Tag.");
SendClientMessage(playerid, orange, "If You Think You Are Receiving This Message In Error, Please Contact An AWP Clan Administrator.");
format(string,sizeof(string),"%s Has Been Kicked From The Server Automatically | Reason: Unauthorised [AWP] Tag");
SendClientMessageToAll(red, string);
return Kick(playerid);
}
}
if(Player[playerid][LastLogin] != 0)
{
format(string,sizeof(string),"You Last Logged In: %s. Welcome Back.",Player[playerid][LastLogin]);
SendClientMessage(playerid, yellow, string);
}
new string1[30];
new day, month, year, hour, minute, second;
getdate(year, month, day);
gettime(hour, minute, second);
format(string1,sizeof(string1),"%d/%d/%d | %d:%d:%d",day,month,year,hour,minute,second);
Player[playerid][LastLogin] = string1;
SetPlayerMoney(playerid, Player[playerid][Cash]);
SetPlayerScore(playerid, Player[playerid][Score]);
Player[playerid][LoggedIn] = 1;
SaveStats(playerid);
if(ServerInfo[BetaMode] == 1)
{
if(Player[playerid][Admin] == 0 && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, red, "ERROR: {FFFFFF}The Server Is Currently In BETA Mode. Once The Server's Map Name Is No Longer 'BETA', You Will Be Able To Join.");
SendClientMessage(playerid, orange, "Only Authorised BETA Testers, Administrators And RCON Administrators Can Access The Server During BETA Mode.");
return Kick(playerid);
}
}
SendClientMessage(playerid, green, "You Have Successfully Logged In And Your Current Stats Have Been Loaded.");
ShowPlayerDialog(playerid, RULES, DIALOG_STYLE_MSGBOX, "SERVER RULES", "This is {FF0000}just a test message {00FF00}that will later {0000FF}be replaced by {FFFF00}server rules.","Accept","Decline");
}
else
{
if(Player[playerid][LoginWarn] >= 2)
{
SendClientMessage(playerid, red, "You Have Been Kicked From The Server. You MUST Enter The Correct Password When Logging In.");
SendClientMessage(playerid, orange, "If You Have Forgotten Your Password, Please Contact An Administrator At: 'WWW.AWPGAMING.COM/FORUMS'");
format(string,sizeof(string),"** Player %s Has Been Kicked From The Server | Reason: Failed To Login **",pName(playerid));
Kick(playerid);
SendClientMessageToAll(red, string);
return 1;
}
Player[playerid][LoginWarn]++;
format(string,sizeof(string),"You Have Entered An Incorrect Password. You Have A Maximum Of 3 Attempts Before You Are Automatically Kicked. %d/3 Attempts Used.",Player[playerid][LoginWarn]);
SendClientMessage(playerid, red, string);
return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD,"{FF0000}INCORRECT PASSWORD","{FF0000}You Have Entered An Incorrect Password, Please Try Again, You Will Have 3 Attempts In Total Before Being Kicked.\n{00F0F0}Please Enter Your Current Password Below:","Accept","Leave");
}
return 1;
}
}
//Code continues
Regards,
clarencecuzz.