Argument type mismatch ( type 2 )
#1

Hey there, i am having a error while compiling "arguement type mismatch ( type 2 ) in the following line, expect help from you guys.
Code:
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;
}
Reply
#2

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

Didnt work.
Reply
#4

Help anyone?
Reply
#5

What line does the error "Argument type mismatch ( type 2 )" occurs, that would be helpful if you let us know.
Reply
#6

Its shown in the code bro check it out well.
Reply
#7

That line is perfectly valid. Are you sure it's referring to this file? Not some other include file?
Reply
#8

Alright after i changed the error line to this
pawn Code:
GetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
I got the following error
Code:
error 091: ambiguous constant; tag override is required (symbol "pX")
Reply
#9

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.
Reply
#10

i have dozens of warnings with it dude.There they are and they belong to the pawn code i provided.
Code:
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 © 1997-2006, ITB CompuPhase


1 Error.
Reply
#11

Right. A local variables cannot have the same name as an enum specifier. Rename pX, pY and pZ in the function to something else.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)