Optinal multi params command using sscanf
#7

ok i made it like this

Код:
CMD:slap(playerid, params[])
{
	    if(sscanf(params, "uS[128]", pid, creason)) return SendClientMessage(playerid, Grey, "Usage:/slap <id> <reason>");
	    if(isnull(creason))
	    {
			GetPlayerPos(pid, X, Y, Z);
			SetPlayerPos(pid, X, Y, Z+6);
			new Float:Health;
			GetPlayerHealth(pid,Health);
			SetPlayerHealth(pid,Health-20);
			PlayerPlaySound(playerid,1190,0.0,0.0,0.0);
			PlayerPlaySound(pid,1190,0.0,0.0,0.0);
			GetPlayerName(playerid, pname, 24);
			GetPlayerName(pid, gname, 24);
			format(sc, sizeof(sc), "AdmCmd:%s(%d) Was slapped by admin %s reason: Not specified", gname, pid, pname);
			SendClientMessageToAll(Red, sc);
		}
		else
		{
			GetPlayerPos(pid, X, Y, Z);
			SetPlayerPos(pid, X, Y, Z+6);
			new Float:Health;
			GetPlayerHealth(pid,Health);
			SetPlayerHealth(pid,Health-20);
			PlayerPlaySound(playerid,1190,0.0,0.0,0.0);
			PlayerPlaySound(pid,1190,0.0,0.0,0.0);
			GetPlayerName(playerid, pname, 24);
			GetPlayerName(pid, gname, 24);
			format(sc, sizeof(sc), "AdmCmd:%s(%d) Was slapped by admin %s reason: %s", gname, pid, pname, creason);
			SendClientMessageToAll(Red, sc);
		}
	return 1;
}
but when i do /slap 0 <dontdo>

it do the slap cmd with reason dondo

but when i do /slap 0 after the cmd above

its the same

* Kyro slaps 0 around a bit with a large trout.

slap cmd with reason : <the same reason i wrote in /slap 0 <donto>

why?
Reply


Messages In This Thread
Optinal multi params command using sscanf - by Kyro - 12.03.2011, 12:26
Re: Optinal multi params command using sscanf - by JamesC - 12.03.2011, 12:28
Re: Optinal multi params command using sscanf - by Kyro - 12.03.2011, 12:34
Re: Optinal multi params command using sscanf - by JamesC - 12.03.2011, 12:46
Re: Optinal multi params command using sscanf - by Kyro - 12.03.2011, 12:52
Re: Optinal multi params command using sscanf - by JamesC - 12.03.2011, 12:56
Re: Optinal multi params command using sscanf - by Kyro - 12.03.2011, 13:12
Re: Optinal multi params command using sscanf - by Kyro - 12.03.2011, 13:41
Re: Optinal multi params command using sscanf - by HyperZ - 12.03.2011, 14:08
Re: Optinal multi params command using sscanf - by Kyro - 12.03.2011, 14:15

Forum Jump:


Users browsing this thread: 4 Guest(s)