[Help] - Using params under "OnPlayerCommandReceived" -
nGen.SoNNy - 08.04.2013
Hi guys! I need to use a command with params. So, if i type just /arrest i will get the message with "usage: /arrest id but if i type: /arest id:9 for example, i will get that message with /leave - for exit... Also if you guys have a better idea to make these commands work under this
if ( PlayerInfo[ playerid ][ ActionID ] == 8 ) ...
pawn Код:
public OnPlayerCommandReceived( playerid, cmdtext[ ] )
{
if ( PlayerInfo[ playerid ][ ActionID ] == 8 )
{
if ( !strcmp( cmdtext, "/leave", true ) || !strcmp( cmdtext, "/arrest", true ) || !strcmp( cmdtext, "/neon", true ) || !strcmp( cmdtext, "/radio", true ) ) return ( 1 );
Announce( playerid, "~g~~h~Use ~r~~h~/leave ~g~~h~for exit.", 3000, 4 );
return ( 0 );
}
}
Re: [Help] - Using params under "OnPlayerCommandReceived" -
RajatPawar - 08.04.2013
Erm?
pawn Код:
CMD:arrest(playerid, params[])
{
if ( PlayerInfo[ playerid ][ ActionID ] == 8 ) return 1; // Or error message
else
{
// All working code
}
return 1;
This? Or did I misunderstand something?
Re: [Help] - Using params under "OnPlayerCommandReceived" -
nGen.SoNNy - 09.04.2013
You don't understand... i want to include that command in this
if ( !strcmp( cmdtext, "/ar", true ) but if i add params to the command don't work... without params everything it's ok!
Re: [Help] - Using params under "OnPlayerCommandReceived" -
Vince - 09.04.2013
What Rajat_Pawar is saying is: Why do you use strcmp commands when you already have ZCMD?
Re: [Help] - Using params under "OnPlayerCommandReceived" -
nGen.SoNNy - 09.04.2013
Shit

I don't use STRCMP commands

I'm using this callback
public OnPlayerCommandReceived( playerid, cmdtext[ ] ) to check what command was used by player, and then if player it's in a minigame...a message with "~g~~h~Use ~r~~h~/leave ~g~~h~for exit." will appear ...
Re: [Help] - Using params under "OnPlayerCommandReceived" -
Isolated - 09.04.2013
you could always try sscanf, if I'm understanding correctly, if not then I'm very sorry.
Re: [Help] - Using params under "OnPlayerCommandReceived" -
nGen.SoNNy - 09.04.2013
Using sscanf instead of this? if ( !strcmp( cmdtext, "/leave", true ) ) ??
Re: [Help] - Using params under "OnPlayerCommandReceived" -
Isolated - 09.04.2013
Yeah, sorry, I told you I didn't understand

, put, something like
pawn Код:
new Params;
sscanf(cmdtext, "s", Params))
Re: [Help] - Using params under "OnPlayerCommandReceived" -
greentarch - 09.04.2013
Thanks to Romel for correcting this.
@MikeLovesToHelp, I think you should make the Params like
But I think with sscanf that will still not work, that's just my thinking
-------
OT:
I get what you meant, maybe use
strfind? ( I know, this is a stupid idea, but why not try? )
Re: [Help] - Using params under "OnPlayerCommandReceived" -
JaKe Elite - 09.04.2013
first of all greentarch.
Params is not a integer.
If string doesn't have sizes putted on, only something like params[].
Doesn't mean it is a integer.