[HELP]warning 202: number of arguments does not match definition -
Mya - 17.03.2015
Hi,
i got 3 problem about warning 202: number of arguments does not match definition
this is line
PHP Code:
CMD:drift1(playerid, params[])
{
SetPlayerPos(playerid, 5924,-4716.8574,112.5937,263); // << This IS 1
SendClientMessageToAll(playerid, BLUE, "Has gone to /drift1"); << This Is 2
GameTextForPlayer(playerid, "Welcome To Drift1", 3000, 5);
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(string, sizeof(string), "~r~%s ~w~has Teleported to ~y~/drift1",pName);
SetPlayerVirtualWorld(playerid, 0);
return 1;
}
PHP Code:
F:\My Documents\Unduhan\Mya\gamemodes\Build9.pwn(2946) : warning 202: number of arguments does not match definition
F:\My Documents\Unduhan\Mya\gamemodes\Build9.pwn(4405) : warning 202: number of arguments does not match definition
F:\My Documents\Unduhan\Mya\gamemodes\Build9.pwn(4406) : warning 202: number of arguments does not match definition
And
PHP Code:
#define DIALOG_DRIFT 62
if(dialogid == DIALOG_DRIFT)
{
if(response)
{
if(listitem == 0) cmd_drift1(playerid); // << This IS 3
}
}
Thanks. And Please Help Me.
Re: [HELP]warning 202: number of arguments does not match definition -
X337 - 17.03.2015
Change
Code:
SetPlayerPos(playerid, 5924,-4716.8574,112.5937,263);
to
Code:
SetPlayerPos(playerid, 5924.000,-4716.8574,112.5937);
I see 5 parameter on your SetPlayerPos, see this
https://sampwiki.blast.hk/wiki/SetPlayerPos
and remove playerid, from SendClientMessageToAll
Code:
SendClientMessageToAll(BLUE, "Has gone to /drift1");
Re: [HELP]warning 202: number of arguments does not match definition -
Mya - 17.03.2015
Quote:
Originally Posted by bondowocopz
Change
Code:
SetPlayerPos(playerid, 5924,-4716.8574,112.5937,263);
to
Code:
SetPlayerPos(playerid, 5924.000,-4716.8574,112.5937);
I see 5 parameter on your SetPlayerPos, see this https://sampwiki.blast.hk/wiki/SetPlayerPos
and remove playerid, from SendClientMessageToAll
Code:
SendClientMessageToAll(BLUE, "Has gone to /drift1");
|
Thanks, All already fixed
Re: [HELP]warning 202: number of arguments does not match definition -
JaKe Elite - 17.03.2015
Additional help, If you want your 5th parameter which is Angle to be added on teleporting.
Just do this.
Add this below SetPlayerPos
pawn Code:
SetPlayerFacingAngle(playerid, 263);
Re: [HELP]warning 202: number of arguments does not match definition -
X337 - 17.03.2015
Code:
SetPlayerFacingAngle(playerid, 263.0);
Second arguments must be Float, mate
Re: [HELP]warning 202: number of arguments does not match definition -
ATGOggy - 17.03.2015
There's one more error:
PHP Code:
if(listitem == 0) cmd_drift1(playerid)
Change it to:
PHP Code:
if(listitem == 0) cmd_drift1(playerid, "")
Re: [HELP]warning 202: number of arguments does not match definition -
CalvinC - 17.03.2015
Quote:
Originally Posted by bondowocopz
Code:
SetPlayerFacingAngle(playerid, 263.0);
Second arguments must be Float, mate
|
There's no difference of 263.0, and 263.
Like there's no difference of 1.010 and 1.01, i could do 263.00000, and it's still the same as 263.
Re: [HELP]warning 202: number of arguments does not match definition -
X337 - 17.03.2015
Quote:
Originally Posted by CalvinC
There's no difference of 263.0, and 263.
Like there's no difference of 1.010 and 1.01, i could do 263.00000, and it's still the same as 263.
|
Sorry, i think second arguments must be Float and you get warning when you use an integer.
Re: [HELP]warning 202: number of arguments does not match definition -
Mya - 17.03.2015
Quote:
Originally Posted by CalvinC
There's no difference of 263.0, and 263.
Like there's no difference of 1.010 and 1.01, i could do 263.00000, and it's still the same as 263.
|
Quote:
Originally Posted by bondowocopz
Sorry, i think second arguments must be Float and you get warning when you use an integer.
|
Quote:
Originally Posted by ATGOggy
There's one more error:
PHP Code:
if(listitem == 0) cmd_drift1(playerid)
Change it to:
PHP Code:
if(listitem == 0) cmd_drift1(playerid, "")
|
Quote:
Originally Posted by bondowocopz
Code:
SetPlayerFacingAngle(playerid, 263.0);
Second arguments must be Float, mate
|
Quote:
Originally Posted by JaKe Elite
Additional help, If you want your 5th parameter which is Angle to be added on teleporting.
Just do this.
Add this below SetPlayerPos
pawn Code:
SetPlayerFacingAngle(playerid, 263);
|
ok Jake, Thanks for additional help
-----------------------------------------------------------------------------------------------------------------------------
All warnings allraedy fixed, thanks all
Re: [HELP]warning 202: number of arguments does not match definition -
Vince - 17.03.2015
Quote:
Originally Posted by CalvinC
There's no difference of 263.0, and 263.
|
That is actually not true, at all. If you insert an integer where a float is expected Pawn will implicitly convert it. Many other languages, however, require you to explicitly specify the ".0" otherwise the value will be treated as an integer.
Say, if you did:
Code:
new result = 10 / 3;
result would be 3. Not 3.33333. Just 3.
Whereas if you did:
Code:
new result = 10 / 3.0;
You would get a tag mismatch warning because result is not a floating point number.
http://en.wikipedia.org/wiki/IEEE_754
You should always add the .0 when dealing with floats to prevent preventable errors.