/clan invite [id]
#1

Why does this code sends me nothing, even a message?
INPUT: /clan invite
OUTPUT: USAGE: /clan invite [id]

INPUT: /clan invite 0
OUTPUT: Nothing

INPUT: /clan invite Player
OUTPUT: Nothing

Код:
CMD:clan(playerid, params[])
{
	new type[128];
	if(sscanf(params,"s[128]",type)) return SendClientMessage(playerid, -1, ""COL_GRAY"USAGE: /clan [create/leave/help]");
	if(!strcmp(type, "invite"))
	{
	    new id, string[128];
		if(sscanf(params,"s[128]u",type,id)) return SendClientMessage(playerid, -1, ""COL_GRAY"USAGE: /clan invite [id/part of name]");
		format(string, sizeof(string), ""COL_GRAY"You have been invited to join '%s (%d)'. To join them, please use /clan join.", GetPlayerClanName(playerid), GetPlayerClanID(playerid));
		SendClientMessage(id, -1, string);
	}
        return 1;
}
Reply
#2

why u use "type" with the playerid?

try without that;


Код:
CMD:clan(playerid, params[])
{
	new type[128];
	if(sscanf(params,"s[128]",type)) return SendClientMessage(playerid, -1, ""COL_GRAY"USAGE: /clan [create/leave/help]");
	if(!strcmp(type, "invite"))
	{
	    new id, string[128];
		if(sscanf(params,"u",id)) return SendClientMessage(playerid, -1, ""COL_GRAY"USAGE: /clan invite [id/part of name]");
		format(string, sizeof(string), ""COL_GRAY"You have been invited to join '%s (%d)'. To join them, please use /clan join.", GetPlayerClanName(playerid), GetPlayerClanID(playerid));
		SendClientMessage(id, -1, string);
	}
        return 1;
}
Reply
#3

I tried your code now it gives me the message when I type /clan invite.
If I do not type /clan invite, does show nothing.
Reply
#4

I've fixed the cmd, try again
Reply
#5

I find this way easier:
PHP код:
CMD:clan(playeridparams[])
{
    new 
idcl_name[16]; // change "16" to the max size you have for clan's name
    
if (!sscanf(params"'create's[16]"cl_name))
    {
        
// command: "/clan create <clan name>"
    
}
    else if (!
sscanf(params"'invite'r"id))
    {
        
// command: "/clan invite <ID/Part Of Name>"
    
}
    else if (!
strcmp(params"leave"true))
    {
          
// command: "/clan leave"
    
}
    else if (!
strcmp(params"help"true))
    {
          
// command: "/clan help"
    
}
    else 
SendClientMessage(playerid, -1""COL_GRAY"USAGE: /clan [create/leave/help]"), SendClientMessage(playerid, -1""COL_GRAY"USAGE: /clan invite [id/part of name]");
    return 
1;

In case you do /clan create and a dialog or something appears to input, then change to strcmp instead of sscanf for that type.
Reply
#6

Thank you!
Reply
#7

BTW where do I put "USAGE: /clan invite [id]" when the user inputs wrong parameter?
Reply
#8

Bump
Reply
#9

i see it at the last of his code check it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)