SA-MP Forums Archive
Cmds help - 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: Cmds help (/showthread.php?tid=477352)



Cmds help - marwanalramahi - 23.11.2013

Код:
CMD:makeadmin(playerid, params[])  {
	if(PlayerInfo[playerid][pAdmin] >= 99998) {

		new
		iAdminValue,
		iTargetID;

		if(sscanf(params, "ui", iTargetID, iAdminValue)) {
			SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
		}
		else if(IsPlayerConnected(iTargetID)) {
			if(PlayerInfo[iTargetID][pHelper] >= 1) {
				SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot make Community Helpers admins!");
			}
			else {

				new
				szMessage[47 + (MAX_PLAYER_NAME * 2)];

				PlayerInfo[iTargetID][pAdmin] = iAdminValue;
				format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
				ABroadCast(COLOR_LIGHTRED,szMessage, 2);
				format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
				SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
				format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
				SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
			}
		}
		else SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	return 1;
}
Every time i use this cmd or any other cmd that involves another player it returns player id 0 like /makeadmin 100 1338 player id 0 becomes an admin the same goes for all cmds what did i do wrong ?


Re: Cmds help - Konstantinos - 23.11.2013

It seems like a sscanf issue. Update sscanf plugin and include file to the latest version and try again.