ObjectMovingToPlayer
#1

Hello everyone, so I titled this thread ObjectMovingToPlayer which means that an object moves to the player, but I don't know how to script it, I saw it at a server once, an object was following me, and it injures me if I let it touch me.
I don't know if its possible but the object was probably attached to a bot which is programmed to follow the player.

So I know its possible to attach an object at an npc, then have the npc follow the player, so I want to create fire around the object and when it hits the player it explodes, so anybody knows if an object moving to a player exist?
is it possible to create a object and make it move? like the deer in vwh-rp.





ObjectMovingTowardsPlayer(playerid, objectid, speed, float: x, float:y, float:z);
Reply
#2

So you can create simple function :
PHP код:
forward ObjectMovingTowardsPlayer(playeridobjectidspeed);
public 
ObjectMovingTowardsPlayer(playeridobjectidspeed)
{
    new 
Float:PlayerPos[MAX_PLAYERS][3];
    
GetPlayerPos(playeridPlayerPos[playerid][0], PlayerPos[playerid][1], PlayerPos[playerid][2]);
    
GetPlayerFacingAngle(playeridPlayerPos[playerid][3]);
    
MoveObject(objectidPlayerPos[playerid][0], PlayerPos[playerid][1], PlayerPos[playerid][2], speedPlayerPos[playerid][3]);
    return 
1;

Reply
#3

Quote:
Originally Posted by Lbaker
Посмотреть сообщение
So you can create simple function :
PHP код:
forward ObjectMovingTowardsPlayer(playeridobjectidspeed);
public 
ObjectMovingTowardsPlayer(playeridobjectidspeed)
{
    new 
Float:PlayerPos[MAX_PLAYERS][3];
    
GetPlayerPos(playeridPlayerPos[playerid][0], PlayerPos[playerid][1], PlayerPos[playerid][2]);
    
GetPlayerFacingAngle(playeridPlayerPos[playerid][3]);
    
MoveObject(objectidPlayerPos[playerid][0], PlayerPos[playerid][1], PlayerPos[playerid][2], speedPlayerPos[playerid][3]);
    return 
1;

Nice, I'll test that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)