SA-MP Forums Archive
MYSQL Weapon saving/reloading - Printable Version

+- SA-MP Forums Archive (
+-- Forum: SA-MP Scripting and Plugins (
+--- Forum: Scripting Help (
+--- Thread: MYSQL Weapon saving/reloading (/showthread.php?tid=455959)

MYSQL Weapon saving/reloading - DRCharlie - 03.08.2013

Hey guys!

I'm scripting a server mostly for fun and I somehow made a part of my script work(I'm really new to MYSQL and I'm happy to see it work).

I want to make a script that saves the player's weapons on disconnecting IN A COMPLETELY SEPERATE TABLE and then loads it when he logs back in[this part partially works].

I managed to get the loading part, but it only loads the first weapon in the database and ignores the rest.

My example:

I put a Deagle with 24 bullets in it and an MP5 after it with 29 bullets and it ONLY loaded the Deagle.

I'm using timers because the player doesn't spawn immediately in the gamemode.

pawn Код:
forward spawnweapons(playerid);
public spawnweapons(playerid)
    format(mainstring,sizeof(mainstring),"SELECT * FROM weapons WHERE PlayerID = '%d'",PlayerInfo[playerid][pID]);
    new result[64];
    new weapon[MAX_WEAPONS];
    new ammo[MAX_WEAPONS];
    new id;
        weapon[id] = strval(result);
        ammo[id] = strval(result);
        GivePlayerWeapon(playerid, weapon[id], ammo[id]);
So can you help me out with what I need to add to make it load the other weapons too?
And also can you please help me with saving them on disconnecting?

Thank you very much in advance!

Re: MYSQL Weapon saving/reloading - DRCharlie - 04.08.2013

Still need help with this

Re: MYSQL Weapon saving/reloading - DRCharlie - 15.08.2013