Click map teleport.
#1

I want to teleport if i'm admin with click on map.
I try this.
PHP код:
public OnGameModeInit()
{
   
AllowAdminTeleport(1);
   return 
1;

And this.
PHP код:
public OnPlayerClickMap(playeridFloat:fXFloat:fYFloat:fZ)
{
   new 
Float:xFloat:yFloat:z;
   if(!
IsPlayerAdmin(playerid))
   return 
1;
   if(
IsPlayerAdmin(playerid))
   
SetPlayerPosFindZ(playeridxyz);
   return 
1;

But when i click map, i don't get the position where i clicked, and i go under the map.
Reply
#2

SetPlayerPosFindZ change this to SetPlayerPos(playerid, fX, fY, fZ);
And remove, new Float, Float:y, Float:z;, if(!IsPlayerAdmin(playerid)), return 1; Its not needed.
Reply
#3

AllowAdminTeleport is deprecated so remove it, you should do this:

PHP код:
public OnPlayerClickMap(playeridFloat:fXFloat:fYFloat:fZ)
{
    if(
IsPlayerAdmin(playerid))
    {
        
SetPlayerPosFindZ(playeridfXfYfZ);
    }
    return 
1;

Quote:
Originally Posted by SA-MP Wiki
The Z value returned will be 0 (invalid) if it is far away from the player; use the MapAndreas plugin to get a more accurate Z coordinate.
Reply
#4

Ty a lot.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)