sscanf instead of strcmp?
#1

Ahoy friends.

Thats the command i have

Код:
if(strcmp(cmd, "/checkmoney", true) == 0)
	{
		if(IsPlayerAdmin(playerid))
		{
			new targetplayer;
			new tname[144];
			if(sscanf(cmdtext[strlen("/checkmoney")+1], "u", targetplayer))
			return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /checkmoney [playerid]");
			if(!IsPlayerConnected(targetplayer))
			return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
			if(gPlayerHasTeamSelected[targetplayer] == -1)
			return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player is still in team selection!");
			GetPlayerName(targetplayer,tname,sizeof(tname));
			SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Player %s(%d) is in posession of $%d at this moment",tname,targetplayer,GetPlayerMoney(targetplayer));
		}	
	}
Is it possible to use sscanf instead of strcmp to check if the entered string matches?

Like

Код:
new targetplayer;
if(sscanf(cmdtext[strlen("/checkmoney")+1], "u", targetplayer))
	{
		if(IsPlayerAdmin(playerid))
		{
			new targetplayer;
			new tname[144];

			
			if(!IsPlayerConnected(targetplayer))
			return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected");
			if(gPlayerHasTeamSelected[targetplayer] == -1)
			return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player is still in team selection!");
			GetPlayerName(targetplayer,tname,sizeof(tname));
			SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Player %s(%d) is in posession of $%d at this moment",tname,targetplayer,GetPlayerMoney(targetplayer));
		}	
	}
else
{
return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /checkmoney [playerid]");
}
Reply


Messages In This Thread
sscanf instead of strcmp? - by faxxe - 06.04.2017, 19:50
Re: sscanf instead of strcmp? - by AbyssMorgan - 06.04.2017, 19:57

Forum Jump:


Users browsing this thread: 1 Guest(s)