SA-MP Forums Archive
[Help] sscanf 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: [Help] sscanf command (/showthread.php?tid=321581)



[Help] sscanf command - sanplayer - 27.02.2012

I made a setvip command and it doesnt work... It just shows how to use it


Re: [Help] sscanf command - Vince - 27.02.2012

And everyone here is telepathic and can remotely see your code. <.<


Re: [Help] sscanf command - sanplayer - 27.02.2012

Код:
CMD:setvip(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 1338 || PlayerInfo[playerid][pShopTech] >= 1)
	{
		new string[128], giveplayerid, level;
		if(sscanf(params, "ud", giveplayerid, level))
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /setvip [playerid] [level]");
			SendClientMessageEx(playerid, COLOR_GRAD3, "Levels: [0] Remove VIP [1] Bronze [2] Silver [3] Gold [4] Platinum [5] Diamond");
			return 1;
		}

		if(IsPlayerConnected(giveplayerid))
		{
			if(giveplayerid != INVALID_PLAYER_ID)
			{
				if(level < 0 || level > 5)
				{
					SendClientMessageEx(playerid, COLOR_GRAD1, "VIP Level can not be below 0 or above 5!");
					return 1;
				}
				PlayerInfo[giveplayerid][pDonateRank] = level;
				PlayerInfo[giveplayerid][pTempVIP] = 0;
				PlayerInfo[giveplayerid][pBuddyInvited] = 0;
				new year, month,day;
				getdate(year, month, day);
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
				if(level == 0)
				{
					if (PlayerInfo[playerid][pAdmin] < 1337)
					{
						format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to None (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
						SendClientMessageEx(playerid, COLOR_LIGHTRED, string);
					}
					format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to None (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 1337);
					format(string, sizeof(string), "Your VIP level has been set to None by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
					PlayerInfo[giveplayerid][pTokens] = 0;

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) VIP level to None (%d). (%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level, month,day,year);
					Log("logs/setvip.log", string);
					return 1;
				}
				if(level == 1)
				{
					if (PlayerInfo[playerid][pAdmin] < 1337)
					{
						format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to Bronze (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
						SendClientMessageEx(playerid, COLOR_LIGHTRED, string);
					}
					format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to Bronze (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 1337);
					format(string, sizeof(string), "Your VIP level has been set to Bronze by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessageEx(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) VIP level to Bronze (%d). (%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level, month,day,year);
					Log("logs/setvip.log", string);
					return 1;
				}
				if(level == 2)
				{
					if (PlayerInfo[playerid][pAdmin] < 1337)
					{
						format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to Silver (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
						SendClientMessageEx(playerid, COLOR_LIGHTRED, string);
					}
					format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to Silver (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 1337);
					format(string, sizeof(string), "Your VIP level has been set to Silver by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessageEx(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) VIP level to Silver (%d). (%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level, month,day,year);
					Log("logs/setvip.log", string);
					return 1;
				}
				if(level == 3)
				{
					if (PlayerInfo[playerid][pAdmin] < 1337)
					{
						format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to Gold (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
						SendClientMessageEx(playerid, COLOR_LIGHTRED, string);
					}
					format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to Gold (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 1337);
					format(string, sizeof(string), "Your VIP level has been set to Gold by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessageEx(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) VIP level to Gold (%d). (%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level, month,day,year);
					Log("logs/setvip.log", string);
					return 1;
				}
				if(level == 4)
				{
					if (PlayerInfo[playerid][pAdmin] < 1337)
					{
						format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to Platinum (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
						SendClientMessageEx(playerid, COLOR_LIGHTRED, string);
					}
					format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to Platinum (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 1337);
					format(string, sizeof(string), "Your VIP level has been set to Platinum by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessageEx(giveplayerid, COLOR_WHITE, string);

					// Level 5 Arms Job - Platinum VIP
					PlayerInfo[giveplayerid][pArmsSkill] = 401;

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) VIP level to Platinum (%d). (%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level, month,day,year);
					Log("logs/setvip.log", string);
					return 1;
				}
				if(level == 5)
				{
					if (PlayerInfo[playerid][pAdmin] < 1337)
					{
						format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to Diamond (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
						SendClientMessageEx(playerid, COLOR_LIGHTRED, string);
					}
					format(string, sizeof(string), "AdmCmd: %s has set %s's VIP level to Diamond (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 1337);
					format(string, sizeof(string), "Your VIP level has been set to Diamond by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessageEx(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) VIP level to Diamond (%d). (%d-%d-%d)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level, month,day,year);
					Log("logs/setvip.log", string);
					return 1;
				}
			}
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	}
	return 1;
}
Makeadmin doesnt work

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

		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 advisors 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;
}
or /makeleader

Код:
CMD:makeleader(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 1337)
	{
		new string[128], giveplayerid, faction;
		if(sscanf(params, "ud", giveplayerid, faction))
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeleader [playerid] [factionid]");
			SendClientMessageEx(playerid, COLOR_GRAD3, "|1 LSPD |2 FBI |3 SFPD |4 FDSA |5 Judicial System");
			SendClientMessageEx(playerid, COLOR_GRAD2, "|6 Government |7 SASD |8 Hitman |9 SA News");
			SendClientMessageEx(playerid, COLOR_GRAD1, "|10 Taxi Company |11 NG |12 Tierra Robada");
			SendClientMessageEx(playerid, COLOR_GRAD1, "|13 NOOSE");
			return 1;
		}
		if(faction > 13 || faction < 0) { SendClientMessageEx(playerid, COLOR_GREY, "   Don't go below number 0, or above number 13!"); return 1; }

		if(IsPlayerConnected(giveplayerid))
		{
			new ftext[30];
			PlayerInfo[giveplayerid][pLeader] = faction;
			PlayerInfo[giveplayerid][pRank] = 6;
			PlayerInfo[giveplayerid][pMember] = faction;
			if(PlayerInfo[giveplayerid][pLeader] == 1) { ftext = "LSPD"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 2) { ftext = "FBI"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 3) { ftext = "SFPD"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 4) { ftext = "FDSA"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 5) { ftext = "Judicial System"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 6) { ftext = "The Government"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 7) { ftext = "SASD"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 8) { ftext = "Hitman Agency"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 9) { ftext = "SA News"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 10) { ftext = "Taxi Cab Company"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 11) { ftext = "National Guard"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 12) { ftext = "Tierra Robada"; }
			else if(PlayerInfo[giveplayerid][pLeader] == 13) { ftext = "NOOSE"; }
			else { return 1; }


			format(string, sizeof(string), "You have been made the leader of the %s by Administrator %s.",ftext, GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
			format(string, sizeof(string), "You have made %s the leader of the %s.", GetPlayerNameEx(giveplayerid),ftext);
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);

			if(faction < 4 && faction > 0 || faction > 4 && faction < 7)
			{
				gTeam[giveplayerid] = 2;
				PlayerInfo[giveplayerid][pTeam] = 2;
			}
			PlayerInfo[giveplayerid][pFMember] = 255;
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	}
	return 1;
}
Them I know dont work


Re: [Help] sscanf command - sanplayer - 27.02.2012

help?


Re: [Help] sscanf command - johnnyman1 - 27.02.2012

No help, stop using NGRP's script


Re: [Help] sscanf command - sanplayer - 27.02.2012

who said anything about NGRP?

Scripts are scripts. This script was coded


Re: [Help] sscanf command - Too - 27.02.2012

Nice NGRP script bud, reported!


Re: [Help] sscanf command - Walsh - 27.02.2012

Regardless of you using NGRP's script, (which you shouldn't be) I'll still help you.

On the makeadmin command on this line below.

pawn Код:
if(sscanf(params, "ui", iTargetID, iAdminValue)) {
            SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
You need to add a return before the SendClientMessage, because I believe you need to return a value on that type of if statement like so.

pawn Код:
if(sscanf(params, "ui", iTargetID, iAdminValue)) {
            return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
If that doesn't work then that might be a message saying to stop using the NGRP script.


Re: [Help] sscanf command - new121 - 28.02.2012

Quote:
Originally Posted by Walsh
Посмотреть сообщение
If that doesn't work then that might be a message saying to stop using the NGRP script.
NGRP's script? LOL that is a God Father edit, that was edited to shit by SARP, then when the owners of SARP woudn't give in to the co owner's demands they simply stole it, they had their scripters rewrite it to be EXACTLY the same, because at the time the owner of SARP kept hacking it. So they are using an edit of a stolen script yet expect others not to use their leaked script?


Re: [Help] sscanf command - Walsh - 28.02.2012

Quote:
Originally Posted by new121
Посмотреть сообщение
NGRP's script? LOL that is a God Father edit, that was edited to shit by SARP, then when the owners of SARP woudn't give in to the co owner's demands they simply stole it, they had their scripters rewrite it to be EXACTLY the same, because at the time the owner of SARP kept hacking it. So they are using an edit of a stolen script yet expect others not to use their leaked script?
You have no clue on what you are talking about. Btw that is an off-topic post.