PDA

View Full Version : Problem In GetPlayerWeaponData


GrandTA
26/07/2017, 08:39 PM
public SaveEplayer(playerid)
{
new Float:X,Float:Y,Float:Z,Float:A,Float:HP;
new Float:Armour;
new Weapon[12];
new Ammo[12];
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,A);
GetPlayerHealth(playerid,HP);
GetPlayerArmour(playerid,Armour);
GetPlayerWeaponData(playerid,0,Weapon[0],Ammo[0]);
GetPlayerWeaponData(playerid,1,Weapon[1],Ammo[1]);
GetPlayerWeaponData(playerid,2,Weapon[2],Ammo[2]);
GetPlayerWeaponData(playerid,3,Weapon[3],Ammo[3]);
GetPlayerWeaponData(playerid,4,Weapon[4],Ammo[4]);
GetPlayerWeaponData(playerid,5,Weapon[5],Ammo[5]);
GetPlayerWeaponData(playerid,6,Weapon[6],Ammo[6]);
GetPlayerWeaponData(playerid,7,Weapon[7],Ammo[7]);
GetPlayerWeaponData(playerid,8,Weapon[8],Ammo[8]);
GetPlayerWeaponData(playerid,9,Weapon[9],Ammo[9]);
GetPlayerWeaponData(playerid,10,Weapon[10],Ammo[10]);
GetPlayerWeaponData(playerid,11,Weapon[11],Ammo[11]);
SetPVarInt(playerid,"OldCol",GetPlayerColor(playerid));
SetPVarFloat(playerid,"OldX",X);
SetPVarFloat(playerid,"OldY",Y);
SetPVarFloat(playerid,"OldZ",Z);
SetPVarFloat(playerid,"OldA",A);
SetPVarFloat(playerid,"OldHP",HP);
SetPVarFloat(playerid,"OldArmour",Armour);
SetPVarInt(playerid,"OldInt",GetPlayerInterior(playerid));
SetPVarInt(playerid,"OldVw",GetPlayerVirtualWorld(playerid));
SetPVarInt(playerid,"OldSkin",GetPlayerSkin(playerid));
SetPVarInt(playerid,"OldWep0",Weapon[0]);
SetPVarInt(playerid,"OldWep1",Weapon[1]);
SetPVarInt(playerid,"OldWep2",Weapon[2]);
SetPVarInt(playerid,"OldWep3",Weapon[3]);
SetPVarInt(playerid,"OldWep4",Weapon[4]);
SetPVarInt(playerid,"OldWep5",Weapon[5]);
SetPVarInt(playerid,"OldWep6",Weapon[6]);
SetPVarInt(playerid,"OldWep7",Weapon[7]);
SetPVarInt(playerid,"OldWep8",Weapon[8]);
SetPVarInt(playerid,"OldWep9",Weapon[9]);
SetPVarInt(playerid,"OldWep10",Weapon[10]);
SetPVarInt(playerid,"OldWep11",Weapon[11]);
SetPVarInt(playerid,"OldAmmo0",Ammo[0]);
SetPVarInt(playerid,"OldAmmo1",Ammo[1]);
SetPVarInt(playerid,"OldAmmo2",Ammo[2]);
SetPVarInt(playerid,"OldAmmo3",Ammo[3]);
SetPVarInt(playerid,"OldAmmo4",Ammo[4]);
SetPVarInt(playerid,"OldAmmo5",Ammo[5]);
SetPVarInt(playerid,"OldAmmo6",Ammo[6]);
SetPVarInt(playerid,"OldAmmo7",Ammo[7]);
SetPVarInt(playerid,"OldAmmo8",Ammo[8]);
SetPVarInt(playerid,"OldAmmo9",Ammo[9]);
SetPVarInt(playerid,"OldAmmo10",Ammo[10]);
SetPVarInt(playerid,"OldAmmo11",Ammo[11]);
return 1;
}
But Errors:
C:\Documents and Settings\OMID\Desktop\Reloaded\gamemodes\New.pwn(6 480) : warning 219: local variable "Ammo" shadows a variable at a preceding level
C:\Documents and Settings\OMID\Desktop\Reloaded\gamemodes\New.pwn(6 485) : error 028: invalid subscript (not an array or too many subscripts): "Ammo"
C:\Documents and Settings\OMID\Desktop\Reloaded\gamemodes\New.pwn(6 485) : warning 215: expression has no effect
C:\Documents and Settings\OMID\Desktop\Reloaded\gamemodes\New.pwn(6 485) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\OMID\Desktop\Reloaded\gamemodes\New.pwn(6 485) : error 029: invalid expression, assumed zero
C:\Documents and Settings\OMID\Desktop\Reloaded\gamemodes\New.pwn(6 485) : fatal error 107: too many error messages on one line

Compilation aborted.

Pawn compiler 3.2.3664 Copyright (c) 1997-2017, ITB CompuPhase


4 Errors.

IDK Whats Wrong Please Help

Kane
26/07/2017, 09:12 PM
What line?

GrandTA
26/07/2017, 09:55 PM
What line?
line 6485

GrandTA
26/07/2017, 09:58 PM
Line:6485=====> GetPlayerWeaponData(playerid,0,Weapon[0],Ammo[0]);

Kane
26/07/2017, 09:58 PM
...Paste the line it's happening at.

How are we pose to know which line 6485 is?

GrandTA
26/07/2017, 10:01 PM
I Did That.First GetPlayerWeaponData Is Line 6485

OneDay
27/07/2017, 08:43 AM
try "new ammo[12];"

Crystallize
27/07/2017, 09:29 AM
I Did That.First GetPlayerWeaponData Is Line 6485

Rename the string to smth else like ammo1