20.08.2018, 10:13
Did in this way:
But i'm getting "undefinel symbol: randomloc" at /last command.
pawn Код:
new const g_LocationData[][e_LocData] =
{
{"Bank", 2315.952880, -1.618174, 26.742187},
{"LS Atrium", 1710.433715, -1669.379272, 20.225049}
};
enum e_LocData
{
e_LocName[32],
Float:e_LocX,
Float:e_LocY,
Float:e_LocZ
};
CMD:tele(playerid, params[])
(
new randomloc = random(sizeof(g_LocationData));
new Msg[48];
format(Msg, sizeof(Msg), "Teleported to: %s", g_LocationData[randomloc][e_LocName]);
SetPlayerPos(playerid, g_LocationData[randomloc][e_LocX], g_LocationData[randomloc][e_LocY], g_LocationData[randomloc][e_LocZ]);
SendClientMessage(playerid, -1, Msg);
SetPVarString(playerid,"RandomLocation",g_LocationData[randomloc][e_LocName]);
return 1;
)
CMD:last(playerid, params[])
{
new string[80];
GetPVarString(playerid, "RandomLocation",g_LocationData[randomloc][e_LocName]);
format(string, sizeof(string), "Last teleport was to: %s" GetPVarString(playerid, "RandomLocation",g_LocationData[randomloc][e_LocName]));
return 1
}