Script a Move
#1

Hi.

I'm trynna studying the pawn functions, and I am asking myself : how to make a function to move something.
Like MoveObject or MoveDynamicObject, but I would like to expand this to other pawn entities than objects.

Thanks in advance
Reply
#2

here https://sampwiki.blast.hk/wiki/MoveObject
You can add it with your ideas in cmds
Reply
#3

Quote:

Hello, could you please define moving "something" ?
A player? Vehicle? Object? Pickup? Or?

he meant object read it carefully like Move object or Move Dunamic Object
Reply
#4

@rockhopper : I don't wanna like to Move Objects, but for example Pickups, the whole map, vehicles, I just want to know how the MoveObject function works, with the time parameter (I think I've made something good but I don't know how to do with a speed (units per second) parameter)

@Ralfie : For example, what you've said.
Reply
#5

you can try for example using zcmd
Код:
CMD:moveplayer(playerid, params[])
{
 new Float:x
 new Float:y
 new Float:z
if(GetPlayerPos(playerid, Float:x, Float:y, Float:z))
SetPlayerPos(playerid, Float:x +3,Float:y +2,Float:z);


}
USING THIS THE PLAYER will move
Reply
#6

Just want a function, and for example, if I input

PHP код:

MovePlayer
(playeridhisXposhisYposhisZpos0.00.00.03.0// The last one is the speed parameter 
Show me a good code which shows how would you do because I've not find yet.
I don't want a ready made code for what I want, just either the source code of Move(Dynamic)Object or a very nice example.
Reply
#7

Код:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
  if(IsPlayerConnected(playerid))
	{
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		tempposx = (oldposx -x);
		tempposy = (oldposy -y);
		tempposz = (oldposz -z);
		//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}
TRY POINTTOPOINT

TAKEN FROM https://sampforum.blast.hk/showthread.php?tid=52205
Reply
#8

you can look at this too
https://sampwiki.blast.hk/wiki/GetPlayerDistanceFromPoint
Reply
#9

I think you didn't understood.

I hope that I use the proper words to express myself. I will try to reformulate.

You see, you can moove object using MoveObject function.
I would like to do the same but with pickups, and I'd like to create a MovePickup function.
Do you know what I mean ?
But I've tried several ways to proceed, and all were either not working or teleporting directly the object instead of moving him (because the only advantage of the moving is that you can see the object position change, whereas with "SetObjectPos", you directly see the new pos).

If I expressed bad again, sorry, I'll try to do better next time

@Ralfie : Yeah, but for pickups ? And for 3DTextLabels ?
Reply
#10

Incognito did on his plugin, even if it's in C++, i'm sure you can do almost the same in pawn (almost, not exactly, for sure, but almost )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)