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)
+--- Thread: Help (/showthread.php?tid=345508)



Help - HighPitchedVoice - 25.05.2012

I have tried to add "IsPlayerCloseToEnemy" in my script but it dosn't work, what is this name of the function? I mean, the player can't /armour close to a enemy..


Re: Help - MarTaTa - 25.05.2012

Ermm I am not sure what you want to say but try with
pawn Код:
if(IsPlayerInRzngeOfPoint(playerid, range, X, Y, Z))



Re: Help - HighPitchedVoice - 25.05.2012

C:\Documents and Settings\Lindvall\Skrivbord\Stor map\Qk server\gamemodes\QKDM.pwn(307) : error 017: undefined symbol "range"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Re: Help - Kukkurloom - 25.05.2012

if(IsPlayerInRangeOfPoint(playerid, 7.0, -29.1218,-185.1289,1003.5469))

Like...
7.0 makes the distance.
X - -29.1218
Y - -185.1289
Z - -185.1289,1003.5469

You can change 7.0 as much as you want.


Re: Help - HighPitchedVoice - 25.05.2012

You should be able to /shop anywhere except close to enemies..


Re: Help - Kukkurloom - 25.05.2012

Are you using ZCMD or strcmp?


Re: Help - Mr.Fames - 25.05.2012

Technically there is no function called IsPlayerCloseToEnemy And IsPlayerInRangeOfPoint is static you cant use it like that


Re: Help - HighPitchedVoice - 25.05.2012

I am using strcmp


Re: Help - [ABK]Antonio - 25.05.2012

pawn Код:
stock IsPlayerCloseToEnemy(playerid)
{
    new bool:returnval = false, Float:Pos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); //store the players position in our Pos array
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            //check if anyone is close to that position that's on a different team
            if(IsPlayerInRangeOfPoint(i, 10.0, Pos[0], Pos[1], Pos[2]) && GetPlayerTeam(i) != GetPlayerTeam(playerid))
            {
                //if so, we're going to return true
                returnval = true;
                break;
            }
        }
    }
    //if not it's going to return false as that's what returnval defaults at
    return returnval;
}



Re: Help - HighPitchedVoice - 25.05.2012

This ain't working...

pawn Код:
if (strcmp("/heal", cmdtext, true, 10) == 0)
    {
        {
            if(IsPlayerInRangeOfPoint(playerid, 10.0, Pos[0], Pos[1], Pos[2]) && GetPlayerTeam(i) != GetPlayerTeam(playerid));
            return 1;
        }
        GivePlayerMoney(playerid, -1000);
        SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid, GREEN, "You have refilled your health but lost 1000.");
        return 1;
    }