SA-MP Forums Archive
[question]GivePlayerWeapon - 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: [question]GivePlayerWeapon (/showthread.php?tid=84643)



[question]GivePlayerWeapon - Marc_307 - 02.07.2009

Hi, I used the function exactly like Wiki:http:https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
pawn Код:
for(new i=0;i<13;i++)
{
    GetPlayerWeaponData(playerid,i,weapons[i][0],weapons[i][1]);
}
And the player should get his weapons back later.
I don't know if I've done it correctly but the compiler says "undefined symbol "i"".
pawn Код:
GivePlayerWeapon(playerid,weapons[w][0],weapons[w][1]);
Can somebody help?


Re: [question]GivePlayerWeapon - refshal - 02.07.2009

Try this:

pawn Код:
for(new i=0;i<13;i++)
GetPlayerWeaponData(playerid,i,weapons[i][0],weapons[i][1]);
or

pawn Код:
GetPlayerWeaponData(i,weapons[i][0],weapons[i][1]);
or

pawn Код:
GetPlayerWeaponData(playerid[i],weapons[i][0],weapons[i][1]);



Re: [question]GivePlayerWeapon - Vince - 02.07.2009

This is the syntax for GetPlayerWeaponData:
GetPlayerWeaponData(playerid, slot, &weapons, &ammo)

So what you're suggesting, coop, will not work as it will get you the 'number of arguments do not match definition' error.

@Marc_307: Show us the whole callback where you placed this loop.


Re: [question]GivePlayerWeapon - Jefff - 02.07.2009

top
Код:
new Guns[200][2][13];
Код:
for(new x = 0; x < 13; x++) GetPlayerWeaponData(playerid, x, Guns[playerid][0][x], Guns[playerid][1][x]);
and back
Код:
for(new x = 0; x < 13; x++) GivePlayerWeapon(playerid, Guns[playerid][0][x], Guns[playerid][1][x]);



Re: [question]GivePlayerWeapon - Marc_307 - 02.07.2009

Quote:
pawn Код:
for(new x = 0; x < 13; x++) GivePlayerWeapon(playerid, Guns[playerid][0][x], Guns[playerid][1][x]);
Thanks, now it works.