SA-MP Forums Archive
gunshop - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: gunshop (/showthread.php?tid=238681)



gunshop - omer5198 - 12.03.2011

i made a gun show but how can i save the guns that the player has?
PlayerInfo[playerid][GUNs?!?!?] = IDONTKNOW!!!
plz help!?!?!?!


Re: gunshop - arti - 12.03.2011

PlayerInfo[playerid][slot][weaponid][ammo]

And save it from

GetPlayerWeaponData(playerid, slot, &weapon, &ammo)


Re: gunshop - iMonk3y - 12.03.2011

I think max dimensions you can have is 3... You can't store for ex. weapon ammo in the ammo array.
You could do something like this:

pawn Код:
new weapons[13][2];
In other words, you have 13 x 2 variables, of which first part will store weapons and the second part will store ammo. But with arrays you can store data at once and access them dynamically.

pawn Код:
for (new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}
//- SA-MP Wiki
Now we've stored all the weapon data in an array containing 13 slots.