SA-MP Forums Archive
Question about something with my command - 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: Question about something with my command (/showthread.php?tid=524441)



Question about something with my command - K9IsGodly - 06.07.2014

Код:
CMD:setjoblevel(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 5)
	{
    	new targetid, job, level;
		if(sscanf(params, "uii", targetid, level)) return SendClientMessage(playerid, -1, "/setjoblevel [playerid/partofname] [job] [level]");
		SendClientMessage(playerid, -1, "1. Drug Dealer, 2. UPS worker.");
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "That player is not currently online!");
		if(!(-1 < job < 2)) return SendClientMessage(playerid, -1, "There are only two jobs currently!");
		if(!(-1 < level < 8)) return SendClientMessage(playerid, -1, "The highest level for all jobs is 8!");
		
	}
	else
	{
	    SendClientMessage(playerid, -1, "You must be an administrator to use this command!");
	}
}
Код:
if(!(-1 < job < 2)) return SendClientMessage(playerid, -1, "There are only two jobs currently!");
if(!(-1 < level < 8)) return SendClientMessage(playerid, -1, "The highest level for all jobs is 8!");
What I was wondering is in relation to these above statements. Should I just use switch(level) and then switch(job), then cases in order to create what I was trying to do (which is basically be able to choose which job to set to level 8 or under), or is there some other way I'm missing?

I was using these two variables in an enum in order to store the levels and how much the player needs to level up (Which has already been done in a different section of code)
Код:
UPSlevel, UPSjoblevel[7]