SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 13/07/2013, 11:34 PM   #1
Semo
Big Clucker
 
Join Date: Mar 2012
Location: UAE
Posts: 97
Reputation: 3
Default how to get nearest player name

Hello.

I want to know how to get the nearest cop from me

Cop code:
pawn Code:
copteam[playerid]==1

I just need function to get the nearest cop from me name!

And thanks
__________________
<a href="http://monitor.sacnr.com/server-780376.html"><img src="http://monitor.sacnr.com/sig-3-780376" /></a>
Semo is offline   Reply With Quote
Old 13/07/2013, 11:36 PM   #2
-Prodigy-
Huge Clucker
 
Join Date: Dec 2010
Posts: 399
Reputation: 45
Default Re: how to get nearest player name

http://forum.sa-mp.com/showpost.php?...50&postcount=2
-Prodigy- is offline   Reply With Quote
Old 13/07/2013, 11:40 PM   #3
Semo
Big Clucker
 
Join Date: Mar 2012
Location: UAE
Posts: 97
Reputation: 3
Default Re: how to get nearest player name

Well you do as i ordered? i want nearest player from cop team class
copteam[playerid] == 1 // mine
__________________
<a href="http://monitor.sacnr.com/server-780376.html"><img src="http://monitor.sacnr.com/sig-3-780376" /></a>
Semo is offline   Reply With Quote
Old 13/07/2013, 11:46 PM   #4
-Prodigy-
Huge Clucker
 
Join Date: Dec 2010
Posts: 399
Reputation: 45
Default Re: how to get nearest player name

Have you tried anything so far? If not, go and try it.
-Prodigy- is offline   Reply With Quote
Old 14/07/2013, 12:37 AM   #5
Miro96
Little Clucker
 
Join Date: Jun 2013
Posts: 7
Reputation: -2
Default Re : how to get nearest player name

Code:
stock IsPlayerNearPlayer(playerid, nearplayerid, Float:maxdis)
{
    new Float:pos[6];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    GetPlayerPos(nearplayerid, pos[3], pos[4], pos[5]);
    if (pos[0] >= floatsub(pos[3], maxdis) && pos[0] <= floatadd(pos[3], maxdis)
    && pos[1] >= floatsub(pos[4], maxdis) && pos[1] <= floatadd(pos[4], maxdis)
    && pos[2] >= floatsub(pos[5], maxdis) && pos[2] <= floatadd(pos[5], maxdis))
    {
        return 1;
    }
    return 0;
}
Miro96 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nearest Player ID Macro? xRetroDuckz Server Support 6 12/07/2013 06:02 PM
how to get player's nearest Object id Chrisli520 Scripting Help 1 05/07/2013 10:23 AM
nearest Player GoldZoroGrab Scripting Help 3 09/12/2012 11:52 AM
Nearest player budelis Help Archive 2 27/07/2011 08:11 AM
Get nearest player austin070 Help Archive 2 04/03/2011 01:07 AM


All times are GMT. The time now is 12:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.