SA-MP Forums Archive
Save weapon(s) - 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)
+--- Thread: Save weapon(s) (/showthread.php?tid=434347)



Save weapon(s) - [..MonTaNa..] - 02.05.2013

.....


Re: Save weapon(s) - Pottus - 02.05.2013

pawn Код:
enum weapdat { WeaponID, WeaponAmmo }
new oldweapons[MAX_PLAYERS][13][weapdat];

stock GetOldWeapons(playerid)
{
    for (new i = 0; i < 13; i++) { GetPlayerWeaponData(playerid, i, oldweapons[playerid][i][WeaponID], oldweapons[playerid][i][WeaponAmmo]); }
}

stock SetOldWeapons(playerid)
{
    ResetPlayerWeapons(playerid);
    for (new i = 0; i < 13; i++) { GivePlayerWeapon(playerid, oldweapons[playerid][i][WeaponID], oldweapons[playerid][i][WeaponAmmo]); }
}
It's a good practice to use enums even for simple stuff that way someone who has never touched pawn would know the order of parameters without even having to reference the wiki.


Re: Save weapon(s) - [..MonTaNa..] - 02.05.2013

....


Re: Save weapon(s) - Pottus - 02.05.2013

Woops I derped check the stocks now


Re: Save weapon(s) - Pottus - 02.05.2013

Ok well, I think you'll need to change some stuff about that to get it to work correctly. For one I wouldn't do this
PayPlayerInArea(i, 1995.5, 1518.0, 2006.0, 1569.0, 100); I would use the streamer plugin and add a dynamic area then check if the player is in that area during the loop. Then for GetOldWeapons() and SetOldWeapons() would be called in these callbacks respectively OnPlayerEnterDynamicArea() and OnPlayerLeaveDynamicArea().


Re: Save weapon(s) - [..MonTaNa..] - 02.05.2013

.....


Re: Save weapon(s) - [..MonTaNa..] - 03.05.2013

Removed.