Teleport With Objects
#1

Hello
How can teleport with zcmd when i get close to an object like ( Doors / Gates or ....)
Thanks
Reply
#2

You can check with IsPlayerInRangeOfPoint if the player is at the door and then use SetPlayerPos to teleport the player
Reply
#3

Tnx Bro
Reply
#4

Sorry / Another Question
Where Should i Add IsPlayerInRangeOfPoint ?
Reply
#5

Example:

PHP код:
cmd:enter(playeridparams[])
{
      if(!
IsPlayerInRangeOfPoint(playerid000)) return SendClientMessage(playerid, -1"You are not near the door!");

     
SetPlayerPos(playerid111);
     return 
1;

Reply
#6

Tnx 4 Help
But:

This Code
Код HTML:
CMD:enter(playerid, params[])
{
	if (IsPlayerInRangeOfPoint(playerid, 7.0, 2410.7625,22.7374,318.7558))
    {
    	SetPlayerPos(playerid, 2617.1079,62.8777,256.7219);
    	return 1;
    }

     return 0;
}
when i enter "2410.7625,22.7374,318.7558" position, i enter /ender & nothing will happen
i just want to teleport from "2410.7625,22.7374,318.7558" to "2617.1079,62.8777,256.7219"

Tnx
Reply
#7

So why not use the code above?

PHP код:
CMD:enter(playeridparams[])
{
    if(!
IsPlayerInRangeOfPoint(playerid7.02410.7625,22.7374,318.7558)) return SendClientMessage(playerid, -1"You are not near the door!");
    
SetPlayerPos(playerid2617.1079,62.8777,256.7219);
    return 
1;

You have to type /enter and it should work fine, if you are at the right position!
Reply
#8

U R The Best
I'm Just Noob in Scripting
Thanks, that Worked
Reply
#9

Poor codes shown above. There isn't only one door in your server is it? Loop through all your server's doors, then run the checks needed.
Reply
#10

You can also use GetDynamicObjectPos

e.g:
pawn Код:
new objectid;


objectid = CreateDynamicObject(....);

CMD:enter(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    GetDynamicObjectPos(objectid, x, y, z);
    if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
    {
        SetPlayerPos(...);
    }
    return 1;
}
Reply
#11

Quote:

Poor codes shown above. There isn't only one door in your server is it? Loop through all your server's doors, then run the checks needed

He asked for something i sent him it, just like that, he wanted a teleport from a POINT to POINT as a result I gave him a code for it, but if he asked for a code for a door's system then i'd send him one, so instead of bumping the thread showing us your skills, read first.

Quote:

You can also use GetDynamicObjectPos

That's not even related to the thread.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)