Undefined symble, ehh
#1

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

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
Reply
#3

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

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
Reply
#5

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

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

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

Nope, not working ,.. Any other ideas bro?
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)