undefined symbol.
#1

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

PHP код:
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
Reply
#2

: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
Код:
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
Код:
CheckPlayerFactName(playerid) 
{ 
    new fact = pInfo[playerid][pFaction]; 
    new none, SAPD, SAMD, SANA, SAGS;
it should be :3

Код:
new none, SAPD, SAMD, SANA, SAGS; // Top of the script
CheckPlayerFactName(playerid) 
{ 
    new fact = pInfo[playerid][pFaction];
Reply
#3

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
: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
Код:
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
Код:
CheckPlayerFactName(playerid) 
{ 
    new fact = pInfo[playerid][pFaction]; 
    new none, SAPD, SAMD, SANA, SAGS;
it should be :3

Код:
new none, SAPD, SAMD, SANA, SAGS; // Top of the script
CheckPlayerFactName(playerid) 
{ 
    new fact = pInfo[playerid][pFaction];
XDDDDD
Reply
#4

Quote:
Originally Posted by KinxpIn
Посмотреть сообщение
XDDDDD
XD LoL ^~^
Reply
#5

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
Код:
switch (string)
{
*     case SAPD:
}
//OR
if (string == SAPD)
{
    do something;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)