SA-MP Forums Archive
Click map teleport. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Click map teleport. (/showthread.php?tid=583999)



Click map teleport. - GabiXx - 01.08.2015

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.


Re: Click map teleport. - Inn0cent - 01.08.2015

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.


Respuesta: Click map teleport. - RIDE2DAY - 01.08.2015

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.



Re: Click map teleport. - GabiXx - 01.08.2015

Ty a lot.