Posts: 3,793
Threads: 196
Joined: Jan 2010
Reputation:
0
Hey guys could you give me an example of how a command would be like if i made a command, let say:
/admin [parameter 1] [value]
/admin announce Hello world!
/admin hi // sends a client message to player, HI.
I haven't really learn't the parameters to commands that much and are willing to learn how to do this, using sscanf.
Posts: 649
Threads: 4
Joined: Jul 2010
what processor of commands you use ?
Posts: 3,793
Threads: 196
Joined: Jan 2010
Reputation:
0
ZCMD
This might be a big ass noob question although i never have exprienced this with sscanf only the default natives :O
Posts: 649
Threads: 4
Joined: Jul 2010
try this.
pawn Код:
new string[100];
CMD:admin(playerid, params[])
{
static iStr[128], player, name[24],i[30];
if(sscanf(params[], "uss",player, i,iStr)) return false;
if(!strcmp(i,"hi", true))
{
format(string, sizeof(string),"This admin %s says for you %s",GetPlayerName(playerid, name, 24), iStr);
SendClientMessage(player, COLOR_MSG,string);
format(string, sizeof(string),"You send %s to %s",iStr, GetPlayerName(player, name, 24);
SendClientMessage(playerid, COLOR_MSG, string);
}
if(!strcmp(i,"ann", true))
{
if(sscanf(params[] "s",iStr)) return false;
format(string, sizeof(string),"%s says:%s",GetPlayerName(player, name, 24),iStr);
SendClientMessageToAll(COLOR_MSG, string);
}
return 1;
}
using sscanf.
Posts: 3,793
Threads: 196
Joined: Jan 2010
Reputation:
0
don't worry i got something working, Ill try those even though later.
Thanks.