[Help] Player lose health when near object
#1

I want to make player lose health when near object id 2908 kmb_deadhead

can somebody help me please
Reply
#2

Код:
if(!strcmp("/nearobject",cmdtext))
{
    if(IsPlayerInRangeOfPoint(playerid, X, Y, Z)) // Object coords , get it ingame...
    {
        SetPlayerHealth(playerid, 0.0);
    }
    return 1;
}
Reply
#3

and the object is randomly created somewhere on the map., so i dont know
Reply
#4

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!");
Reply
#5

il try
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)