Need help with dcmd and sscanf
#1

So guys, I realized I had to learn dcmd and sscanf to script this shit properly.

Anyway, I followed the instructions on the wiki about dcmd the best I could, here's what I got:

Under my includes(tried under my color defines too):
Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Under OnPlayerCommandText:
Код:
	dcmd(kill, 4, cmdtext);
	dmcd(slap, 4, cmdtext);
Bottom of script(outside any other function):
Код:
dcmd_kill(playerid, params[])
{
	DidKill[playerid] = 1;
	SetPlayerHealth(playerid, 0);
	SendClientMessage(playerid, COLOR_ORANGE, "You committed suicide.");
	return 1;
}

dcmd_slap(playerid, params[])
{
	new id;
	if(strlen(params))
	{
	    id = strval(params);
	    if(IsPlayerConnected(id))
	    {
	        if(PlayerInfo[playerid][AdminLevel] > 1)
	        {
				new Float:px, Float:py, Float:pz;
				GetPlayerPosition(playerid, px, py, pz);
				SetPlayerPosition(playerid, px, py, pz+15);
				SendClientMessage(playerid,
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
			}
		}
		else
		{
		    SendClientMessage(playerid, COLOR_GREY, "Invalid Player ID.");
		}
	}
	else
	{
	    SendClientMessage(playerid, COLOR_GREY, "Usage: /slap (playerid)"
	}
	return 1;
}
Here's the errors I get:

Quote:

C:\Program Files (x86)\Rockstar Games\GTA San Andreas\ServerScript\pawno\edited.pwn(1421) : error 017: undefined symbol "dmcd"
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\ServerScript\pawno\edited.pwn(2081) : warning 203: symbol is never used: "params"
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\ServerScript\pawno\edited.pwn(2120) : warning 203: symbol is never used: "dcmd_slap"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Could someone explain what I did wrong?


Also, I read about sscanf on the wiki as well. But I'm still not sure how to use it. If there is a tutorial somewhere, or someone would like to give me a brief and basic one, I'd be really happy.

Final question: Even with dcmd, the best I can do with commands is 1 parameter. Like /slap (ID). With trouble, I could do something like /spray (color 1) (color2). But how do I make a command with, say, 4 parameters? Like /ajail (ID/name) (time) (cell) (reason)?

Thanks for any help.
Reply


Messages In This Thread
Need help with dcmd and sscanf - by CrucixTM - 10.09.2010, 13:04
Re: Need help with dcmd and sscanf - by PinkFloydLover - 10.09.2010, 13:12
Re: Need help with dcmd and sscanf - by CrucixTM - 10.09.2010, 13:16
Re: Need help with dcmd and sscanf - by CrucixTM - 10.09.2010, 13:18
Re: Need help with dcmd and sscanf - by PinkFloydLover - 10.09.2010, 13:42
Re: Need help with dcmd and sscanf - by CrucixTM - 10.09.2010, 13:47

Forum Jump:


Users browsing this thread: 1 Guest(s)