#include <zcmd>
new Float: teleportCoordinates[MAX_PLAYERS][3], hasSetTeleport[MAX_PLAYERS];
{
hasSetTeleport[playerid] = 0;
return 1;
}
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
if(IsPlayerAdmin(playerid))
{
teleportCoordinates[playerid][0] = fX, teleportCoordinates[playerid][1] = fY, teleportCoordinates[playerid][2] = fZ;
hasSetTeleport[playerid] = 1;
}
return 1;
}
COMMAND:maptp(playerid, params[])
{
if(!IsPlayerAdmin(playerid) || !hasSetTeleport[playerid]) return 1;
SetPlayerPos(playerid, teleportCoordinates[playerid][0], teleportCoordinates[playerid][1], teleportCoordinates[playerid][2]);
return 1;
}
// [ 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];
|
error 021: symbol already defined: "main"
error 021: symbol already defined: "zcmd_OnGameModeInit" error 021: symbol already defined: "OnGameModeExit" error 021: symbol already defined: "OnPlayerClickMap" |
|
It just says you havent marked a position on the map yet. doesnt teleport me
|
// [ 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(!ClickedOnMap(playerid)) sMapTeleport[playerid] = true;
pMapTeleport[playerid][0] = fX;
pMapTeleport[playerid][1] = fY;
pMapTeleport[playerid][2] = fZ;
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];
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
//if(IsPlayerAdmin(playerid)) /*Remove the "//"s if you wanna restrict it to rcon admins*/
SetPlayerPosFindZ(playerid, fX, fY, fZ);
return 1;
}