How to.. - 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: How to.. (
/showthread.php?tid=134347)
How to.. -
Torran - 16.03.2010
Hello,
Im wondering how i would get all the weapons that the player has in all there slots,
And save them to
PlayerInfo[playerid][Weapons]
And how would i load them from that and give it to the player?
Re: How to.. -
smeti - 16.03.2010
https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
[FS] Dmteleport
Re: How to.. -
Torran - 16.03.2010
Dosent really tell me much,
Ive looked at it,
What i dont know is how to save it to
PlayerInfo[playerid][Weapons]
And give player the weapons that are in [u]PlayerInfo[playerid][Weapons][u]
Re: How to.. -
Nero_3D - 16.03.2010
Quote:
Originally Posted by Joe Torran C
Dosent really tell me much,
Ive looked at it,
What i dont know is how to save it to PlayerInfo[playerid][Weapons]
And give player the weapons that are in [u]PlayerInfo[playerid][Weapons][u]
|
Check the example from GetPlayerWeaponData...
then you know how to save all weapons from a player
reading would be vice versa
Re: How to.. -
Torran - 16.03.2010
And to give the player the weapons saved?
Re: How to.. -
Nero_3D - 16.03.2010
pawn Код:
new Weapon_Data[MAX_PLAYERS][26];
//Saving
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, Weapon_Data[playerid][i], Weapon_Data[playerid][i + 13]);
}
//Reading
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, Weapon_Data[playerid][i], Weapon_Data[i + 13]);
}
I dont think that this was hard...
*Slot 12 could be removed from saving because slot 12 only contains the detonator
Re: How to.. -
Torran - 16.03.2010
Im still not sure using PlayerInfo[playerid][Weapons]
Re: How to.. -
Rzzr - 16.03.2010
You cannot save every weapon into PlayerInfo[playerid][Weapons], that's obvious, you need to create a separate slot for everyweapon, like PlayerInfo[playerid][Assaultrifle], PlayerInfo[playerid][Assaultammo], PlayerInfo[playerid][Pistol], PlayerInfo[playerid][Pistolammo].
Re: How to.. -
smeti - 17.03.2010
Quote:
Originally Posted by Joe Torran C
Im still not sure using PlayerInfo[playerid][Weapons]
|
Quote:
Originally Posted by LowCo.
You cannot save every weapon into PlayerInfo[playerid][Weapons], that's obvious, you need to create a separate slot for everyweapon, like PlayerInfo[playerid][Assaultrifle], PlayerInfo[playerid][Assaultammo], PlayerInfo[playerid][Pistol], PlayerInfo[playerid][Pistolammo].
|
lol
Try this:
pawn Код:
#include <a_samp>
#define FILTERSCRIPT
#include <zcmd>
enum blabla
{
Weapons[12],
ammo[12],
}
new PlayerInfo[MAX_PLAYERS][blabla];
COMMAND:saveweap(playerid, params[])
{
for(new i; i < 12; i++)
{
GetPlayerWeaponData(playerid, i+1, PlayerInfo[playerid][Weapons][i], PlayerInfo[playerid][ammo][i]);
}
ResetPlayerWeapons(playerid);
SendClientMessage(playerid, 0xFF0000FF, "Saved weapons ammo and ResetPlayerWeapons.");
return 1;
}
COMMAND:addweap(playerid, params[])
{
for(new i; i < 12; i++)
{
GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapons][i], PlayerInfo[playerid][ammo][i]);
}
SendClientMessage(playerid, 0xFF0000FF, "Add weapons. It's cool.");
return 1;
}