SA-MP Forums Archive
help - 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 (/showthread.php?tid=136852)



help - radi - 26.03.2010

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 )


Re: help - MadeMan - 26.03.2010

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



Re: help - radi - 26.03.2010

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


Re: help - MadeMan - 27.03.2010

You have to make the timer interval smaller.