Tipok_Eazzy
Умник
Ко всем new
Ну и конечно же команду.
PHP:
new Float:TelePos[MAX_PLAYERS][6];
new tpadmin = 0;
PHP:
else if(strcmp(cmd, "/atp", true) == 0)
{
if(PlayerInfo[playerid][pAdmInections] < 2) return true;
if(!tpadmin)
{
new Float:PX,Float:PY,Float:PZ;
tpadmin = 1, GetPlayerPos(playerid,PX,PY,PZ);
format(stringer,sizeof(stringer),">> %s[%d]: Телепорт к админу, введите /gotp <<",PlayerInfo[playerid][pNames],playerid); sendAll( COLOR_YELLOW,stringer);
}
else if(tpadmin)
{
tpadmin = 0;
format(stringer,sizeof(stringer),">> %s[%d]: Телепорт закрыт <<",PlayerInfo[playerid][pNames],playerid); sendAll( COLOR_YELLOW,stringer);
}
}
else if(strcmp(cmd, "/gotp", true) == 0)
{
new Float:PX,Float:PY,Float:PZ;
if(tpadmin == 0) return SendClientMessage(playerid,COLOR_GREY,"Телепорт закрыт");
SetPlayerPos(playerid,PX,PY+1,PZ);
SetPlayerInterior(playerid,0);
SendClientMessage(playerid, COLOR_WHITE, "Вы телепортировались");
return true;
}
PHP:
new
Float:atpAdminPosX,
Float:atpAdminPosY,
Float:atpAdminPosZ,
atpAdminVirtualWorld,
atpAdminInterior,
bool:atpStatus;
CMD:atp(playerid, params[])
{
// Ваши проверки.
new
string[70 - 4 + MAX_PLAYER_NAME + 5];
if(atpStatus == false)
{
atpStatus = true;
GetPlayerPos(playerid, atpAdminPosX, atpAdminPosY, atpAdminPosZ);
atpAdminVirtualWorld = GetPlayerVirtualWorld(playerid);
atpAdminInterior = GetPlayerInterior(playerid);
GetPlayerName(playerid, string, MAX_PLAYER_NAME);
format(string, sizeof(string), "(( Администратор %s[%d] включил телепорт к себе. Используйте: /gotp ))", string, playerid);
SendClientMessageToAll(-1, string);
}
else
{
atpStatus = false;
GetPlayerName(playerid, string, MAX_PLAYER_NAME);
format(string, sizeof(string), "(( Администратор %s[%d] откючил телепорт к себе. ))", string, playerid);
SendClientMessageToAll(-1, string);
}
return 1;
}
CMD:gotp(playerid, params[])
{
if(atpStatus == false)
return SendClientMessage(playerid, -1, !"Ошибка: Телепорт к администрации закрыт.");
SetPlayerVirtualWorld(playerid, atpAdminVirtualWorld);
SetPlayerInterior(playerid, atpAdminInterior);
SetPlayerPos(playerid, atpAdminPosX, atpAdminPosY, atpAdminPosZ);
SendClientMessage(playerid, -1, !"Вы успешно телепортировались к администратору.");
return 1;
}
Последнее редактирование модератором:
