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



Weird Problem - DragonuAK47 - 19.06.2016

Hello guy's , I have this weird error , a command was working but now in gamemode it dosen't give error but on game it say's the command don't exist

Quote:

CMD:quitjob(playerid, params[])
{
new job = PlayerInfo[playerid][pJob];
if(job == JOBLESS) return SCM(playerid, COLOR_WHITE, "* You don't have a job to quit from.");
if(job == DRUGDEALER)
{
SCM(playerid, COLOR_WHITE, "Nu mai esti un dealer de droguri.");
PlayerInfo[playerid][pJob] = JOBLESS;
}
else
{
SCMEx(playerid, COLOR_YELLOWG, "Ai parsit job-ul %s, iar rankul tau a fost resetat", JobsInfo[job][jobName]);
PlayerInfo[playerid][pJob] = JOBLESS;
if(JobsInfo[job][jobRanks] > 0)
{
PlayerInfo[playerid][pJobRank] = 0;
}
}
return 1;
}




Re: Weird Problem - Konstantinos - 19.06.2016

The problem is the value of "job" and that is used in arrays.
pawn Код:
JobsInfo[job][jobName]
JobsInfo[job][jobRanks]
verify that the value of "job" is valid (between 0 and sizeof JobsInfo - 1) before using it in the above two.