how do you make /commands and /help
#1

I want to make something where when someone types /commands it will show up the available commands and what they do. Also, when they type /help it shows stuff like Rules, how to access commands, and the website to the server. how can i do this. P.S. I'm a total noob at scripting so keep it simple.
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[] )
{
   if (strcmp(cmdtext, "/commands", true) == 0)
   {
SendClientMessage(playerid, 0xEFEFF7AA, "List of Commands: /chicken /pants /salmonisawesome");
     return 1;
   }


 
   return 0;
}
Reply
#3

That helps with part of it. but i wanted to also add a /help, /forums, and /rules. and when i use that same form of code it says there is already an onplayercommand text. then when i remove all the onplayercommandtexts so only the first one of that kind has the code (the rest has everything after that) I then change return 0 to return 1's until the last one so the code continues. But then it keeps saying the compount statement is not closed at the end of the line. HELP?
Reply
#4

public OnPlayerCommandText(playerid, cmdtext[] )
{

if (strcmp(cmdtext, "/commands", true) == 0)
{
SendClientMessage(playerid, 0xEFEFF7AA, "List of Commands: /rules /gunnerzisawesome");
return 1;
}


if (strcmp(cmdtext, "/rules", true) == 0)
{
SendClientMessage(playerid, 0xEFEFF7AA, "This would be the rules.");
SendClientMessage(playerid, 0xEFEFF7AA, "First Rule: You do not talk about Fight Club");
SendClientMessage(playerid, 0xEFEFF7AA, "Second Rule: You do NOT talk about Fight Club");
SendClientMessage(playerid, 0xEFEFF7AA, "Third Rule: If someone says "Stop" or goes limp, taps out the fight is over.");

return 1;
}


return 0;
}
Reply
#5

Download a script like LVDMOD and look how they did it with strtok. It makes it easier for commands that need multiple parameters, like /kick [id] [reason] etc..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)