SA-MP Forums Archive
Errors on commands - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Errors on commands (/showthread.php?tid=270347)



Errors on commands - slymatt - 20.07.2011

The error is:
Код:
C:\Users\mattt\Desktop\New\gamemodes\arrp.pwn(348) : error 017: undefined symbol "dcmd_ahelp"
C:\Users\mattt\Desktop\New\gamemodes\arrp.pwn(349) : error 017: undefined symbol "dcmd_sethp"
C:\Users\mattt\Desktop\New\gamemodes\arrp.pwn(383) : error 017: undefined symbol "dcmd_ahelp"
C:\Users\mattt\Desktop\New\gamemodes\arrp.pwn(390) : error 017: undefined symbol "dcmd_sethp"
on these lines:
Код:
dcmd(stats, 5, cmdtext);
dcmd(ahelp, 5, cmdtext);
dcmd(sethp, 5, cmdtext);

dcmd_ahelp(playerid, params[])
{
SendClientMessage(playerid, COLOUR_YELLOW, "TEST: /SETHP || /GETCAR || /COMEHERE || /GOTO");
SendClientMessage(playerid, COLOUR_YELLOW, "TEST: /SETSKIN || /GIVECASH || /GIVEWEAPON || /FREEZE");
SendClientMessage(playerid, COLOUR_YELLOW, "TEST: /UNFREEZE || /CHANGENAME || /KICK || /BAN");
}

dcmd_sethp(playerid, params[])
{
SetPlayerHealth(playerid, 100);
}
But it doenst pick up an error on this one which i have used:
Код:
	
dcmd(stats, 5, cmdtext);
if that makes sence thanks for the help


Re: Errors on commands - [HiC]TheKiller - 20.07.2011

OK, here are a few errors in your code.

1. You should return a value on your DCMD commands.
2. You can just use strcmp if you don't need params
3. The errors are because you are not putting the dcmd things in the right place.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(stats, 5, cmdtext);
    dcmd(ahelp, 5, cmdtext);
    dcmd(sethp, 5, cmdtext);
    return 0;
}
Also make sure that you have the define line for DCMD.