[Help] Params[]
#1

Im trying to make a "%s Is not a valid server command, Type bla bla bla bla", but how can I get the argument %s?

Example, if someone tipes "/aasda", a message will say "/aasda Is not a valid server command, Type bla bla bla bla".

Thanks
Reply
#2

Use cmdtext (or param or whatever you use for your commands)?
Reply
#3

At the very end of "OnPlayerCommandText" you simply format a string with your message and let it send to the client.
Reply
#4

I have this:
pawn Код:
new string[128];//var = params[];
  format(string, sizeof(string),"~r~ %s Unknown server command.~n~~n~~w~Type ~g~/commands ~w~for a full commands list.");//,var);
  GameTextForPlayer(playerid,string,8500,3);
If I uncomment I get error
Quote:

undefined symbol "params"

Reply
#5

It s "public OnPlayerCommandText(playerid, cmdtext[])"

cmdtext is the array you look for, not params.
Reply
#6

Example (for OnPlayerCommandText):
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  // commands..
  new
      string[128];
  format(string, sizeof(string), "~r~%s Unknown server command.~n~~n~~w~Type ~g~/commands ~w~for a full command list.", cmdtext);
  return GameTextForPlayer(playerid, string, 8500, 3);
}
Reply
#7

Quote:
Originally Posted by Don Correlli
Example (for OnPlayerCommandText):
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  // commands..
  new
      string[128];
  format(string, sizeof(string), "~r~%s Unknown server command.~n~~n~~w~Type ~g~/commands ~w~for a full command list.", cmdtext);
  return GameTextForPlayer(playerid, string, 8500, 3);
}
You took a doubt from me

Thanks !
Reply
#8

though: if you put the whole command with the parameters, you will see the parameters too, so you would need to cut it off if you dont want that. Just a suggestion.
Reply
#9

Quote:
Originally Posted by mamoru
though: if you put the whole command with the parameters, you will see the parameters too, so you would need to cut it off if you dont want that. Just a suggestion.
Its fine like that ^^

Thanks anyway
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)