SA-MP Forums Archive
warning 202: 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: warning 202: number of arguments does not match definition (/showthread.php?tid=549572)



warning 202: number of arguments does not match definition - kampuman - 07.12.2014

I'm trying to put a string inside a dialog. can you please help me a little? thank you!

Код:
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{00CC66}Account Login", "Type your password below to login your account \n\nName: %s(%d)", "Login", "Rename",GetName(playerid), playerid);



Re: warning 202: number of arguments does not match definition - welderlourenco - 07.12.2014

Hello kampuman, as long as I know you need to use the format() function to format the string before pass it to the ShowPlayerDialog function, example:

new string[128];

format(string, sizeof(string), "Type your password below to login your account \n\nName: %s(%d)", GetName(playerid), playerid);

ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{00CC66}Account Login", string, "Login", "Rename");

ps.: The error (number of arguments does not match definition) means that the ShowPlayerDialog expects 7 params and you passed 9 ....


Re: warning 202: number of arguments does not match definition - kampuman - 07.12.2014

Quote:
Originally Posted by welderlourenco
Посмотреть сообщение
Hello kampuman, as long as I know you need to use the format() function to format the string before pass it to the ShowPlayerDialog function, example:

new string[128];

format(string, sizeof(string), "Type your password below to login your account \n\nName: %s(%d)", GetName(playerid), playerid);

ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{00CC66}Account Login", string, "Login", "Rename");

ps.: The error (number of arguments does not match definition) means that the ShowPlayerDialog expects 7 params and you passed 9 ....
wow thanks mate! yes its working good. but I'm having problem after adding GetIp(playerid), the ip is not showing from the dialog

Код:
	new string[128];
	format(string, sizeof(string), "Type your password below to login your account \n\nName: %s (%d) \nIP: %s", GetName(playerid), playerid), GetIp(playerid);
	ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{00CC66}Account Login", string, "Login", "Rename");
    return 1;



Re: warning 202: number of arguments does not match definition - welderlourenco - 07.12.2014

Hello again, use the GetPlayerIp(playerid, name[], len) https://sampwiki.blast.hk/wiki/GetPlayerIp to get the ip address from a player. The second parameter is the variable name where to store the player ip, passed by reference.

new ip[15], string[128];

GetPlayerIp(playerid, ip, sizeof(ip));

format(string, sizeof(string), "Type your password below to login your account \n\nName: %s (%d) \nIP: %s", GetName(playerid), playerid, ip);

ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{00CC66}Account Login", string, "Login", "Rename");


Re: warning 202: number of arguments does not match definition - kampuman - 07.12.2014

Quote:
Originally Posted by welderlourenco
Посмотреть сообщение
Hello again, use the GetPlayerIp(playerid, name[], len) https://sampwiki.blast.hk/wiki/GetPlayerIp to get the ip address from a player. The second parameter is the variable name where to store the player ip, passed by reference.

new ip[15], string[128];

GetPlayerIp(playerid, ip, sizeof(ip));

format(string, sizeof(string), "Type your password below to login your account \n\nName: %s (%d) \nIP: %s", GetName(playerid), playerid, ip);

ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{00CC66}Account Login", string, "Login", "Rename");
YES! Good job mate! It's all working nice. Hope you can still help me next time I gave you +rep but I think it wont show up until I get 25+ posts lol.