Very simple Question( Rep+ ) - 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)
+--- Thread: Very simple Question( Rep+ ) (
/showthread.php?tid=297584)
Very simple Question( Rep+ ) -
Azzeto - 16.11.2011
1.
How do I make it so I can use for example strcmp on /help so thered be /help and it'd show three options, General, Commands, Admins, then the player would type /help commands or /help admins etc I know i'd have to use strcmp I just dont know how.
Re: Very simple Question( Rep+ ) -
antonio112 - 16.11.2011
pawn Код:
YCMD:help(playerid, help, params)
{
if(strcmp(params, "commands", false) == 0)
{
SendClientMessage(playerid, -1, "Help commands here.");
return 1;
}
else if(strcmp(params, "admin", false) == 0)
{
SendClientMessage(playerid, -1, "Admin help here.");
return 1;
}
else
{
SendClientMessage(playerid, -1, "Usage: /help [parameter] (commands, admin)");
return 1;
}
Re: Very simple Question( Rep+ ) -
SmiT - 16.11.2011
pawn Код:
CMD:help(playerid, params[])
{
if ( isnull ( params ) ) return SendClientMessage( playerid, -1, #Usage /help <commands, admins, general> );
if ( !strcmp ( params, "commands" ) )
{
// do your code
}
else if ( !strcmp ( params, "admins" ) )
{
// do your code
}
else
{
SendClientMessage( playerid, -1, #Unknown parameter );
}
return 1;
}
Re: Very simple Question( Rep+ ) -
Azzeto - 16.11.2011
Quote:
Originally Posted by antonio112
pawn Код:
YCMD:help(playerid, help, params) { if(strcmp(params, "commands", false) == 0) { SendClientMessage(playerid, -1, "Help commands here."); return 1; } else if(strcmp(params, "admin", false) == 0) { SendClientMessage(playerid, -1, "Admin help here."); return 1; } else { SendClientMessage(playerid, -1, "Usage: /help [parameter] (commands, admin)"); return 1; }
|
Now can you please explain what the STRCMP does, like what does the false and ==0 mean?
Re: Very simple Question( Rep+ ) -
FireCat - 16.11.2011
Quote:
Originally Posted by Azzeto
Now can you please explain what the STRCMP does, like what does the false and ==0 mean?
|
strcmp = string compare
0 = if they match.
https://sampwiki.blast.hk/wiki/Strcmp