09.11.2014, 19:17
I need help making a /goto XYZ
or a new cmd called
/gotoco / /gotoxyz
I got this command what is my /goto cmd, but when I try to add it to be able to teleport by cords, it bugs. If anyone could help me, it would be great.
or a new cmd called
/gotoco / /gotoxyz
I got this command what is my /goto cmd, but when I try to add it to be able to teleport by cords, it bugs. If anyone could help me, it would be great.
Код:
CMD:goto(playerid, params[])
{
static
id,
type[24],
string[64];
if (PlayerData[playerid][pAdmin] < 1)
return SendErrorMessage(playerid, "You don't have permission to use this command.");
if (sscanf(params, "u", id))
{
SendSyntaxMessage(playerid, "/goto [player or name]");
SendClientMessage(playerid, COLOR_YELLOW, "[NAMES]:{FFFFFF} spawn, prison, house, business, entrance, job, gate, interior, billboard");
return 1;
}
if (id == INVALID_PLAYER_ID)
{
if (sscanf(params, "s[24]S()[64]", type, string))
{
SendSyntaxMessage(playerid, "/goto [player or name]");
SendClientMessage(playerid, COLOR_YELLOW, "[NAMES]:{FFFFFF} spawn, prison, house, business, entrance, job, gate, interior, billboard");
return 1;
}
if (!strcmp(type, "spawn", true)) {
SetDefaultSpawn(playerid);
return SendServerMessage(playerid, "You have teleported to the default spawn.");
}
else if (!strcmp(type, "prison", true))
{
SetPlayerPos(playerid, 283.5930, 1413.3511, 10.4078);
SetPlayerFacingAngle(playerid, 180.0000);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
return SendServerMessage(playerid, "You have teleported to the prison facility.");
}
//
else if (!strcmp(type, "billboard", true))
{
if (sscanf(string, "d", id))
return SendSyntaxMessage(playerid, "/goto [billboard] [billboard ID]");
if ((id < 0 || id >= MAX_BILLBOARDS) || !BillBoardData[id][bbExists])
return SendErrorMessage(playerid, "You have specified an invalid billboard ID.");
SetPlayerPos(playerid, BillBoardData[id][bbPos][0], BillBoardData[id][bbPos][1], BillBoardData[id][bbPos][2]);
SendServerMessage(playerid, "You have teleported to billboard ID: %d.", id);
return 1;
}
//
else if (!strcmp(type, "house", true))
{
if (sscanf(string, "d", id))
return SendSyntaxMessage(playerid, "/goto [house] [house ID]");
if ((id < 0 || id >= MAX_HOUSES) || !HouseData[id][houseExists])
return SendErrorMessage(playerid, "You have specified an invalid house ID.");
SetPlayerPos(playerid, HouseData[id][housePos][0], HouseData[id][housePos][1], HouseData[id][housePos][2]);
SetPlayerInterior(playerid, HouseData[id][houseExterior]);
SetPlayerVirtualWorld(playerid, HouseData[id][houseExteriorVW]);
SendServerMessage(playerid, "You have teleported to house ID: %d.", id);
return 1;
}
else if (!strcmp(type, "business", true))
{
if (sscanf(string, "d", id))
return SendSyntaxMessage(playerid, "/goto [business] [business ID]");
if ((id < 0 || id >= MAX_BUSINESSES) || !BusinessData[id][bizExists])
return SendErrorMessage(playerid, "You have specified an invalid business ID.");
SetPlayerPos(playerid, BusinessData[id][bizPos][0], BusinessData[id][bizPos][1], BusinessData[id][bizPos][2]);
SetPlayerInterior(playerid, BusinessData[id][bizExterior]);
SetPlayerVirtualWorld(playerid, BusinessData[id][bizExteriorVW]);
SendServerMessage(playerid, "You have teleported to business ID: %d.", id);
return 1;
}
else if (!strcmp(type, "entrance", true))
{
if (sscanf(string, "d", id))
return SendSyntaxMessage(playerid, "/goto [entrance] [entrance ID]");
if ((id < 0 || id >= MAX_ENTRANCES) || !EntranceData[id][entranceExists])
return SendErrorMessage(playerid, "You have specified an invalid entrance ID.");
SetPlayerPos(playerid, EntranceData[id][entrancePos][0], EntranceData[id][entrancePos][1], EntranceData[id][entrancePos][2]);
SetPlayerInterior(playerid, EntranceData[id][entranceExterior]);
SetPlayerVirtualWorld(playerid, EntranceData[id][entranceExteriorVW]);
SendServerMessage(playerid, "You have teleported to entrance ID: %d.", id);
return 1;
}
else if (!strcmp(type, "job", true))
{
if (sscanf(string, "d", id))
return SendSyntaxMessage(playerid, "/goto [job] [job ID]");
if ((id < 0 || id >= MAX_DYNAMIC_JOBS) || !JobData[id][jobExists])
return SendErrorMessage(playerid, "You have specified an invalid job ID.");
SetPlayerPos(playerid, JobData[id][jobPos][0], JobData[id][jobPos][1], JobData[id][jobPos][2]);
SetPlayerInterior(playerid, JobData[id][jobInterior]);
SetPlayerVirtualWorld(playerid, JobData[id][jobWorld]);
SendServerMessage(playerid, "You have teleported to job ID: %d.", id);
return 1;
}
else if (!strcmp(type, "gate", true))
{
if (sscanf(string, "d", id))
return SendSyntaxMessage(playerid, "/goto [gate] [gate ID]");
if ((id < 0 || id >= MAX_GATES) || !GateData[id][gateExists])
return SendErrorMessage(playerid, "You have specified an invalid gate ID.");
SetPlayerPos(playerid, GateData[id][gatePos][0] - (2.5 * floatsin(-GateData[id][gatePos][3], degrees)), GateData[id][gatePos][1] - (2.5 * floatcos(-GateData[id][gatePos][3], degrees)), GateData[id][gatePos][2]);
SetPlayerInterior(playerid, GateData[id][gateInterior]);
SetPlayerVirtualWorld(playerid, GateData[id][gateWorld]);
SendServerMessage(playerid, "You have teleported to gate ID: %d.", id);
return 1;
}
else if (!strcmp(type, "interior", true))
{
static
str[1536];
str[0] = '\0';
for (new i = 0; i < sizeof(g_arrInteriorData); i ++) {
strcat(str, g_arrInteriorData[i][e_InteriorName]);
strcat(str, "\n");
}
Dialog_Show(playerid, TeleportInterior, DIALOG_STYLE_LIST, "Teleport: Interior List", str, "Select", "Cancel");
return 1;
}
else return SendErrorMessage(playerid, "You have specified an invalid player.");
}
if (!IsPlayerSpawned(id))
return SendErrorMessage(playerid, "You can't teleport to a player that's not spawned.");
SendPlayerToPlayer(playerid, id);
format(string, sizeof(string), "You have ~y~teleported~w~ to %s.", ReturnName(id, 0));
ShowPlayerFooter(playerid, string);
return 1;
}


