Making weapons loading short - 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: Making weapons loading short (
/showthread.php?tid=174110)
Making weapons loading short -
||123|| - 04.09.2010
Is there a way of shorting the function of loading the players weapon data instead of doing this:
pawn Код:
enum pInfo
{
pWeapon,
pAmmo,
pWeapon2,
pAmmo2,
pWeapon3,
pAmmo3,
pWeapon4,
pAmmo4,
pWeapon5,
pAmmo5,
pWeapon6,
pAmmo6,
pWeapon7,
pAmmo7,
pWeapon8,
pAmmo8,
pWeapon9,
pAmmo9,
pWeapon10,
pAmmo10,
pWeapon11,
pAmmo11,
pWeapon12,
pAmmo12,
pWeapon13,
pAmmo13,
pWeapon14,
pAmmo14,
};
Re: Making weapons loading short -
Calgon - 04.09.2010
pawn Код:
new playerWeapons[MAX_PLAYERS][13];
new playerAmmo[MAX_PLAYERS][13];
There's only 13 weapon slots.
Re: Making weapons loading short -
||123|| - 04.09.2010
I want to load them...like making a loop which loads all of them.
Re: Making weapons loading short -
SpaZ (Ed) - 04.09.2010
You can make those 2 arrays with 13 slots, and when you want to give the weapons you do
pawn Код:
GivePlayerWeapon(playerid, Weapon[playerid][0], Ammo[playerid][0]);
GivePlayerWeapon(playerid, Weapon[playerid][1], Ammo[playerid][1]);
And when you want to store them you do.
pawn Код:
GetPlayerWeaponData(playerid, 0, Weapon[playerid][0], Ammo[playerid][0]);
GetPlayerWeaponData(playerid, 1, Weapon[playerid][1], Ammo[playerid][1]);
And so on.
Re: Making weapons loading short -
Calgon - 04.09.2010
Quote:
Originally Posted by ||123||
I want to load them...like making a loop which loads all of them.
|
Be a bit more clear next time then. With my arrays:
pawn Код:
new weapons[MAX_PLAYERS][13][2]; // 0 - Weapon ID | 1 - Ammo Count
stock getPlayerWeaponsToArray(playerid) {
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, weapons[playerid][i][0], weapons[playerid][i][1]);
}
return 1;
}
Untested.
Re: Making weapons loading short -
||123|| - 04.09.2010
I meant that I want to load the weapons when the player connects (his old stats weapons). I only need to know how do they give weapons to the player in a short loop.