PDA

View Full Version : 2 problems.


Addons
20/07/2013, 03:27 PM
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! :)

arakuta
20/07/2013, 04:49 PM
I've seen something about dcmd_cmdname at OnPlayerCommandText...
By the way, why not try ZCMD easier and faster

Addons
20/07/2013, 05:34 PM
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?

Lordzy
20/07/2013, 05:38 PM
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'?

Addons
20/07/2013, 05:53 PM
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

morocco
20/07/2013, 05:57 PM
Add


public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(heal, 4, cmdtext);



+ if you don't know this number "4"
EX : heal = 4
hheal = 5

Number of characters

morocco
20/07/2013, 05:59 PM
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> ?

Addons
20/07/2013, 06:15 PM
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[])