SA-MP Forums Archive
/clan invite [id] - 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: /clan invite [id] (/showthread.php?tid=607472)



/clan invite [id] - TheSimpleGuy - 20.05.2016

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;
}



Respuesta: /clan invite [id] - Thewin - 20.05.2016

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;
}



Re: /clan invite [id] - TheSimpleGuy - 20.05.2016

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.


Respuesta: /clan invite [id] - Thewin - 20.05.2016

I've fixed the cmd, try again


Re: /clan invite [id] - Konstantinos - 20.05.2016

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.


Re: /clan invite [id] - TheSimpleGuy - 20.05.2016

Thank you!


Re: /clan invite [id] - TheSimpleGuy - 20.05.2016

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


Re: /clan invite [id] - TheSimpleGuy - 21.05.2016

Bump


Re: /clan invite [id] - Naresh - 21.05.2016

i see it at the last of his code check it