[question]GivePlayerWeapon
#1

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?
Reply
#2

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]);
Reply
#3

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.
Reply
#4

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]);
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)