number of arguments does not match definition
#1

Hi i'm bigginer scripter today i wanted to try to add when i /streamforall a text that shows who put the song but i kepp getting this warning > warning 202: number of arguments does not match definition

Код:
CMD:streamforall(playerid,params[])
{
 	if(PlayerInfo[playerid][pAdmin] >= 4){
	    new url[200];
		if(sscanf(params,"s[200]", url)) return SendClientMessage(playerid, -1,"{FF0000}Syntax: /streamforall [url]{FF0000}");
	    for(new i = 0; i < MAX_PLAYERS; i++)
        format(string, sizeof(string), "Song Played by %s. \nType /stopplay to stop the music", GetPlayerName(playerid));
		{
        PlayAudioStreamForPlayer(i, url);
		}
	}else{
		SendClientMessage(playerid, -1, "   {FF0000}Error:{FF0000} {FFFFFF}You are not authorized to use this command!{FFFFFF}");
	}
	return 1;
}
Код:
Warning in : format(string, sizeof(string), "Song Played by %s. \nType /stopplay to stop the music", GetPlayerName(playerid));
Reply
#2

GetPlayerName is suppose to be outside of format, and this is how you should be using it:

PHP код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playeridnamesizeof(name));
format(stringsizeof(string), "Song Played by %s. \nType /stopplay to stop the music"name); 
Reply
#3

I dont see the warning no more after this but the text wont show ig when i tested it plz help
Reply
#4

Hello.

You don't send the message to the player(s).
Try this.
PHP код:
CMD:streamforall(playerid,params[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 4)
    {
        new 
url[200],name[MAX_PLAYER_NAME];
        if(
sscanf(params,"s[200]",url))return SendClientMessage(playerid,-1,"{FF0000}Syntax: /streamforall [url]");
        
GetPlayerName(playerid,name,sizeof(name));
        
format(string,sizeof(string),"Song Played by %s.\tType /stopplay to stop the music",name);
        
SendClientMessage(playerid,-1,string);
        for(new 
i;i<MAX_PLAYERS;i++)
        {
            if(!
IsPlayerConnected(i) || IsPlayerNPC(i))continue;
            
PlayAudioStreamForPlayer(i,url);
        }
    }
    else
    {
        
SendClientMessage(playerid,-1,"{FF0000}Error:{FFFFFF} You are not authorized to use this command!");
    }
    return 
1;

Reply
#5

Thnx Man it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)