SA-MP Forums Archive
help with /swatrank - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help with /swatrank (/showthread.php?tid=127449)



help with /swatrank - Chivava - 13.02.2010

Hello im trying to make a /swatrank its basicly the same like /giverank, but how can i make it like if he types it says :
You have promoted ''playername'' to ''swatrank''

and also how can i make it like if he does /swatrank 1 it sets swatrank = 1;
/swatrank sets swatrank = 2; and so on..

This is how my cmds looks alike so far..

Код:
//----------------------------------[SWATRANK]------------------------------------------------
	if(strcmp(cmd, "/swatrank", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /Swatrank [playerid/PartOfName] [swat rank]");
				return 1;
			}
			new para1;
			new level;
			para1 = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			level = strval(tmp);
			if(level > 4 || level < 1) { SendClientMessage(playerid, COLOR_GREY, "Wrong SWAT Rank."); return 1; }
			if (PlayerInfo[playerid][pRankSWAT] >= 4 || PlayerInfo[playerid][pAdmin] >=6)
			{
			  if(IsPlayerConnected(para1))
			  {
			    if(para1 != INVALID_PLAYER_ID)
			    {
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "You have been promoted to SWAT by %s", sendername);
						SendClientMessage(para1, COLOR_WHITE, string);
						format(string, sizeof(string), "You have Promoted %s SWAT rank %d.", giveplayer,level);
						SendClientMessage(playerid, COLOR_WHITE, string);
					}
				}//not connected
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "* you are not authorized to use that command!");
			}
		}
		return 1;
	}



Re: help with /swatrank - Chivava - 13.02.2010

Nvm got it working now.