#1

how can i make that if i do a cmd like /tree
that if somebody get close to the object dies ?

pawn Код:
if(strcmp(cmd, "/tree", true) == 0)
    {
        new Float:x, Float:y, Float:z, Float:a;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, a);
        CreateObject(2892, x, y, z-0.6, 0.0, 0.0, a+90.0);
        return 1;
    }
if i do that cmd there will be a tree
then if with a timer that checks if there i anyone near that tree and kills it
but how do i make that
( the part with checking if he is near the tree )
Reply
#2

pawn Код:
new tree;
pawn Код:
if(strcmp(cmd, "/tree", true) == 0)
    {
        new Float:x, Float:y, Float:z, Float:a;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, a);
        tree = CreateObject(2892, x, y, z-0.6, 0.0, 0.0, a+90.0);
        return 1;
    }
https://sampwiki.blast.hk/wiki/SetTimer

pawn Код:
new Float:x, Float:y, Float:z;
GetObjectPos(tree, x, y, z);
for(new i=0; i<MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if(IsPlayerInRangeOfPoint(i, 3.0, x, y, z))
        {
            SetPlayerHealth(i, 0);
        }
    }
}
Reply
#3

thanks i got it fixed now i got other problem
the thing i asked for was bullcrap
it was for a spike strip XD
but the spikestrip only works when i drive slowly over it
when i race it wont pop how to fix that
Reply
#4

You have to make the timer interval smaller.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)