PDA

View Full Version : Argument type mismatch ( type 2 )


Laure
05/05/2014, 08:15 AM
Hey there, i am having a error while compiling "arguement type mismatch ( type 2 ) in the following line, expect help from you guys.
public Float:SetPlayerToFacePos(playerid, Float:X, Float:Y)
{
new
Float:pX,
Float:pY,
Float:pZ,
Float:ang;

if(!IsPlayerConnected(playerid)) return 0.0;

GetPlayerPos(playerid, pX, pY, pZ); // here is the error.

if( Y > pY ) ang = (-acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 90.0);
else if( Y < pY && X < pX ) ang = (acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 450.0);
else if( Y < pY ) ang = (acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 90.0);

if(X > pX) ang = (floatabs(floatabs(ang) + 180.0));
else ang = (floatabs(ang) - 180.0);

ang += 180.0;

SetPlayerFacingAngle(playerid, ang);

return ang;
}

BroZeus
05/05/2014, 08:18 AM
i think source of error is this return 0.0; change it to return 0;
not sure

edit and the public line should be this
public SetPlayerToFacePos(playerid, Float:X, Float:Y)
remove "Float:" before "SetPlayerToFacePos"

Laure
05/05/2014, 08:19 AM
Didnt work.

Laure
05/05/2014, 08:35 AM
Help anyone?

Patrick
05/05/2014, 08:41 AM
What line does the error "Argument type mismatch ( type 2 )" occurs, that would be helpful if you let us know.

Laure
05/05/2014, 08:56 AM
Its shown in the code bro check it out well.

Vince
05/05/2014, 09:02 AM
That line is perfectly valid. Are you sure it's referring to this file? Not some other include file?

Laure
05/05/2014, 09:08 AM
Alright after i changed the error line to this

GetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
I got the following error
error 091: ambiguous constant; tag override is required (symbol "pX")

Vince
05/05/2014, 09:18 AM
Are you by any chance ignoring warnings? If there are warnings, post those too. They're there for a reason and shouldn't be taken lightly.

Laure
05/05/2014, 09:26 AM
i have dozens of warnings with it dude.There they are and they belong to the pawn code i provided.
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18390) : warning 219: local variable "pX" shadows a variable at a preceding level
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18391) : warning 219: local variable "pY" shadows a variable at a preceding level
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18392) : warning 219: local variable "pZ" shadows a variable at a preceding level
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18395) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18397) : error 091: ambiguous constant; tag override is required (symbol "pX")
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18399) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18399) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18399) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18399) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18399) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18399) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18400) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18400) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18400) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18400) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18400) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18400) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18400) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18401) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18401) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18401) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18401) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18401) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18401) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18403) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18392) : warning 203: symbol is never used: "pZ"
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18391) : warning 203: symbol is never used: "pY"
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18390) : warning 203: symbol is never used: "pX"
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18492) : warning 225: unreachable code
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18492) : warning 213: tag mismatch
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18664) : warning 217: loose indentation
D:\Unitech Roleplay\gamemodes\ug-rp.pwn(18767) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Vince
05/05/2014, 10:16 AM
Right. A local variables cannot have the same name as an enum specifier. Rename pX, pY and pZ in the function to something else.