[Help] Player lose health when near object - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Player lose health when near object (
/showthread.php?tid=255648)
[Help] Player lose health when near object -
andruz99 - 16.05.2011
I want to make player lose health when near object id 2908 kmb_deadhead
can somebody help me please
Re: [Help] Player lose health when near object -
Rock_Ro - 16.05.2011
Код:
if(!strcmp("/nearobject",cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, X, Y, Z)) // Object coords , get it ingame...
{
SetPlayerHealth(playerid, 0.0);
}
return 1;
}
Re: [Help] Player lose health when near object -
andruz99 - 16.05.2011
and the object is randomly created somewhere on the map., so i dont know
Re: [Help] Player lose health when near object -
Rock_Ro - 16.05.2011
Now it was very useful a function called "IsPlayerInRangeOfObject" or "IsPlayerNearObject"...
Fortunately i've found function "IsPlayerNearObject" but i don't know if works.
Stock
Код:
stock IsPlayerNearObject(playerid, objectid)
{
new Float:X, Float:Y, Float:Z;
GetObjectPos(objectid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 10.0, X, Y, Z)) return 1;
return 0;
}
Use...
if(IsPlayerNearObject(playerid, 2908)) print("Player Is Near kmb_deadhead!");
Re: [Help] Player lose health when near object -
andruz99 - 16.05.2011
il try
Re: [Help] Player lose health when near object -
andruz99 - 16.05.2011
Yay it works
, but do you also know if i shoot the object how can i add the point when the object is shot, and destroyed