24.12.2012, 22:36
Hello, and Merry Christmas!
Since I couldn't use Y_INI , I have used DOF2 on my save/load filterscript, which works fine.
The only problem is that money doesn't save, and I know why.
I got a pMoney thing, but it isn't defined. There is no GetPlayerMoney in my script too.
(well there is one for a command I made but that's completely unrelated).
Here is my script, I really need help because I don't know how to make like..
" pMoney = GetPlayerMoney " or something....
Script compiles with no errors. I don't think its because of DOF2 either.
As I said, I think this might be because pMoney isn't defined.
Please help me, I really need help with this .
Thank you!
Since I couldn't use Y_INI , I have used DOF2 on my save/load filterscript, which works fine.
The only problem is that money doesn't save, and I know why.
I got a pMoney thing, but it isn't defined. There is no GetPlayerMoney in my script too.
(well there is one for a command I made but that's completely unrelated).
Here is my script, I really need help because I don't know how to make like..
" pMoney = GetPlayerMoney " or something....
pawn Код:
enum PInfo
{
pAdmin,
pVip,
pVehicle,
pDeaths,
pKills,
pMoney
}
pawn Код:
//=====[STOCK1]=====//
stock USER_FILE(playerid)
{
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(str, sizeof(str), USER_FILE_PATH, pName);
return str;
}
//=====[STOCK2]=====//
stock Load_Player_Stats(playerid)
{
PlayerInfo[playerid][pAdmin] = DOF2_GetInt(USER_FILE(playerid), "AdminLevel");
PlayerInfo[playerid][pVip] = DOF2_GetInt(USER_FILE(playerid), "VipLevel");
PlayerInfo[playerid][pVehicle] = DOF2_GetInt(USER_FILE(playerid), "Vehicle");
PlayerInfo[playerid][pDeaths] = DOF2_GetInt(USER_FILE(playerid), "Deaths");
PlayerInfo[playerid][pKills] = DOF2_GetInt(USER_FILE(playerid), "Kills");
PlayerInfo[playerid][pMoney] = DOF2_GetInt(USER_FILE(playerid), "Money");
GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
}
pawn Код:
public OnPlayerConnect(playerid)
{
if(DOF2_FileExists(USER_FILE(playerid)))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login",
"Type your password here to login !", #Login, #Quit);
}else{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Welcome ! Please register !",
"Type your password here to register!", #Register, #Quit);
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
DOF2_SetInt(USER_FILE(playerid), "AdminLevel", PlayerInfo[playerid][pAdmin] );
DOF2_SetInt(USER_FILE(playerid), "VipLevel", PlayerInfo[playerid][pVip] );
DOF2_SetInt(USER_FILE(playerid), "Vehicle", PlayerInfo[playerid][pVehicle] );
DOF2_SetInt(USER_FILE(playerid), "Deaths", PlayerInfo[playerid][pDeaths] );
DOF2_SetInt(USER_FILE(playerid), "Kills", PlayerInfo[playerid][pKills] );
DOF2_SetInt(USER_FILE(playerid), "Money", PlayerInfo[playerid][pMoney] );
DOF2_SaveFile();
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_REGISTER:
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login",
"You have entered an invalid password ! \nType your password here to login !", #Register, #Quit);
DOF2_CreateFile(USER_FILE(playerid), inputtext);
DOF2_SetInt(USER_FILE(playerid), "AdminLevel", 0 );
DOF2_SetInt(USER_FILE(playerid), "VipLevel", 0 );
DOF2_SetInt(USER_FILE(playerid), "Vehicle", 0 );
DOF2_SetInt(USER_FILE(playerid), "Deaths", 0 );
DOF2_SetInt(USER_FILE(playerid), "Kills", 0 );
DOF2_SetInt(USER_FILE(playerid), "Money", 5000 );
DOF2_SaveFile();
SpawnPlayer(playerid);
GivePlayerMoney(playerid,5000);
}
}
case DIALOG_LOGIN:
{
if(!response) return Kick(playerid);
if(response)
{
if(DOF2_CheckLogin(USER_FILE(playerid), inputtext))
{
Load_Player_Stats(playerid);
}else{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login",
"You have entered an incorrect password. \nType your password below to login", #Login, #Quit);
}
return 1;
}
}
}
return 1;
}
As I said, I think this might be because pMoney isn't defined.
Please help me, I really need help with this .
Thank you!