SA-MP Forums Archive
Command Problem - 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: Command Problem (/showthread.php?tid=312267)



Command Problem - Tanush123 - 20.01.2012

For some reason it shows "SERVER: Unknown Command" randomly. I see no bugs or anything on the code
pawn Код:
CMD:quitjob(playerid,params[])
{
    if(PlayerData[playerid][Job] == 0) return SCM(playerid,red,"ERROR: You are not in a job");
    format(str,sizeof(str),"You have quitted %s",JobInfo[PlayerData[playerid][Job]][Jobname]);
    SCM(playerid,COLOR_LIGHTBLUE,str);
    PlayerData[playerid][Job] = 0;
    return 1;
}



Re: Command Problem - Da' J' - 20.01.2012

Don't get mad to me, but just asking. I see only once the "if" for checking if they have a job... Should you do it twice? In my eyes, i just keep staring at the miss of that. :/

What i'm talking about is
pawn Код:
if(PlayerData[playerid][Job] == 1)

Just trying to be kind and help. Hopefully it helps...


Re: Command Problem - Snowman12 - 20.01.2012

Hey Da' J' in this case a 'if' statement is only used once as your only checking if the players job is 0 which would be no job understand? But your right alot of cases where this would be used.


Re: Command Problem - MSI - 20.01.2012

Weird, maybe a bug else


Re: Command Problem - [ABK]Antonio - 20.01.2012

Quote:
Originally Posted by Da' J'
Посмотреть сообщение
Don't get mad to me, but just asking. I see only once the "if" for checking if they have a job... Should you do it twice? In my eyes, i just keep staring at the miss of that. :/

What i'm talking about is
pawn Код:
if(PlayerData[playerid][Job] == 1)

Just trying to be kind and help. Hopefully it helps...
Nah, doing
pawn Код:
if(PlayerData[playerid][Job] == 0) return SomeErrorMsg
is the equivalent of doing
pawn Код:
if(PlayerData[playerid][Job] != 0)
{
    //we continue with our command
}

How is your
pawn Код:
JobInfo[PlayerData[playerid][Job]][Jobname]
set?


Re: Command Problem - Tanush123 - 20.01.2012

Well JobInfo[PlayerData[playerid][Job]][Jobname] shows what job is the player in. Im sure that has no problem because it works for other commands.