SA-MP Forums Archive
Follow Player - 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: Follow Player (/showthread.php?tid=388751)



Follow Player - NoahF - 30.10.2012

I need a script that makes it so an object can follow the player wherever he goes. Not sure how to put it in code.


Re: Follow Player - Drake_Lopez - 30.10.2012

Search on ******? Or have you tried that? :P


Re: Follow Player - NoahF - 30.10.2012

Quote:
Originally Posted by Drake_Lopez
Посмотреть сообщение
Search on ******? Or have you tried that? :P
Not yet. Thought I'd go straight to the forums.


Re: Follow Player - arman'as - 30.10.2012

new object;

Set timer and do ths:
Quote:

new Float:Coo[3];
GetPlayerPos(id,Coo[0],Coo[1],Coo[2]);
DestroyObject(object);
object = CreateObject(modelid,Coo[0],Coo[1],Coo[2],0.0,0.0,0.0);




Re: Follow Player - KevinPRINCE - 30.10.2012

Search there is few Tutorials on it


Re: Follow Player - NoahF - 30.10.2012

Ok, so now how would I make a loop that loops through all the players currently online and selects a random one?


Re: Follow Player - [HK]Ryder[AN] - 30.10.2012

pawn Код:
stock SelectRandomPlayer()
{
     new random = Random(MAX_PLAYERS);
     if(IsPlayerConnected(random))
     {
           return random;
     }
     else
     {
           SelectRandomPlayer();
     }
}
Paste this as a stock out of a callback
pawn Код:
new randomplayer = SelectRandomPlayer();
SetPlayerHealth(randomplayer, 100);
Change the setplayerhealth with whateva u wanna do with him


Re: Follow Player - NoahF - 30.10.2012

Thanks.


Re: Follow Player - NoahF - 30.10.2012

Ok, so now is there a way I can make it so the object gets set.. let's say about 10 from the player? (I don't know what unit it would be xD)


Re: Follow Player - [HK]Ryder[AN] - 30.10.2012

Use this function
https://sampwiki.blast.hk/wiki/AttachObjectToPlayer
Syntax
pawn Код:
(objectid, playerid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:rX, Float:rY, Float:rZ)
You can change the offset values to the distance you want between player and object