Code Error Need help -
Rockyyy - 06.01.2016
Hey, I need help with this error , Thx
Код:
(4578) : warning 202: number of arguments does not match definition
Код:
format(string, sizeof(string), "%s have won the duel against opponent %s [weapon: %s, bet: $%i]", GetPlayerName(gDuel[playerid][d_opponent]), GetPlayerName(playerid), GetWeaponName(gDuel[playerid][d_weapon]), gDuel[playerid][d_bet]);
SendClientMessageToAll(COLOR_AQUA, string);
format(string, sizeof(string), "%s have won the duel against opponent %s", GetPlayerName(gDuel[playerid][d_opponent]), GetPlayerName(playerid));
4578 is the first line string format one
Re: Code Error Need help -
Lucky13 - 06.01.2016
The problem is at GetWeaponName, you have inserted only one value inside ( which is gDuel[playerid][d_weapon] ) and you must insert 3. You can still make a callback for example called GetGunName where you define the weapon names by the gDuel[playerid][d_weapon].
Check this:
https://sampwiki.blast.hk/wiki/GetWeaponName
Re: Code Error Need help -
Rockyyy - 06.01.2016
Okay i made this
Код:
ReturnWeaponName(weaponid)
{
new weaponstr[45];
GetWeaponName(weaponid, weaponstr, sizeof(weaponstr));
return weaponstr;
}
Код:
format(string, sizeof(string), "%s have won the duel against opponent %s [weapon: %s, bet: $%i]", GetPlayerName(gDuel[playerid][d_opponent]), GetPlayerName(playerid), ReturnWeaponName(gDuel[playerid][d_weapon]), gDuel[playerid][d_bet]);
But still the same error
Re: Code Error Need help -
Lucky13 - 06.01.2016
This should work:
Код:
stock ReturnWeaponName(wid)
{
new gunname[32];
switch (wid)
{
case 1 .. 17,
22 .. 43,
46 : GetWeaponName(wid,gunname,sizeof(gunname));
case 0: format(gunname,32,"%s","Fist");
case 18: format(gunname,32,"%s","Molotov Cocktail");
case 44: format(gunname,32,"%s","Night Vis Goggles");
case 45: format(gunname,32,"%s","Thermal Goggles");
default: format(gunname,32,"%s","Invalid Weapon Id");
}
return gunname;
}
Re: Code Error Need help -
Rockyyy - 06.01.2016
still the same and also i got the same error in that line
Код:
format(string, sizeof(string), "%s have won the duel against opponent %s", GetPlayerName(gDuel[playerid][d_opponent]), GetPlayerName(playerid));
Which doesnot have returnweaponname
Re: Code Error Need help -
Lucky13 - 06.01.2016
Can I see the stock GetPlayerName?
Re: Code Error Need help -
Rockyyy - 06.01.2016
https://sampwiki.blast.hk/wiki/GetPlayerName
its already made
Re: Code Error Need help -
Lucky13 - 06.01.2016
That's another error-..use this
Код:
stock GetThePlayerName(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
return pName;
}
Place that somewhere in your script and replace GetPlayerName(...) with GetThePlayerName(...) in your format(string..)
Re: Code Error Need help -
Rockyyy - 06.01.2016
Okay thanks its working now, idk what was the problem in using GetPlayerName, as im using it in my whole gm and there wasn't this error
Re: Code Error Need help -
Lucky13 - 06.01.2016
Here:
https://sampwiki.blast.hk/wiki/GetPlayerName