SA-MP Forums Archive
How to define ''Weapons'' - 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: How to define ''Weapons'' (/showthread.php?tid=497523)



How to define ''Weapons'' - benjaminjones - 27.02.2014

I need to define it but I dont know how. So please, I appreciate all help.
The line:
pawn Код:
stock GetWeaponParam(id, WeaponsEnum: param)
{
    for (new  = 0, i < MAX_WEAPONS, i++);
    {
        if (Weapons[x][WeaponId] == id) return Weapons[x][param];
    }
    return 0;
}
The 3 errors:
pawn Код:
error 021: symbol already defined: "i"
error 017: undefined symbol "Weapons"
error 036: empty statement
I hope someone can help me.


Re: How to define ''Weapons'' - Vince - 27.02.2014

First of all, remove the semicolon behind the for line and replace the commas with semicolons.


Re: How to define ''Weapons'' - benjaminjones - 27.02.2014

I did. Now:
The command looks:
pawn Код:
stock GetWeaponParam(id, WeaponsEnum: param)
{
    for (new  = 0; i < MAX_WEAPONS, i++); // Line 33534
    {
        if (Weapons[x][WeaponId] == id) return Weapons[x][param]; // Line 33536
    }
    return 0;
}
New errors showed up:
pawn Код:
(33534) : error 001: expected token: "-identifier-", but found "="
(33536) : error 029: invalid expression, assumed zero
(33536) : error 017: undefined symbol "x"
(33536) : error 029: invalid expression, assumed zero
(33536) : fatal error 107: too many error messages on one line



Re: How to define ''Weapons'' - Mike.FTW - 27.02.2014

Quote:
Originally Posted by benjaminjones
Посмотреть сообщение
I did. Now:
New errors showed up
Try this to fix the last errors
pawn Код:
stock GetWeaponParam(id, WeaponsEnum: param)
{
    for (new X = 0, X < MAX_WEAPONS, X++);
    {
        if (Weapons[X][WeaponId] == id) return Weapons[X][param];
    }
    return 0;
}
And about the..
Quote:
Originally Posted by benjaminjones
Посмотреть сообщение
The 3 errors:
pawn Код:
error 021: symbol already defined: "i"
error 017: undefined symbol "Weapons"
error 036: empty statement
Did you make the Weapons enum? i don't really get what you want to do.


Re: How to define ''Weapons'' - benjaminjones - 27.02.2014

I didn't make made the Weapons enum because I don't know how, so can you write here how please?


Re: How to define ''Weapons'' - benjaminjones - 27.02.2014

pawn Код:
(33534) : error 021: symbol already defined: "X"
(33534) : error 036: empty statement
(33534) : error 017: undefined symbol "Weapons"
(33534 -- 33536) : fatal error 107: too many error messages on one line
One error has been fixed. Well, I believe it to create the Weapon Enum, but I dont know how,.