SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/12/2018, 05:09 PM   #1
KinxpIn
Little Clucker
 
Join Date: Dec 2018
Posts: 25
Reputation: 0
Default undefined symbol.

guys... what's wrong with this code? :3

PHP Code:
CheckPlayerFactName(playerid)
{
    new 
fact pInfo[playerid][pFaction];
    new 
noneSAPDSAMDSANASAGS;
    if(
fact 1)
    {
        return 
none;
    }
    if(
fact == 1)
    {
        return 
SAPD;
    }
    if(
fact == 2)
    {
        return 
SAMD;
    }
    if(
fact == 3)
    {
        return 
SANA;
    }
    if(
fact == 4)
    {
        return 
SAGS;
    }
    return 
0;
}

CMD:locker(playeridparams[])
{
    new 
fname CheckPlayerFactName(playerid);
    if(!
IsPLogged(playerid)) return Error(playerid4);
    switch(
fname)
    {
        case 
none// error: UNDEFINED SYMBOL
        
{
            
SCM(playeridCOLOR_LIGHTBLUE"SERVER: {FFFFFF}You're not joined in any faction");
        }
        case 
SAPD// error: UNDEFINED SYMBOL
        
{
            
SCM(playeridCOLOR_LIGHTBLUE"Faction: {FFFFFF}You've opened SAPD locker");
        }
        case 
SAMD// error: UNDEFINED SYMBOL
        
{
            
SCM(playeridCOLOR_LIGHTBLUE"Faction: {FFFFFF}You've opened SAMD locker");
        }
        case 
SANA// error: UNDEFINED SYMBOL
        
{
            
SCM(playeridCOLOR_LIGHTBLUE"Faction: {FFFFFF}You've opened SANA locker");
        }
        case 
SAGS// error: UNDEFINED SYMBOL
        
{
            
SCM(playeridCOLOR_LIGHTBLUE"Faction: {FFFFFF}You've opened SAGS locker");
        }
    }
    return 
1;

I can't think again xD
KinxpIn is offline   Reply With Quote
Old 31/12/2018, 05:13 PM   #2
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,194
Reputation: 420
Default Re: undefined symbol.

:3 Its because :3 you defined a variable :3 locally :3 and tried using it :3 globally :3 so instead :3 you should move the line :3
Code:
new none, SAPD, SAMD, SANA, SAGS;
from under :3 the cmd :3 to the top of the script :3 like so :3
instead of :3
Code:
CheckPlayerFactName(playerid) 
{ 
    new fact = pInfo[playerid][pFaction]; 
    new none, SAPD, SAMD, SANA, SAGS;
it should be :3

Code:
new none, SAPD, SAMD, SANA, SAGS; // Top of the script
CheckPlayerFactName(playerid) 
{ 
    new fact = pInfo[playerid][pFaction];
__________________
Quote:
Originally Posted by Andy
My anti cheat is still relevant *puts shades on* https://github.com/RogueDrifter/Anti_cheat_pack

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link

RogueDrifter is offline   Reply With Quote
Old 31/12/2018, 05:14 PM   #3
KinxpIn
Little Clucker
 
Join Date: Dec 2018
Posts: 25
Reputation: 0
Default Re: undefined symbol.

Quote:
Originally Posted by RogueDrifter View Post
:3 Its because :3 you defined a variable :3 locally :3 and tried using it :3 globally :3 so instead :3 you should move the line :3
Code:
new none, SAPD, SAMD, SANA, SAGS;
from under :3 the cmd :3 to the top of the script :3 like so :3
instead of :3
Code:
CheckPlayerFactName(playerid) 
{ 
    new fact = pInfo[playerid][pFaction]; 
    new none, SAPD, SAMD, SANA, SAGS;
it should be :3

Code:
new none, SAPD, SAMD, SANA, SAGS; // Top of the script
CheckPlayerFactName(playerid) 
{ 
    new fact = pInfo[playerid][pFaction];
XDDDDD
KinxpIn is offline   Reply With Quote
Old 31/12/2018, 05:15 PM   #4
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,194
Reputation: 420
Default Re: undefined symbol.

Quote:
Originally Posted by KinxpIn View Post
XDDDDD
XD LoL ^~^
__________________
Quote:
Originally Posted by Andy
My anti cheat is still relevant *puts shades on* https://github.com/RogueDrifter/Anti_cheat_pack

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link

RogueDrifter is offline   Reply With Quote
Old 31/12/2018, 05:41 PM   #5
KinxpIn
Little Clucker
 
Join Date: Dec 2018
Posts: 25
Reputation: 0
Default Re: undefined symbol.

But, in this case isn't it if "fname = CheckPlayerFactName(playerid);"
The fname should match the faction name right? (SAPD, SAMD, etc)

I can just use "if", but I'm trying to use the "switch" method
So, I'd better use "switch, case" or "if"?

example
Code:
switch (string)
{
*     case SAPD:
}
//OR
if (string == SAPD)
{
    do something;
}
KinxpIn is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I get multiple errors on the include MSelection [UNDEFINED SYMBOL AND SYMBOL IS NEVER USED] Gorgeousmaniac Scripting Help 2 21/08/2016 06:31 PM
symbol lookup error: plugins/mysql.so: undefined symbol: compress Grzechuso Scripting Help 2 06/01/2016 03:52 PM
error 017: undefined symbol "ReadPlayer" and error 017: undefined symbol "WritePlayer" brandypol Scripting Help 8 26/08/2014 06:16 PM
undefined symbol and symbol is assigned a value that is never used Proph3t Scripting Help 2 11/04/2013 02:54 PM
[HELP]Undefined symbol errors when symbol is defined PCheriyan007 Help Archive 9 07/07/2011 01:09 AM


All times are GMT. The time now is 06:06 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.