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(playerid, Float:fX, Float:fY, Float:fZ)
{
   new 
Float:x, Float:y, Float:z;
   if(!
IsPlayerAdmin(playerid))
   return 
1;
   if(
IsPlayerAdmin(playerid))
   
SetPlayerPosFindZ(playerid, x, y, z);
   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(playerid, Float:fX, Float:fY, Float:fZ)
{
    if(
IsPlayerAdmin(playerid))
    {
        
SetPlayerPosFindZ(playerid, fX, fY, fZ);
    }
    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)