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



IsPlayerInRangeOfPoint help - yllo - 23.08.2018

Hi,

Im trying to write a bit of code that every time a player goes through an info checkpoint they get a textdraw shown on their screen. Its not working but compiles properly. Any ideas?

PHP код:
forward PlayerInfoRange(playerid);
public 
PlayerInfoRange(playerid)
{
    for(new 
id 0id sizeof(factionInfo); id++)
    if(
factionInfo[id][fID] >= 1)
    {
        if(!
IsPlayerInRangeOfPoint(playerid,3factionInfo[id][facX], factionInfo[id][facY],factionInfo[id][facZ]))
        {
            
TextDrawShowForPlayer(playeridEMPTYINFOBOX);
            
TextDrawShowForPlayer(playeridPROPNAME);
            
TextDrawShowForPlayer(playeridSTRINGNAME);
            
TextDrawShowForPlayer(playeridPROPADD);
            
TextDrawShowForPlayer(playeridPROPOWNER);
            
TextDrawShowForPlayer(playeridSTRINGNAME);
            
TextDrawShowForPlayer(playeridSTRINGPROP);
            
TextDrawShowForPlayer(playeridSTRINGOWNER);
            
TextDrawShowForPlayer(playeridPROPINFO);
            
TextDrawShowForPlayer(playeridTEXTBOT);
        }
    }
    return 
1;




Re: IsPlayerInRangeOfPoint help - GaMiX - 23.08.2018

hmm use foreach


Re: IsPlayerInRangeOfPoint help - solstice_ - 23.08.2018

Quote:
Originally Posted by GaMiX
Посмотреть сообщение
hmm use foreach
How can he use foreach in a faction loop? Are you blind or what?


Re: IsPlayerInRangeOfPoint help - Shinja - 24.08.2018

You are checking the opposite : !IsPlayerInRangeOfPoint
PHP код:
if(IsPlayerInRangeOfPoint(playerid,3factionInfo[id][facX], factionInfo[id][facY],factionInfo[id][facZ])) 



Re: IsPlayerInRangeOfPoint help - yllo - 24.08.2018

I tried that, but still nothing comes up. The only way I could get it to come up is with a timer, but then it repeatedly comes up even though no one is near a faction


Re: IsPlayerInRangeOfPoint help - Shinja - 24.08.2018

How do you call your PlayerInfoRange function?


Re: IsPlayerInRangeOfPoint help - GaMiX - 24.08.2018

Quote:
Originally Posted by willbedie
Посмотреть сообщение
How can he use foreach in a faction loop? Are you blind or what?
ey man cmoon , iam new :P


Re: IsPlayerInRangeOfPoint help - yllo - 24.08.2018

Quote:
Originally Posted by Shinja
Посмотреть сообщение
How do you call your PlayerInfoRange function?
I call it under a settimer function in ongamemodeinit. It kept spamming my players however. How should I lay it out?


Re: IsPlayerInRangeOfPoint help - Beckett - 24.08.2018

Quote:
Originally Posted by willbedie
Посмотреть сообщение
How can he use foreach in a faction loop? Are you blind or what?
Why can't he?


Re: IsPlayerInRangeOfPoint help - Rufio - 27.08.2018

Quote:
Originally Posted by willbedie
Посмотреть сообщение
How can he use foreach in a faction loop? Are you blind or what?
He can, with iterators. Don't be rude to people if you are clueless yourself.