AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   map coordinates (https://forums.alliedmods.net/showthread.php?t=98125)

Alucard^ 07-22-2009 19:53

map coordinates
 
Well i have problems with coordinates...

I have 2 questions...

First: How to get coordinates of the map?
Second: How to use this coordinates to teleport a player?

To get the coordinates i tried to use "status" in console or "amx_teleportmenu". Then in the plugin code i writed:

PHP Code:

set_pev(idpev_origin, {3160, -3479, -682}) 

But i teleported to another part of the map.... why? what i am doing wrong?

Thx to much

Exolent[jNr] 07-22-2009 19:56

Re: map coordinates
 
PHP Code:

set_pev(idpev_originFloat:{3160.0, -3479.0, -682.0}) 


Alucard^ 07-22-2009 20:14

Re: map coordinates
 
Oh, thx Exolent.. work perfect.

And, how to set the angles?

Arkshine 07-22-2009 20:43

Re: map coordinates
 
set_pev( id, pev_angles, ?? );

Alucard^ 07-22-2009 23:38

Re: map coordinates
 
Mmm.. sry i dont understand at all...

you mean something like this?:

PHP Code:

set_pev(idpev_origin"here the angless",  Float:{3160.0, -3479.0, -682.0}) 

And how can i get the angles? with a plugin or what?

Bugsy 07-22-2009 23:45

Re: map coordinates
 
Set angles just as you do with pev_origin except use pev_angles.

PHP Code:

set_pevid pev_angles Float:{ 3160.0 , -3479.0 , -682.0 } );

//or, using a variable

new FloatfAngles];
fAngles] = 3260.0;
fAngles] = -3479.0;
fAngles] = -682.0;
set_pevid pev_angles fAngles ); 

To get angles\origin:
PHP Code:

new FloatfOrigin];
pevid pev_origin fOrigin );

new 
FloatfAngles];
pevid pev_angles fAngles ); 


Alucard^ 07-23-2009 00:48

Re: map coordinates
 
Wow, rly thx Bugsy...

and sry Arkshine... i didnt notice the "pev_angles":

Quote:

Originally Posted by Arkshine (Post 879248)
set_pev( id, pev_angles, ?? );

Now i understand... thx too

And i have a quesiton... this code is fine?

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN    "Get angles & origin"
#define AUTHOR    "Alucard"
#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /origin""get_origin")
    
register_clcmd("say /angles""get_angles")
}

public 
get_origin(id)
{
    new 
FloatfOrigin]
    
pevid pev_origin fOrigin )
    
client_print(idprint_chat"origin: %f, %f, %f"fOrigin[0], fOrigin[1], fOrigin[2])
    return 
PLUGIN_HANDLED
}

public 
get_angles(id)
{
    new 
FloatfAngles]
    
pevid pev_angles fAngles )
    
client_print(idprint_chat"angles: %f, %f, %f"fAngles[0], fAngles[1], fAngles[2])
    return 
PLUGIN_HANDLED


I tested and i think work fine but... with /origin and "status" have some differences... see an example:

With /origin:

Quote:

origin: 3113.025146, -3715.923095, -699.96875
With command "status":

Quote:

3113 x, -3715 y, -682 z
Maybe the decimals doesnt import at all but... the z is different...

Exolent[jNr] 07-23-2009 12:52

Re: map coordinates
 
AMXX gives the exact coordinates.
Were you crouching when you did one coordinates and not the other?

Alucard^ 07-23-2009 18:24

Re: map coordinates
 
Well dont know why the code give me differents coordinates but i didnt crouch. But this is not the problem right now... cuz the cordinates work perfect.

The problem is the angles... doesnt work... maybe cuz i get 0.0000 Z... see:

PHP Code:

set_pev(idpev_originFloat:{1118.717163866.860046, -827.968750})
set_pev(idpev_anglesFloat:{-2.620239, -90.1428220.0000}) 


TitANious 07-23-2009 19:01

Re: map coordinates
 
A good method :) And it's easy to look at:
http://forums.alliedmods.net/showthr...357#post879357
The "Z" axis is the up/down. You should be in the middle of the map or so with giving it 0.0


All times are GMT -4. The time now is 18:17.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.