Help with map teleporting
#2

pawn Код:
// [ DEVELOPMENT GAMEMODE ]

// INCLUDES:

#include <a_samp>
#include <zcmd>

// DEFINES:

// FUNCTIONS:

#define function%0(%1) forward%0(%1); public%0(%1)

// PER-PLAYER VARIABLES:

// GENERAL:

new Float:pMapTeleport[MAX_PLAYERS][3];

// PLAYER STATES:

new bool:sMapTeleport[MAX_PLAYERS];

// MAIN:

main()
{
    print("Development Mode: map_teleport.amx");
}

// CALLBACKS:

public OnGameModeInit()
{
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    if(IsPlayerAdmin(playerid))
    {
        if(!ClickedOnMap(playerid))
        {
            pMapTeleport[playerid][0] = fX;
            pMapTeleport[playerid][1] = fY;
            pMapTeleport[playerid][2] = fZ;
            sMapTeleport[playerid] = true;
        }
        else
        {
            pMapTeleport[playerid][0] = 0.0;
            pMapTeleport[playerid][1] = 0.0;
            pMapTeleport[playerid][2] = 0.0;
            sMapTeleport[playerid] = false;
        }
    }
    return 1;
}

// COMMANDS:

CMD:maptp(playerid, params[])
{
    if(!ClickedOnMap(playerid)) return SendClientMessage(playerid, -1, "You haven't marked a position on the map yet.");

    SetPlayerPos(playerid, pMapTeleport[playerid][0], pMapTeleport[playerid][1], pMapTeleport[playerid][2]);
    SetCameraBehindPlayer(playerid);
    return 1;
}

// FUNCTIONS:

function bool:ClickedOnMap(playerid) return sMapTeleport[playerid];
Reply


Messages In This Thread
Help with map teleporting - by ChromeMenu - 20.07.2015, 03:45
Re: Help with map teleporting - by SickAttack - 20.07.2015, 04:02
Re: Help with map teleporting - by ChromeMenu - 20.07.2015, 04:15
Re: Help with map teleporting - by SickAttack - 20.07.2015, 04:16
Re: Help with map teleporting - by ChromeMenu - 20.07.2015, 04:25
Re: Help with map teleporting - by SickAttack - 20.07.2015, 04:33
Re: Help with map teleporting - by xVIP3Rx - 20.07.2015, 08:26

Forum Jump:


Users browsing this thread: 1 Guest(s)