Katashi
Умник
Доброго времени суток, уважаемые читатели форума! От нечего делать решил написать системку слежения за игроками. 
Функционал системы:
- Информация о игроке ( Скин, уровень, пинг и прочее )
- Кликабельные кнопки для выдачи наказания ( Для появления курсора нужно нажать левую кнопку мыши )
- Возврат игрока на место с которого он начинал следить
- Ну и сам spectate :dn:
[HR][/HR]Функционал системы:
- Информация о игроке ( Скин, уровень, пинг и прочее )
- Кликабельные кнопки для выдачи наказания ( Для появления курсора нужно нажать левую кнопку мыши )
- Возврат игрока на место с которого он начинал следить
- Ну и сам spectate :dn:
Ну что, пожалуй начнем...
Ко всем new:
PHP:
enum specInfo
{
spectarete_id,
timer,
Float: sX,
Float: sY,
Float: sZ,
virtualWorld,
interior,
Float: specHP,
Float: specArmour,
ping,
gun_id,
ammo,
bool: inCar
}
new specPlayer[MAX_PLAYERS][specInfo];
new Text:SpectrateTD[17], PlayerText:pSpectrateTD[MAX_PLAYERS][10];
В паблик OnPlayerConnect:
PHP:
spectratePlayerTextdrawsLoad(playerid);
specPlayer[playerid][spectarete_id] = -1;
В паблик OnGameModeInt:
PHP:
spectrateTextdrawsLoad();
В паблик OnPlayerKeyStateChange:
PHP:
if(newkeys == 4)
{
if(specPlayer[playerid][spectarete_id] != -1) SelectTextDraw(playerid, 0x00FF00FF);
}
В паблик OnPlayerClickTextDraw:
PHP:
if(_:clickedid != INVALID_TEXT_DRAW)
{
if(clickedid == SpectrateTD[5]) SendClientMessage(playerid, -1, "Заменить на функцию бана");
if(clickedid == SpectrateTD[6]) SendClientMessage(playerid, -1, "Заменить на функцию вызова варна");
if(clickedid == SpectrateTD[7]) SendClientMessage(playerid, -1, "Заменить на функцию получения статистики");
if(clickedid == SpectrateTD[8]) SendClientMessage(playerid, -1, "Заменить на функцию вызова кика игрока");
if(clickedid == SpectrateTD[9]) CancelSelectTextDraw(playerid), stopSpectrate(playerid); // Exit
}
В конец мода / ко всем stock:
PHP:
stock startSpectrate(playerid, spec_id)
{
new string[128], name[24];
GetPlayerName(spec_id, name, sizeof(name));
specPlayer[playerid][gun_id] = GetPlayerWeapon(spec_id);
GetPlayerHealth(spec_id, specPlayer[playerid][specHP]);
GetPlayerArmour(spec_id, specPlayer[playerid][specArmour]);
specPlayer[playerid][ping] = GetPlayerPing(spec_id);
specPlayer[playerid][ammo] = GetPlayerAmmo(spec_id);
if(IsPlayerInAnyVehicle(spec_id)) specPlayer[playerid][inCar] = true;
else specPlayer[playerid][inCar] = false;
/* Формат текстдрайвов */
for(new i = 0; i <= 16; i++) TextDrawShowForPlayer(playerid, SpectrateTD[i]);
format(string, sizeof(string), "%s (id %d)", name, spec_id);
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][0], string);
format(string, sizeof(string), "Level - %d", GetPlayerScore(spec_id));
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][1], string);
format(string, sizeof(string), "Skin - %d", GetPlayerSkin(spec_id));
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][2], string);
format(string, sizeof(string), "Health - %.0f", specPlayer[playerid][specHP]);
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][3], string);
format(string, sizeof(string), "Armour - %.0f", specPlayer[playerid][specArmour]);
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][4], string);
if(specPlayer[playerid][inCar] == true) format(string, sizeof(string), "InVehicle - true");
else format(string, sizeof(string), "InVehicle - false");
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][5], string);
format(string, sizeof(string), "Ping - %d", specPlayer[playerid][ping]);
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][6], string);
format(string, sizeof(string), "%s", getGunName(specPlayer[playerid][gun_id]));
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][7], string);
format(string, sizeof(string), "Ammo - %d", specPlayer[playerid][ammo]);
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][8], string);
for(new i = 0; i <= 9; i++) PlayerTextDrawShow(playerid, pSpectrateTD[playerid][i]);
/* Сохранение позиции игрока */
GetPlayerPos(playerid, specPlayer[playerid][sX], specPlayer[playerid][sY], specPlayer[playerid][sZ]);
specPlayer[playerid][virtualWorld] = GetPlayerInterior(playerid);
specPlayer[playerid][interior] = GetPlayerVirtualWorld(playerid);
specPlayer[playerid][spectarete_id] = spec_id;
/* Переводим игрока в режим наблюдения */
TogglePlayerSpectating(playerid, true);
if(specPlayer[playerid][inCar] == true) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(spec_id), SPECTATE_MODE_NORMAL);
else PlayerSpectatePlayer(playerid, spec_id, SPECTATE_MODE_NORMAL);
specPlayer[playerid][timer] = SetTimerEx("spectrateTimer", 1000, true, "ii", playerid, spec_id);
return true;
}
stock stopSpectrate(playerid)
{
KillTimer(specPlayer[playerid][timer]);
specPlayer[playerid][spectarete_id] = -1;
TogglePlayerSpectating(playerid, false);
for(new i = 0; i <= 9; i++) PlayerTextDrawHide(playerid, pSpectrateTD[playerid][i]);
for(new i = 0; i <= 16; i++) TextDrawHideForPlayer(playerid, SpectrateTD[i]);
/* Возвращение игрока на место ухода в /sp */
SetPlayerPos(playerid, specPlayer[playerid][sX], specPlayer[playerid][sY], specPlayer[playerid][sZ]);
SetPlayerInterior(playerid, specPlayer[playerid][interior]);
SetPlayerVirtualWorld(playerid, specPlayer[playerid][virtualWorld]);
return true;
}
forward spectrateTimer(playerid, spec_id);
public spectrateTimer(playerid, spec_id)
{
if(!IsPlayerConnected(spec_id)) return stopSpectrate(playerid);
new string[128];
new Float: health, Float: Armour, bool: pInCar;
if(IsPlayerInAnyVehicle(spec_id)) pInCar = true;
else pInCar = false;
GetPlayerHealth(spec_id, health), GetPlayerArmour(spec_id, Armour);
format(string, sizeof(string), "Level - %d", GetPlayerScore(spec_id));
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][1], string);
format(string, sizeof(string), "Skin - %d", GetPlayerSkin(spec_id));
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][2], string);
if(health != specPlayer[playerid][specHP])
{
specPlayer[playerid][specHP] = health;
format(string, sizeof(string), "Health - %.0f", specPlayer[playerid][specHP]);
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][3], string);
}
if(Armour != specPlayer[playerid][specArmour])
{
specPlayer[playerid][specArmour] = Armour;
format(string, sizeof(string), "Armour - %.0f", specPlayer[playerid][specArmour]);
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][4], string);
}
if(specPlayer[playerid][inCar] != pInCar)
{
specPlayer[playerid][inCar] = pInCar;
if(specPlayer[playerid][inCar] == true) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(spec_id), SPECTATE_MODE_NORMAL);
else PlayerSpectatePlayer(playerid, spec_id, SPECTATE_MODE_NORMAL);
if(specPlayer[playerid][inCar] == true) format(string, sizeof(string), "InVehicle - true");
else format(string, sizeof(string), "InVehicle - false");
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][5], string);
}
if(GetPlayerPing(spec_id) != specPlayer[playerid][ping])
{
specPlayer[playerid][ping] = GetPlayerPing(spec_id);
format(string, sizeof(string), "Ping - %d", specPlayer[playerid][ping]);
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][6], string);
}
if(GetPlayerWeapon(spec_id) != specPlayer[playerid][gun_id])
{
specPlayer[playerid][gun_id] = GetPlayerWeapon(spec_id);
format(string, sizeof(string), "%s", getGunName(specPlayer[playerid][gun_id]));
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][7], string);
}
if(GetPlayerAmmo(spec_id) != specPlayer[playerid][ammo])
{
specPlayer[playerid][ammo] = GetPlayerAmmo(spec_id);
format(string, sizeof(string), "Ammo - %d", specPlayer[playerid][ammo]);
PlayerTextDrawSetString(playerid, pSpectrateTD[playerid][8], string);
}
return true;
}
stock spectrateTextdrawsLoad()
{
SpectrateTD[0] = TextDrawCreate(497.555480, 107.066703, "box");
TextDrawLetterSize(SpectrateTD[0], 0.000000, 30.333816);
TextDrawTextSize(SpectrateTD[0], 631.000000, 0.000000);
TextDrawAlignment(SpectrateTD[0], 1);
TextDrawColor(SpectrateTD[0], -1);
TextDrawUseBox(SpectrateTD[0], 1);
TextDrawBoxColor(SpectrateTD[0], 157);
TextDrawSetShadow(SpectrateTD[0], 0);
TextDrawSetOutline(SpectrateTD[0], 0);
TextDrawBackgroundColor(SpectrateTD[0], 23);
TextDrawFont(SpectrateTD[0], 1);
TextDrawSetProportional(SpectrateTD[0], 1);
TextDrawSetShadow(SpectrateTD[0], 0);
SpectrateTD[1] = TextDrawCreate(537.847839, 104.833335, "Spectate~n~");
TextDrawLetterSize(SpectrateTD[1], 0.356427, 1.325832);
TextDrawAlignment(SpectrateTD[1], 1);
TextDrawColor(SpectrateTD[1], -1);
TextDrawSetShadow(SpectrateTD[1], 194);
TextDrawSetOutline(SpectrateTD[1], -1);
TextDrawBackgroundColor(SpectrateTD[1], 255);
TextDrawFont(SpectrateTD[1], 1);
TextDrawSetProportional(SpectrateTD[1], 1);
TextDrawSetShadow(SpectrateTD[1], 194);
SpectrateTD[2] = TextDrawCreate(497.423645, 107.066688, "box");
TextDrawLetterSize(SpectrateTD[2], 0.000000, 1.095798);
TextDrawTextSize(SpectrateTD[2], 631.000000, 0.000000);
TextDrawAlignment(SpectrateTD[2], 1);
TextDrawColor(SpectrateTD[2], -1);
TextDrawUseBox(SpectrateTD[2], 1);
TextDrawBoxColor(SpectrateTD[2], 14549147);
TextDrawSetShadow(SpectrateTD[2], 0);
TextDrawSetOutline(SpectrateTD[2], 0);
TextDrawBackgroundColor(SpectrateTD[2], 255);
TextDrawFont(SpectrateTD[2], 1);
TextDrawSetProportional(SpectrateTD[2], 1);
TextDrawSetShadow(SpectrateTD[2], 0);
SpectrateTD[3] = TextDrawCreate(497.254608, 140.233474, "box");
TextDrawLetterSize(SpectrateTD[3], 0.000000, -0.448020);
TextDrawTextSize(SpectrateTD[3], 631.000244, 0.000000);
TextDrawAlignment(SpectrateTD[3], 1);
TextDrawColor(SpectrateTD[3], -1);
TextDrawUseBox(SpectrateTD[3], 1);
TextDrawBoxColor(SpectrateTD[3], 10879231);
TextDrawSetShadow(SpectrateTD[3], 0);
TextDrawSetOutline(SpectrateTD[3], 0);
TextDrawBackgroundColor(SpectrateTD[3], 255);
TextDrawFont(SpectrateTD[3], 1);
TextDrawSetProportional(SpectrateTD[3], 1);
TextDrawSetShadow(SpectrateTD[3], 0);
SpectrateTD[4] = TextDrawCreate(497.254608, 301.743316, "box");
TextDrawLetterSize(SpectrateTD[4], 0.000000, -0.448020);
TextDrawTextSize(SpectrateTD[4], 631.000244, 0.000000);
TextDrawAlignment(SpectrateTD[4], 1);
TextDrawColor(SpectrateTD[4], -1);
TextDrawUseBox(SpectrateTD[4], 1);
TextDrawBoxColor(SpectrateTD[4], 10879231);
TextDrawSetShadow(SpectrateTD[4], 0);
TextDrawSetOutline(SpectrateTD[4], 0);
TextDrawBackgroundColor(SpectrateTD[4], 255);
TextDrawFont(SpectrateTD[4], 1);
TextDrawSetProportional(SpectrateTD[4], 1);
TextDrawSetShadow(SpectrateTD[4], 0);
SpectrateTD[5] = TextDrawCreate(499.260711, 329.416534, "LD_SPAC:white");
TextDrawLetterSize(SpectrateTD[5], 0.000000, 0.000000);
TextDrawTextSize(SpectrateTD[5], 62.000000, 22.000000);
TextDrawAlignment(SpectrateTD[5], 1);
TextDrawColor(SpectrateTD[5], 9437439);
TextDrawSetShadow(SpectrateTD[5], 0);
TextDrawSetOutline(SpectrateTD[5], 0);
TextDrawBackgroundColor(SpectrateTD[5], 255);
TextDrawFont(SpectrateTD[5], 4);
TextDrawSetProportional(SpectrateTD[5], 0);
TextDrawSetShadow(SpectrateTD[5], 0);
TextDrawSetSelectable(SpectrateTD[5], true);
SpectrateTD[6] = TextDrawCreate(565.800292, 329.316497, "LD_SPAC:white");
TextDrawLetterSize(SpectrateTD[6], 0.000000, 0.000000);
TextDrawTextSize(SpectrateTD[6], 62.000000, 22.000000);
TextDrawAlignment(SpectrateTD[6], 1);
TextDrawColor(SpectrateTD[6], 9437439);
TextDrawSetShadow(SpectrateTD[6], 0);
TextDrawSetOutline(SpectrateTD[6], 0);
TextDrawBackgroundColor(SpectrateTD[6], 255);
TextDrawFont(SpectrateTD[6], 4);
TextDrawSetProportional(SpectrateTD[6], 0);
TextDrawSetShadow(SpectrateTD[6], 0);
TextDrawSetSelectable(SpectrateTD[6], true);
SpectrateTD[7] = TextDrawCreate(565.800292, 303.649810, "LD_SPAC:white");
TextDrawLetterSize(SpectrateTD[7], 0.000000, 0.000000);
TextDrawTextSize(SpectrateTD[7], 62.000000, 22.000000);
TextDrawAlignment(SpectrateTD[7], 1);
TextDrawColor(SpectrateTD[7], 9437439);
TextDrawSetShadow(SpectrateTD[7], 0);
TextDrawSetOutline(SpectrateTD[7], 0);
TextDrawBackgroundColor(SpectrateTD[7], 255);
TextDrawFont(SpectrateTD[7], 4);
TextDrawSetProportional(SpectrateTD[7], 0);
TextDrawSetShadow(SpectrateTD[7], 0);
TextDrawSetSelectable(SpectrateTD[7], true);
SpectrateTD[8] = TextDrawCreate(499.270111, 303.649871, "LD_SPAC:white");
TextDrawLetterSize(SpectrateTD[8], 0.000000, 0.000000);
TextDrawTextSize(SpectrateTD[8], 62.000000, 22.000000);
TextDrawAlignment(SpectrateTD[8], 1);
TextDrawColor(SpectrateTD[8], 9437439);
TextDrawSetShadow(SpectrateTD[8], 0);
TextDrawSetOutline(SpectrateTD[8], 0);
TextDrawBackgroundColor(SpectrateTD[8], 255);
TextDrawFont(SpectrateTD[8], 4);
TextDrawSetProportional(SpectrateTD[8], 0);
TextDrawSetShadow(SpectrateTD[8], 0);
TextDrawSetSelectable(SpectrateTD[8], true);
SpectrateTD[9] = TextDrawCreate(499.738555, 354.983215, "LD_SPAC:white");
TextDrawLetterSize(SpectrateTD[9], 0.000000, 0.000000);
TextDrawTextSize(SpectrateTD[9], 128.000000, 22.000000);
TextDrawAlignment(SpectrateTD[9], 1);
TextDrawColor(SpectrateTD[9], 9437439);
TextDrawSetShadow(SpectrateTD[9], 0);
TextDrawSetOutline(SpectrateTD[9], 0);
TextDrawBackgroundColor(SpectrateTD[9], 255);
TextDrawFont(SpectrateTD[9], 4);
TextDrawSetProportional(SpectrateTD[9], 0);
TextDrawSetShadow(SpectrateTD[9], 0);
TextDrawSetSelectable(SpectrateTD[9], true);
SpectrateTD[10] = TextDrawCreate(554.631774, 360.310943, "Exit~n~");
TextDrawLetterSize(SpectrateTD[10], 0.324566, 1.401664);
TextDrawAlignment(SpectrateTD[10], 1);
TextDrawColor(SpectrateTD[10], -1);
TextDrawSetShadow(SpectrateTD[10], 194);
TextDrawSetOutline(SpectrateTD[10], -1);
TextDrawBackgroundColor(SpectrateTD[10], 255);
TextDrawFont(SpectrateTD[10], 1);
TextDrawSetProportional(SpectrateTD[10], 1);
TextDrawSetShadow(SpectrateTD[10], 194);
SpectrateTD[11] = TextDrawCreate(553.711486, 240.554992, "Gun~n~");
TextDrawLetterSize(SpectrateTD[11], 0.324566, 1.401664);
TextDrawAlignment(SpectrateTD[11], 1);
TextDrawColor(SpectrateTD[11], -1);
TextDrawSetShadow(SpectrateTD[11], 194);
TextDrawSetOutline(SpectrateTD[11], -1);
TextDrawBackgroundColor(SpectrateTD[11], 255);
TextDrawFont(SpectrateTD[11], 1);
TextDrawSetProportional(SpectrateTD[11], 1);
TextDrawSetShadow(SpectrateTD[11], 194);
SpectrateTD[12] = TextDrawCreate(497.391662, 239.350265, "box");
TextDrawLetterSize(SpectrateTD[12], 0.000000, -0.448020);
TextDrawTextSize(SpectrateTD[12], 630.701660, 0.000000);
TextDrawAlignment(SpectrateTD[12], 1);
TextDrawColor(SpectrateTD[12], -1);
TextDrawUseBox(SpectrateTD[12], 1);
TextDrawBoxColor(SpectrateTD[12], 10879231);
TextDrawSetShadow(SpectrateTD[12], 0);
TextDrawSetOutline(SpectrateTD[12], 0);
TextDrawBackgroundColor(SpectrateTD[12], 255);
TextDrawFont(SpectrateTD[12], 1);
TextDrawSetProportional(SpectrateTD[12], 1);
TextDrawSetShadow(SpectrateTD[12], 0);
SpectrateTD[13] = TextDrawCreate(518.720031, 307.642395, "Kick~n~");
TextDrawLetterSize(SpectrateTD[13], 0.324566, 1.401664);
TextDrawAlignment(SpectrateTD[13], 1);
TextDrawColor(SpectrateTD[13], -1);
TextDrawSetShadow(SpectrateTD[13], 194);
TextDrawSetOutline(SpectrateTD[13], -1);
TextDrawBackgroundColor(SpectrateTD[13], 255);
TextDrawFont(SpectrateTD[13], 1);
TextDrawSetProportional(SpectrateTD[13], 1);
TextDrawSetShadow(SpectrateTD[13], 194);
SpectrateTD[14] = TextDrawCreate(586.203552, 307.891876, "Stats~n~");
TextDrawLetterSize(SpectrateTD[14], 0.324566, 1.401664);
TextDrawAlignment(SpectrateTD[14], 1);
TextDrawColor(SpectrateTD[14], -1);
TextDrawSetShadow(SpectrateTD[14], 194);
TextDrawSetOutline(SpectrateTD[14], -1);
TextDrawBackgroundColor(SpectrateTD[14], 255);
TextDrawFont(SpectrateTD[14], 1);
TextDrawSetProportional(SpectrateTD[14], 1);
TextDrawSetShadow(SpectrateTD[14], 194);
SpectrateTD[15] = TextDrawCreate(520.619567, 333.243957, "Ban~n~");
TextDrawLetterSize(SpectrateTD[15], 0.324566, 1.401664);
TextDrawAlignment(SpectrateTD[15], 1);
TextDrawColor(SpectrateTD[15], -1);
TextDrawSetShadow(SpectrateTD[15], 194);
TextDrawSetOutline(SpectrateTD[15], -1);
TextDrawBackgroundColor(SpectrateTD[15], 255);
TextDrawFont(SpectrateTD[15], 1);
TextDrawSetProportional(SpectrateTD[15], 1);
TextDrawSetShadow(SpectrateTD[15], 194);
SpectrateTD[16] = TextDrawCreate(585.503723, 335.577301, "Warn~n~");
TextDrawLetterSize(SpectrateTD[16], 0.324566, 1.401664);
TextDrawAlignment(SpectrateTD[16], 1);
TextDrawColor(SpectrateTD[16], -1);
TextDrawSetShadow(SpectrateTD[16], 194);
TextDrawSetOutline(SpectrateTD[16], -1);
TextDrawBackgroundColor(SpectrateTD[16], 255);
TextDrawFont(SpectrateTD[16], 1);
TextDrawSetProportional(SpectrateTD[16], 1);
TextDrawSetShadow(SpectrateTD[16], 194);
return true;
}
stock spectratePlayerTextdrawsLoad(playerid)
{
pSpectrateTD[playerid][0] = CreatePlayerTextDraw(playerid, 515.358642, 121.749977, "Dante_Rivero_(id_81)");
PlayerTextDrawLetterSize(playerid, pSpectrateTD[playerid][0], 0.324566, 1.401664);
PlayerTextDrawAlignment(playerid, pSpectrateTD[playerid][0], 1);
PlayerTextDrawColor(playerid, pSpectrateTD[playerid][0], -1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][0], 194);
PlayerTextDrawSetOutline(playerid, pSpectrateTD[playerid][0], -1);
PlayerTextDrawBackgroundColor(playerid, pSpectrateTD[playerid][0], 255);
PlayerTextDrawFont(playerid, pSpectrateTD[playerid][0], 1);
PlayerTextDrawSetProportional(playerid, pSpectrateTD[playerid][0], 1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][0], 194);
pSpectrateTD[playerid][1] = CreatePlayerTextDraw(playerid, 502.707977, 145.666763, "Level_-_12");
PlayerTextDrawLetterSize(playerid, pSpectrateTD[playerid][1], 0.324566, 1.401664);
PlayerTextDrawAlignment(playerid, pSpectrateTD[playerid][1], 1);
PlayerTextDrawColor(playerid, pSpectrateTD[playerid][1], -1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][1], 194);
PlayerTextDrawSetOutline(playerid, pSpectrateTD[playerid][1], -1);
PlayerTextDrawBackgroundColor(playerid, pSpectrateTD[playerid][1], 255);
PlayerTextDrawFont(playerid, pSpectrateTD[playerid][1], 1);
PlayerTextDrawSetProportional(playerid, pSpectrateTD[playerid][1], 1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][1], 194);
pSpectrateTD[playerid][2] = CreatePlayerTextDraw(playerid, 569.179382, 146.250061, "Skin_-_87");
PlayerTextDrawLetterSize(playerid, pSpectrateTD[playerid][2], 0.324566, 1.401664);
PlayerTextDrawAlignment(playerid, pSpectrateTD[playerid][2], 1);
PlayerTextDrawColor(playerid, pSpectrateTD[playerid][2], -1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][2], 194);
PlayerTextDrawSetOutline(playerid, pSpectrateTD[playerid][2], -1);
PlayerTextDrawBackgroundColor(playerid, pSpectrateTD[playerid][2], 255);
PlayerTextDrawFont(playerid, pSpectrateTD[playerid][2], 1);
PlayerTextDrawSetProportional(playerid, pSpectrateTD[playerid][2], 1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][2], 194);
pSpectrateTD[playerid][3] = CreatePlayerTextDraw(playerid, 524.467712, 164.267898, "Health_-_100.0");
PlayerTextDrawLetterSize(playerid, pSpectrateTD[playerid][3], 0.324566, 1.401664);
PlayerTextDrawAlignment(playerid, pSpectrateTD[playerid][3], 1);
PlayerTextDrawColor(playerid, pSpectrateTD[playerid][3], -1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][3], 194);
PlayerTextDrawSetOutline(playerid, pSpectrateTD[playerid][3], -1);
PlayerTextDrawBackgroundColor(playerid, pSpectrateTD[playerid][3], 255);
PlayerTextDrawFont(playerid, pSpectrateTD[playerid][3], 1);
PlayerTextDrawSetProportional(playerid, pSpectrateTD[playerid][3], 1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][3], 194);
pSpectrateTD[playerid][4] = CreatePlayerTextDraw(playerid, 524.967590, 180.552185, "Armour_-_0.0");
PlayerTextDrawLetterSize(playerid, pSpectrateTD[playerid][4], 0.324566, 1.401664);
PlayerTextDrawAlignment(playerid, pSpectrateTD[playerid][4], 1);
PlayerTextDrawColor(playerid, pSpectrateTD[playerid][4], -1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][4], 194);
PlayerTextDrawSetOutline(playerid, pSpectrateTD[playerid][4], -1);
PlayerTextDrawBackgroundColor(playerid, pSpectrateTD[playerid][4], 255);
PlayerTextDrawFont(playerid, pSpectrateTD[playerid][4], 1);
PlayerTextDrawSetProportional(playerid, pSpectrateTD[playerid][4], 1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][4], 194);
pSpectrateTD[playerid][5] = CreatePlayerTextDraw(playerid, 520.519592, 197.252349, "InVehicle_-_false~n~");
PlayerTextDrawLetterSize(playerid, pSpectrateTD[playerid][5], 0.324566, 1.401664);
PlayerTextDrawAlignment(playerid, pSpectrateTD[playerid][5], 1);
PlayerTextDrawColor(playerid, pSpectrateTD[playerid][5], -1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][5], 194);
PlayerTextDrawSetOutline(playerid, pSpectrateTD[playerid][5], -1);
PlayerTextDrawBackgroundColor(playerid, pSpectrateTD[playerid][5], 255);
PlayerTextDrawFont(playerid, pSpectrateTD[playerid][5], 1);
PlayerTextDrawSetProportional(playerid, pSpectrateTD[playerid][5], 1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][5], 194);
pSpectrateTD[playerid][6] = CreatePlayerTextDraw(playerid, 536.668884, 214.785705, "Ping_-_112");
PlayerTextDrawLetterSize(playerid, pSpectrateTD[playerid][6], 0.324566, 1.401664);
PlayerTextDrawAlignment(playerid, pSpectrateTD[playerid][6], 1);
PlayerTextDrawColor(playerid, pSpectrateTD[playerid][6], -1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][6], 194);
PlayerTextDrawSetOutline(playerid, pSpectrateTD[playerid][6], -1);
PlayerTextDrawBackgroundColor(playerid, pSpectrateTD[playerid][6], 255);
PlayerTextDrawFont(playerid, pSpectrateTD[playerid][6], 1);
PlayerTextDrawSetProportional(playerid, pSpectrateTD[playerid][6], 1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][6], 194);
pSpectrateTD[playerid][7] = CreatePlayerTextDraw(playerid, 501.521026, 257.055999, "Desert_Eagle_(id_24)");
PlayerTextDrawLetterSize(playerid, pSpectrateTD[playerid][7], 0.324566, 1.401664);
PlayerTextDrawAlignment(playerid, pSpectrateTD[playerid][7], 1);
PlayerTextDrawColor(playerid, pSpectrateTD[playerid][7], -1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][7], 194);
PlayerTextDrawSetOutline(playerid, pSpectrateTD[playerid][7], -1);
PlayerTextDrawBackgroundColor(playerid, pSpectrateTD[playerid][7], 255);
PlayerTextDrawFont(playerid, pSpectrateTD[playerid][7], 1);
PlayerTextDrawSetProportional(playerid, pSpectrateTD[playerid][7], 1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][7], 194);
pSpectrateTD[playerid][8] = CreatePlayerTextDraw(playerid, 501.321014, 275.440429, "Ammo_-_54");
PlayerTextDrawLetterSize(playerid, pSpectrateTD[playerid][8], 0.324566, 1.401664);
PlayerTextDrawAlignment(playerid, pSpectrateTD[playerid][8], 1);
PlayerTextDrawColor(playerid, pSpectrateTD[playerid][8], -1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][8], 194);
PlayerTextDrawSetOutline(playerid, pSpectrateTD[playerid][8], -1);
PlayerTextDrawBackgroundColor(playerid, pSpectrateTD[playerid][8], 255);
PlayerTextDrawFont(playerid, pSpectrateTD[playerid][8], 1);
PlayerTextDrawSetProportional(playerid, pSpectrateTD[playerid][8], 1);
PlayerTextDrawSetShadow(playerid, pSpectrateTD[playerid][8], 194);
return true;
}
stock getGunName(id)
{
new gun_name[20];
switch(id)
{
case 22: format(gun_name, sizeof(gun_name), "9mm pistol");
case 23: format(gun_name, sizeof(gun_name), "Silenced 9mm");
case 24: format(gun_name, sizeof(gun_name), "Desert Eagle");
case 25: format(gun_name, sizeof(gun_name), "Shotgun");
case 26: format(gun_name, sizeof(gun_name), "Sawnoff Shotgun");
case 27: format(gun_name, sizeof(gun_name), "Combat Shotgun");
case 28: format(gun_name, sizeof(gun_name), "Micro SMG/UZI");
case 29: format(gun_name, sizeof(gun_name), "MP5");
case 30: format(gun_name, sizeof(gun_name), "AK-47");
case 31: format(gun_name, sizeof(gun_name), "M4");
case 32: format(gun_name, sizeof(gun_name), "Tec-9");
case 33: format(gun_name, sizeof(gun_name), "Country Rifle");
case 34: format(gun_name, sizeof(gun_name), "Sniper Rifle");
case 35: format(gun_name, sizeof(gun_name), "RPG");
case 36: format(gun_name, sizeof(gun_name), "HS Rocket");
case 37: format(gun_name, sizeof(gun_name), "Flamethrower");
case 38: format(gun_name, sizeof(gun_name), "Minigun");
default: format(gun_name, sizeof(gun_name), "Not defined");
}
return gun_name;
}
Сама команда /sp.
ZCMD:
ZCMD:
PHP:
CMD:sp(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1) return true; // Заменить на свой массив с данными игрока
if(sscanf(params, "i", params[0])) return SendClientMessage(playerid, 0xBEBEBEFF, "Используйте /sp [id]");
if(params[0] > 1000 || params[0] < 0) return SendClientMessage(playerid, 0xBEBEBEFF, "Используйте /sp [id]");
if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid, 0xBEBEBEFF, "Игрок не авторизован!");
if(params[0] == playerid) return SendClientMessage(playerid, 0xBEBEBEFF, "Вы не можете следить за собой!");
startSpectrate(playerid, params[0]);
return true;
}
Стандартный командный процессор:
PHP:
if(!strcmp(cmd, "/sp", true))
{
cmd = strtok(cmdtext, idx);
if(PlayerInfo[playerid][pAdmin] < 1) return true; // Заменить на свой массив с данными игрока
if(!strlen(cmd)) return SendClientMessage(playerid, 0xBEBEBEFF, "Используйте /sp [id]");
new id = strval(cmd);
if(id > 1000 || id < 0) return SendClientMessage(playerid, 0xBEBEBEFF, "Используйте /sp [id]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xBEBEBEFF, "Игрок не авторизован!");
if(id == playerid) return SendClientMessage(playerid, 0xBEBEBEFF, "Вы не можете следить за собой!");
startSpectrate(playerid, id);
return 1;
}
Система написана за час и почти не тестировалась, так что если Вы нашли баг - прошу отписать в теме. :ay:
С уважением, Katashi!
С уважением, Katashi!
Последнее редактирование:
