Bullets saving(MySQL) -
actiwe - 19.01.2010
Hello everybody, i'm new here and need some support.
Let's begin with problem. I've taken moderntopia base, and edited it for while, but now I'm having problem with bullet saving. I'm gonna show you guys some lines, maybe you can see the problem.
OnPlayerLogin, It loads data.. and for bullets i have OnPlayerLogin
Code:
if (rcnt == 73) ScriptBullets[playerid][2] = strval(Field);
OnPlayerRequestSpawn(script gives weapon and bullets. Btw, if I replace Scriptbullets with any number it gives this amount bullets.)
Code:
SafeGivePlayerWeapon(playerid, ScriptWeapons[playerid][2], ScriptBullets[playerid][2]);
And saving on logout
Code:
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo2", ScriptBullets[playerid][2]);
I've noticed on sql that script even won't put any value to that cell. If I add manually there something it still won't give any gun.
Thanks for help.
Re: Bullets saving(MySQL) -
addysnow1 - 19.01.2010
Give me the definition of query and Ammo2
Re: Bullets saving(MySQL) -
actiwe - 19.01.2010
Hmm I don't get it now but I try to understand..
pawn Code:
public OnGamePlayerUpdate(playerid) // by Luk0r v1.2
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid])
{
MySQLCheckConnection();
new query[MAX_STRING];
format(query, MAX_STRING, "UPDATE players SET ");
and then comes all those MySQLUpdatePlayerInt
And what you mean under Ammo2 definition?
Re: Bullets saving(MySQL) -
addysnow1 - 19.01.2010
I'm not sure. But I think you have to use this incase Ammo2
Change:
new Ammo2 = MAX_STRING
to
new Ammo2 = GetPlayerAmmo(playerid);
Shit this not correct. Let me check ik out, can you send me your whole OnPlayerUpdate public?
Re: Bullets saving(MySQL) -
actiwe - 19.01.2010
i think u need OnGamePlayerUpdate :P
Code:
public OnGamePlayerUpdate(playerid) // by Luk0r v1.2
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid])
{
MySQLCheckConnection();
new query[MAX_STRING];
format(query, MAX_STRING, "UPDATE players SET ");
//bunch of sql thinks that works correctly
//now some stuff for weapons and bulls(4 type weapons, i tooh example no2)
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun1", ScriptWeapons[playerid][1]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun2", ScriptWeapons[playerid][2]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun3", ScriptWeapons[playerid][3]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun4", ScriptWeapons[playerid][5]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo1", ScriptBullets[playerid][1]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo2", ScriptBullets[playerid][2]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo3", ScriptBullets[playerid][3]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo4", ScriptBullets[playerid][5]);
MySQLUpdateFinish(query, PlayerInfo[playerid][pSQLID]);
}
}
return 1;
}
Thatsit
Re: Bullets saving(MySQL) -
addysnow1 - 19.01.2010
Wtf I never saw something like this xD.
I cannot help you anymore. Because I'm not a pro in pawno.
And I don't get this.
Might you can choose an easier register/login system.

I always used Ladmin. But you also can wait untill an other guy replys on this tread