GetPlayerWeapon -
Mrich - 24.02.2013
Hey , I'm working on a saving weapon system , but the GetPlayerWeapon will get only the armed one isn't it ? how to use the 'GetPlayerWeapon' properly?
thanks.
Re: GetPlayerWeapon -
antonio112 - 24.02.2013
To get all weapons a player has, you need
GetPlayerWeaponData function.
Re: GetPlayerWeapon -
SKAzini - 24.02.2013
Loop through all of the weapon slots and save them to an array:
pawn Код:
new Weapons[MAX_PLAYERS][13][2];
for (new i = 0; i < 13; i++) GetPlayerWeaponData(playerid, i, Weapons[playerid][i][0], Weapons[playerid][i][1]);
Loop through all the weapon slots in an array and load them:
pawn Код:
new Weapons[MAX_PLAYERS][13][2];
for (new a = 0; a < 13; a++)
{
if(Weapons[playerid][a][1] < 0) Weapons[playerid][a][1] = 99999;
GivePlayerWeapon(playerid, Weapons[playerid][a][0], Weapons[playerid][a][1]);
}
Re: GetPlayerWeapon -
Mrich - 24.02.2013
thank you ! but the [13] is slots ? please SKAzini I need explaination of your code (to learn it well).
waiting for your answer
EDIT:
I think I got it so Weapons is the variable that I must save it ?
Re: GetPlayerWeapon -
ReVo_ - 24.02.2013
Player weapons will be saved in Weapons
[a] = Is the slot ID
[a][0] = Is weapon id
[a][1] = Is ammo of the weapon
[13] Means max weapon slots
Re: GetPlayerWeapon -
Mrich - 24.02.2013
I understand now , but it only will save it in the server , but when disconnecting I should add that ?(don't think good to do that):
pawn Код:
dini_IntSet(file[playerid], "Weapons", Weapons[playerid]);
i'm using dini
Re: GetPlayerWeapon -
ReVo_ - 24.02.2013
for (new i = 0; i < 13; i ++)
{
format(str, sizeof str, "Weapons_i%d", i);
dini_IntSet(file[playerid], str, Weapons[playerid][i][0]);
format(str, sizeof str, "Weapons_a%d", i);
dini_IntSet(file[playerid], str, Weapons[playerid][i][1]);
}
Re: GetPlayerWeapon -
Mrich - 24.02.2013
Thanks ! one question OT:
Is there any way creating Buyable & savable Houses/cars using only Dini+dcmd+samp includes?
Re: GetPlayerWeapon -
ReVo_ - 24.02.2013
Yes.
(Anyway dini is not the best saving system)
Re: GetPlayerWeapon -
SKAzini - 24.02.2013
MySQL is easier and better imo.