[Help] Params[] - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Params[] (
/showthread.php?tid=126633)
[Help] Params[] -
Fedee! - 09.02.2010
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
Re: [Help] Params[] -
Correlli - 09.02.2010
Use cmdtext (or param or whatever you use for your commands)?
Re: [Help] Params[] -
ray187 - 09.02.2010
At the very end of "OnPlayerCommandText" you simply format a string with your message and let it send to the client.
Re: [Help] Params[] -
Fedee! - 09.02.2010
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"
|
Re: [Help] Params[] -
ray187 - 09.02.2010
It s "public OnPlayerCommandText(playerid, cmdtext[])"
cmdtext is the array you look for, not params.
Re: [Help] Params[] -
Correlli - 09.02.2010
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);
}
Re: [Help] Params[] -
Fedee! - 09.02.2010
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 !
Re: [Help] Params[] -
mamorunl - 09.02.2010
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.
Re: [Help] Params[] -
Fedee! - 09.02.2010
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