Startup money failing -
Strummer - 20.07.2014
So, I've got this little thing:
Код:
stock GivePlayerCash(playerid, money)
{
PlayerInfo[playerid][pCash] += money;
ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
UpdateMoneyBar(playerid,PlayerInfo[playerid][pCash]);//Sets the money in the moneybar to the serverside cash, Do not remove!
return PlayerInfo[playerid][pCash];
}
And I used it on registration:
Код:
if(dialogid == DIALOG_GENDER)
{
if(response) // Ako uprve prvo
{
if(listitem == 0) // Ako oće da je muљko
{
PlayerInfo[playerid][pSex] = MALE;
SendClientMessage(playerid, -1,""COL_LIGHTBLUE"Mozete krenuti sa igranjem. Ukoliko imate pitanja, kontaktirajte admina putem komande /newchat, ili koristite komandu /help. Ugodno igranje.");
SpawnPlayer(playerid);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
GivePlayerCash(playerid, 5000);
}
if(listitem == 1) // Ako oće da je ћensko
{
PlayerInfo[playerid][pSex] = FEMALE;
SendClientMessage(playerid, -1,""COL_LIGHTBLUE"Mozete krenuti sa igranjem. Ukoliko imate pitanja, kontaktirajte admina putem komande /newchat, ili koristite komandu /help. Ugodno igranje.");
SpawnPlayer(playerid);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
GivePlayerCash(playerid, 5000);
}
}
}
However, it doesn't save in the enum. And if the person relogs, he'll get 0 $.
I did have it in the OnPlayerSpawn for a while, and then I noticed that the player gets new 5000$ over and over again, whenever he respawns.
Re: Startup money failing -
Scottas - 20.07.2014
Then maybe there is an issue with your save/load system?
Re: Startup money failing -
Strummer - 20.07.2014
Nope, I'm sure it works just fine.
Re: Startup money failing -
Scottas - 20.07.2014
pawn Код:
if(dialogid == DIALOG_GENDER)
{
if(response) // Ako uprve prvo
{
if(listitem == 0) // Ako oće da je muško
{
PlayerInfo[playerid][pSex] = MALE;
SendClientMessage(playerid, -1,""COL_LIGHTBLUE"Mozete krenuti sa igranjem. Ukoliko imate pitanja, kontaktirajte admina putem komande /newchat, ili koristite komandu /help. Ugodno igranje.");
SpawnPlayer(playerid);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
printf("%d", GivePlayerCash(playerid, 5000));
}
if(listitem == 1) // Ako oće da je žensko
{
PlayerInfo[playerid][pSex] = FEMALE;
SendClientMessage(playerid, -1,""COL_LIGHTBLUE"Mozete krenuti sa igranjem. Ukoliko imate pitanja, kontaktirajte admina putem komande /newchat, ili koristite komandu /help. Ugodno igranje.");
SpawnPlayer(playerid);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
printf("%d", GivePlayerCash(playerid, 5000));
}
}
}
See what it will print to your server console. Do you get 5000 when you spawn after choosing your gender?
Re: Startup money failing -
Strummer - 20.07.2014
Yup, I get it after the dialog:
[23:51:44] [join] Test_Acca has joined the server (0:127.0.0.1)
[23:51:58] 5000
[23:52:05] [part] Test_Acca has left the server (0:1)
Re: Startup money failing -
Strummer - 21.07.2014
So, I got 5000$ in my stats too, justnot in the enum. I'm sure it's just a minor error, but it's giving me a headache.
Re: Startup money failing -
flamur2012 - 21.07.2014
Strummer maybe this would help, tell me where is your server hosted?
Re: Startup money failing -
Strummer - 21.07.2014
It's a home server.
Re: Startup money failing -
flamur2012 - 21.07.2014
hmm

i saw some hosts had some problems with permission 777 so thats why i asked i got no idea why this happens to u i hope it get's fixed.
Re: Startup money failing -
Strummer - 21.07.2014
Sorry for wasting your time, I fixed it just now haha. Sometimes I'm an idiot xD
Anyway, the line that gave them the starting money was GivePlayerCash, which I declared as a function. But the enum was loading from GivePlayerMoney.