[HELP]warning 202: number of arguments does not match definition
#1

Hi,
i got 3 problem about warning 202: number of arguments does not match definition

this is line
PHP Code:
CMD:drift1(playeridparams[])
{
    
SetPlayerPos(playerid5924,-4716.8574,112.5937,263); // << This IS 1
    
SendClientMessageToAll(playeridBLUE"Has gone to /drift1"); << This Is 2
        GameTextForPlayer
(playerid"Welcome To Drift1"30005);
    new 
string[128], pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(stringsizeof(string), "~r~%s ~w~has Teleported to ~y~/drift1",pName);
     
SetPlayerVirtualWorld(playerid0);
    return 
1;

PHP Code:
F:\My Documents\Unduhan\Mya\gamemodes\Build9.pwn(2946) : warning 202number of arguments does not match definition
F
:\My Documents\Unduhan\Mya\gamemodes\Build9.pwn(4405) : warning 202number of arguments does not match definition
F
:\My Documents\Unduhan\Mya\gamemodes\Build9.pwn(4406) : warning 202number of arguments does not match definition 
And

PHP Code:
    #define DIALOG_DRIFT                                            62
if(dialogid == DIALOG_DRIFT)
    {
        if(
response)
        {
            if(
listitem == 0cmd_drift1(playerid); // << This IS 3
        
}
    } 
Thanks. And Please Help Me.
Reply
#2

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");
Reply
#3

Quote:
Originally Posted by bondowocopz
View Post
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
Reply
#4

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);
Reply
#5

Code:
SetPlayerFacingAngle(playerid, 263.0);
Second arguments must be Float, mate
Reply
#6

There's one more error:
PHP Code:
if(listitem == 0cmd_drift1(playerid
Change it to:
PHP Code:
if(listitem == 0cmd_drift1(playerid""
Reply
#7

Quote:
Originally Posted by bondowocopz
View Post
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.
Reply
#8

Quote:
Originally Posted by CalvinC
View Post
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.
Reply
#9

Quote:
Originally Posted by CalvinC
View Post
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
View Post
Sorry, i think second arguments must be Float and you get warning when you use an integer.
Quote:
Originally Posted by ATGOggy
View Post
There's one more error:
PHP Code:
if(listitem == 0cmd_drift1(playerid
Change it to:
PHP Code:
if(listitem == 0cmd_drift1(playerid""
Quote:
Originally Posted by bondowocopz
View Post
Code:
SetPlayerFacingAngle(playerid, 263.0);
Second arguments must be Float, mate
Quote:
Originally Posted by JaKe Elite
View Post
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
Reply
#10

Quote:
Originally Posted by CalvinC
View Post
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)