SA-MP Forums Archive
Undefined symble, ehh - 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)
+--- Thread: Undefined symble, ehh (/showthread.php?tid=497437)



Undefined symble, ehh - benjaminjones - 26.02.2014

pawn Код:
stock GetWeaponParam(id, WeaponsEnum: param)
{
    for (new i; i < sizeof(Weapons); i++)
    {
        if (Weapons[i][WeaponId] == id) return Weapons[i][param];
    }
    return 0;
}
Two Errors:
pawn Код:
Error:(33532) : error 017: undefined symbol "Weapons"
Error:(33532) : error 017: undefined symbol "i"
Line 33532:
pawn Код:
for (new i; i < sizeof(Weapons); i++)



How to define it or what to do? Please help me.


Re: Undefined symble, ehh - Aerotactics - 26.02.2014

I've had similar issues:
-"new i" has to equal something, such as "new i = 0"
-"i < X" and X has to be another number but not a sizeof definition, or it can be a MAX number, such as MAX_WEAPONS, which you'll have to define at the top of the script


Re: Undefined symble, ehh - benjaminjones - 26.02.2014

Hmm, can you explain with better because I didnt understood. Already rep +1 you for the help anyways, but please help me


Re: Undefined symble, ehh - Aerotactics - 26.02.2014

Quote:
Originally Posted by benjaminjones
Посмотреть сообщение
Hmm, can you explain with better because I didnt understood. Already rep +1 you for the help anyways, but please help me
pawn Код:
//Top of script
#define MAX_WEAPONS 1000 // you can change this to any number

//Your "for new i"
for (new i = 0, i < MAX_WEAPONS, i++)
Edit: Thanks for rep


Re: Undefined symble, ehh - benjaminjones - 26.02.2014

Actually, I think it's working but new errors came out.


Re: Undefined symble, ehh - benjaminjones - 26.02.2014

pawn Код:
(33535) : error 021: symbol already defined: "i"
(33537) : error 017: undefined symbol "Weapons"
(33537) : warning 215: expression has no effect
(33537) : error 001: expected token: ";", but found "]"
(33537) : error 029: invalid expression, assumed zero
(33537) : fatal error 107: too many error messages on one line
Lines:
pawn Код:
33535   for (new i = 0, i < MAX_WEAPONS, i++)
33537   if (Weapons[i][WeaponId] == id) return Weapons[i][param];



Re: Undefined symble, ehh - Aerotactics - 26.02.2014

Try replacing i with x (since "i" is already defined somewhere else) like:
pawn Код:
for (new x = 0, x < MAX_WEAPONS, x++)
if (Weapons[x][WeaponId] == id) return Weapons[x][param];



Re: Undefined symble, ehh - benjaminjones - 26.02.2014

Nope, not working ,.. Any other ideas bro?


Re: Undefined symble, ehh - Aerotactics - 26.02.2014

Quote:
Originally Posted by benjaminjones
Посмотреть сообщение
Nope, not working ,.. Any other ideas bro?
Nope, sorry. That's all I got lol


Re: Undefined symble, ehh - benjaminjones - 26.02.2014

Well, let's wait for some good guy who can help me ,.