[SOLVED] Problem With Weapon Pickups
#1

I get the following errors but I done see why...

pawn Code:
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\PTB.pwn(87) : warning 204: symbol is assigned a value that is never used: "Grenades"
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\PTB.pwn(86) : warning 204: symbol is assigned a value that is never used: "Uzi"
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\PTB.pwn(85) : warning 204: symbol is assigned a value that is never used: "RPG"
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\PTB.pwn(84) : warning 204: symbol is assigned a value that is never used: "AK47"
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\PTB.pwn(84 -- 109) : error 017: undefined symbol "AK47"
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\PTB.pwn(113) : error 017: undefined symbol "RPG"
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\PTB.pwn(117) : error 017: undefined symbol "Uzi"
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\PTB.pwn(121) : error 017: undefined symbol "Grenades"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
pawn Code:
//==Weapons=====================================================================
    new AK47 = AddStaticPickup(355, 2, 2251.3999,-1163.4592,1029.7969);//AK In Bathroom
    new RPG = AddStaticPickup(359, 2, 2230.0984,-1185.1213,1029.7969);//RPG In Bedroom
    new Uzi = AddStaticPickup(353, 2, 2188.5896,-1183.1511,1029.7969);//Uzi In Room w/ Sofas
    new Grenades = AddStaticPickup(342, 2, 2203.3601,-1160.6300,1029.7969);//Grenades In Bathroom
//==============================================================================
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if (pickupid == AK47)
  {
    GivePlayerWeapon(playerid,355,250);
  }
  if (pickupid == RPG)
  {
    GivePlayerWeapon(playerid,359,3);
  }
  if (pickupid == Uzi)
  {
    GivePlayerWeapon(playerid,353,400);
  }
  if (pickupid == Grenades)
  {
    GivePlayerWeapon(playerid,342,5);
  }
}
Thanks for any help
Reply
#2

above main()
Code:
new AK47; 
new RPG;
new Uzi;
new Grenades;
under public OnGameModeInit()
Code:
AK47 = AddStaticPickup(355, 2, 2251.3999,-1163.4592,1029.7969);//AK In Bathroom
RPG = AddStaticPickup(359, 2, 2230.0984,-1185.1213,1029.7969);//RPG In Bedroom
Uzi = AddStaticPickup(353, 2, 2188.5896,-1183.1511,1029.7969);//Uzi In Room w/ Sofas
Grenades = AddStaticPickup(342, 2, 2203.3601,-1160.6300,1029.7969);//Grenades In Bathroom
i think that will work if im not wrong
Reply
#3

Thanks that worked fine!
Reply
#4

Just wanna add an explanation to this:

You created a variable inside OnGameModeInit() which means it can only be used in there. To use it in other callbacks u need to create it outside any other callback/command, set the id/status/value in a callback, then call it in another.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)