SA-MP Forums Archive
Argument type mismatch ( type 2 ) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Argument type mismatch ( type 2 ) (/showthread.php?tid=511362)



Argument type mismatch ( type 2 ) - Laure - 05.05.2014

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;
}



Re: Argument type mismatch ( type 2 ) - BroZeus - 05.05.2014

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"


Re: Argument type mismatch ( type 2 ) - Laure - 05.05.2014

Didnt work.


Re: Argument type mismatch ( type 2 ) - Laure - 05.05.2014

Help anyone?


Re: Argument type mismatch ( type 2 ) - Patrick - 05.05.2014

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


Re: Argument type mismatch ( type 2 ) - Laure - 05.05.2014

Its shown in the code bro check it out well.


Re: Argument type mismatch ( type 2 ) - Vince - 05.05.2014

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


Re: Argument type mismatch ( type 2 ) - Laure - 05.05.2014

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")



Re: Argument type mismatch ( type 2 ) - Vince - 05.05.2014

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.


Re: Argument type mismatch ( type 2 ) - Laure - 05.05.2014

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.



Re: Argument type mismatch ( type 2 ) - Vince - 05.05.2014

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