SA-MP Forums Archive
Small error - 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: Small error (/showthread.php?tid=404640)



Small error - Squirrel - 03.01.2013

What's the problem with this
Код:
	if(IsPlayerInRangeOfObject(playerid, 987, 5.0)) //ERROR LINE
	{
	    SetPlayerHealth(playerid, 10);
	    return 1;
	}
Код:
warning 203: symbol is never used: "distance"
Код:
IsPlayerInRangeOfObject(playerid, objectid, Float:distance=5.0)
{
	new Float:x, Float:y, Float:z;
	GetObjectPos(objectid, x, y, z);
	return (GetPlayerDistanceFromPoint(playerid, x, y, z) < 5.0);
}



Re: Small error - ReD_Boii - 03.01.2013

pawn Код:
if(IsPlayerInRangeOfObject(playerid, 987, 5.0) //ERROR LINE
{
    SetPlayerHealth(playerid, 10);
    return 1;
}
Try this


Re: Small error - GhostDeath - 03.01.2013

im sorry i don't know much about scripting and plus i don't see the problem there


Re: Small error - Squirrel - 03.01.2013

Quote:
Originally Posted by ReD_Boii
Посмотреть сообщение
pawn Код:
if(IsPlayerInRangeOfObject(playerid, 987, 5.0) //ERROR LINE
{
    SetPlayerHealth(playerid, 10);
    return 1;
}
Try this
Look at my code.
It's same.


Re: Small error - Flyfishes - 03.01.2013

Код:
IsPlayerInRangeOfObject(playerid, objectid, Float:distance=5.0)
{
	new Float:x, Float:y, Float:z;
	GetObjectPos(objectid, x, y, z);
	return (GetPlayerDistanceFromPoint(playerid, x, y, z) < distance);
}
There you go!


Re: Small error - GhostDeath - 03.01.2013

ah i see the one extra )


Re: Small error - Squirrel - 03.01.2013

Thanks. I havent noticed I had <5 at the end q.q


Re: Small error - GhostDeath - 03.01.2013

yea lol