number of arguments does not match definition - 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: number of arguments does not match definition (
/showthread.php?tid=618875)
number of arguments does not match definition -
XSharkX - 10.10.2016
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));
Re: number of arguments does not match definition -
SickAttack - 10.10.2016
GetPlayerName is suppose to be outside of
format, and this is how you should be using it:
PHP код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Song Played by %s. \nType /stopplay to stop the music", name);
Re: number of arguments does not match definition -
XSharkX - 10.10.2016
I dont see the warning no more after this but the text wont show ig when i tested it plz help
Re: number of arguments does not match definition -
Mencent - 10.10.2016
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;
}
Re: number of arguments does not match definition -
XSharkX - 10.10.2016
Thnx Man it works