[Tutorial] [TUT] How to add a message when the command is wrong
#21

It's
return SendClientMessage(playerid, COLOR_ORANGE, "Command does not exist please use /help");

you need one S more in Message =D
Reply
#22

for zcmd.....
Just add these somewhere in GM

Code:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    return 	SendClientMessage(playerid, 0xFF0000FF, "Wrong command?USE /HELP");
}
Hope its helped and i use zcmd+sscanf
Reply
#23

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/heal", cmdtext, true, 10) == 0)
{
if(!GetPlayerMoney(playerid) => 500) return SendClientMessage(playerid, COLOR_RACE, "You don't have enough $ to heal.");
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, COLOR_RACE, "Healed for 500$.");
SetPlayerHealth(playerid, 100);
return 1;
}

return SendClientMesage(playerid, COLOR_ORANGE, "Command does not exist please use /help");
}
Yoan try this ok, it might work.
Reply
#24

Quote:
Originally Posted by Thebest96
View Post
N00b tuturial dont helped in nothing, ohhh helped in CRASH MY SCRIPT!
Then you fail because this works fine.
Reply
#25

this suc*s my a**..

Tell something for zcmd`s?
Reply
#26

at the end of "public onplayercommandtext" I have return 1, no return 0

/imageshack/i/62629366.png/

/imageshack/i/49390728.png/
Reply
#27

ZCMD has 2 callbacks which could be used for returning an incorrect command message.

pawn Code:
OnPlayerCommandPerformed(...) and OnPlayerCommandReceived(...)
Reply
#28

He wrote SendClientMesage
Instead of SendClientMessage

Only problem I received.
Reply
#29

There's already a tutorial like this...
Reply
#30

Quote:
Originally Posted by yoan103
View Post
OK but does it work for the people that are using normal commands?
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/heal", cmdtext, true, 10) == 0)
{
if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, COLOR_RACE, "You don't have enough $ to heal.");
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, COLOR_RACE, "Healed for 500$.");
SetPlayerHealth(playerid, 100);
return 1;
}

return SendClientMesage(playerid, COLOR_ORANGE, "Command does not exist please use /help");
}
You can also add this messege down so you add it at every cmd :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)