SA-MP Forums Archive
2 problems. - 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: 2 problems. (/showthread.php?tid=452224)



2 problems. - Addons - 20.07.2013

Hi all.

I've some problems in scripting. Namely, with dcmd & unknow command.

1. Dcmd: so, if I adding this command:
Код:
dcmd_heal(playerid, params[])
{
        new id;
	if (!strlen(params)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
	id = strval(params);
	if (!IsPlayerConnected(id))SendClientMessage(playerid, 0xFF0000AA, "Player not found");
	SetPlayerHealth(id, 100.0);
	SendClientMessage(id, 0x00FF00AA, "You have been healed");
	SendClientMessage(playerid, 0x00FF00AA, "Player healed");
	return 1;
}
i've got this error:
"undefined symbol dcmd_heal"

PS: I added
Код:
#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
2: Unknow command: so, i tried to add this script:
Код:
 	return SendClientMessage(playerid, COLOR_WHITE, "{FFA500}Info: {FFFFFF}Unavailable command! Use /help!");
}
after callback OnPlayerCommandReceived (accurate, under return), but when i use some commands (/sm, /pay), this message appears, although commands are included in callback OnPlayerCommandsReceived.

@ Sorry for my (very) bad english!


Re: 2 problems. - arakuta - 20.07.2013

I've seen something about dcmd_cmdname at OnPlayerCommandText...
By the way, why not try ZCMD easier and faster


Re: 2 problems. - Addons - 20.07.2013

I know that zcmd is much easier and faster, but my filterscript is in DCMD and i want to put it in gamemode.

@ Do you know a converter?


Re: 2 problems. - Lordzy - 20.07.2013

Quote:
Originally Posted by Addons
Посмотреть сообщение
I know that zcmd is much easier and faster, but my filterscript is in DCMD and i want to put it in gamemode.

@ Do you know a converter?
How about using "CTRL+H" and then converting every "dcmd_" to "CMD:" and removing the dcmd_ additional calls under 'OnPlayerCommandText'?


Re: 2 problems. - Addons - 20.07.2013

So easy. I try to add this command (for testing):
Код:
CMD:buycar(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
		else return SendClientMessage(playerid, -1, "TEST");
	}
	return 1;
}
and i get this error:
symbol "buycar" is never used


Re: 2 problems. - morocco - 20.07.2013

Add

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(heal, 4, cmdtext);
+ if you don't know this number "4"
EX : heal = 4
hheal = 5

Number of characters


Re: 2 problems. - morocco - 20.07.2013

Quote:
Originally Posted by Addons
Посмотреть сообщение
So easy. I try to add this command (for testing):
Код:
CMD:buycar(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
		else return SendClientMessage(playerid, -1, "TEST");
	}
	return 1;
}
and i get this error:
symbol "buycar" is never used
Do you have add

#include <ZCMD> ?


Re: 2 problems. - Addons - 20.07.2013

EDIT: I've added command at "OnPlayerCommandText" and i've got these errors:
Код:
G:\PROFEG RPG\PROFEG RPG\PROFEG RPG\gamemodes\gf.pwn(26071) : warning 217: loose indentation
G:\PROFEG RPG\PROFEG RPG\PROFEG RPG\gamemodes\gf.pwn(26071) : error 029: invalid expression, assumed zero
G:\PROFEG RPG\PROFEG RPG\PROFEG RPG\gamemodes\gf.pwn(26071) : error 017: undefined symbol "cmd_buycar"
G:\PROFEG RPG\PROFEG RPG\PROFEG RPG\gamemodes\gf.pwn(26071) : error 029: invalid expression, assumed zero
G:\PROFEG RPG\PROFEG RPG\PROFEG RPG\gamemodes\gf.pwn(26071) : fatal error 107: too many error messages on one line
26071: CMD:buycar(playerid, params[])