Форум Donate Engine

Поддержка CMS Donate Engine

Вы не вошли.

#1 2015-06-05 21:46:06

Forsa
Пользователь
Регистрация: 2015-05-18
Кол-во сообщений: 67

Панель слежения за игроками

Здарова всем, вот написал панель слежения за игрком.
Расскажу о минусах данной темы: Нет GMTest (не сделан нормальный), не статистики (выведите в своем моде сами), нет GetIp (почти в каждом моде есть, посмотрите у себя). Все на MySQL R6 (Кому нужна таблица Ban) => пишите в ПМ.
И так, код:
В public OnPlayerConnect(playerid)

PressA = TextDrawCreate(425.000000,120.000000,"~w~Player: Samp_Player");
TextDrawLetterSize(PressA,0.259999,1.110000);
TextDrawFont(PressA,2);
TextDrawBackgroundColor(PressA,COLOR_BLACK);
TextDrawColor(PressA,COLOR_BBLUE);
TextDrawSetOutline(PressA,1);
TextDrawSetProportional(PressA,1);
TextDrawSetShadow(PressA,1);

В PlayerSelectedMenuRow(playerid, row)

new Menu:CurrentMenu = GetPlayerMenu(playerid);
if(CurrentMenu == specmenu)
{
    switch(row)
    {
        case 0: SendClientMessage(playerid, COLOR_LIGHTRED, "GMTest пока недоступен!"), ShowMenuForPlayer(specmenu  ,playerid);
        case 1:
        {
        ShowMenuForPlayer(specmenu,playerid);
        if(PlayerInfo[GetPVarInt(playerid,"SpecID")][pMuted] <= 0)
        {
        format(string, 120, "%s выдал бан чата %s",pNameEx(playerid),pNameEx(GetPVarInt(playerid,"SpecID")));
        SendClientMessageToAll(COLOR_LIGHTRED, string);
        GameTextForPlayer(GetPVarInt(playerid,"SpecID"), "~r~MUTED", 5000, 1);
        PlayerInfo[GetPVarInt(playerid,"SpecID")][pMuted] = 60*60;
        }
        else
        {
        GameTextForPlayer(GetPVarInt(playerid,"SpecID"), "~g~UNMUTED", 5000, 1);
        PlayerInfo[GetPVarInt(playerid,"SpecID")][pMuted] = 0;
        }
        }
        case 2: ShowPlayerDialog(playerid, 8,DIALOG_STYLE_INPUT,"Причина кика"," ","Kick","Íàçàä"), ShowMenuForPlayer(specmenu,playerid), SetPVarInt(playerid,"SpecType", 1);
        case 3: ShowPlayerDialog(playerid, 8, DIALOG_STYLE_INPUT, "Причина варна"," ","Warn","Íàçàä"), ShowMenuForPlayer(specmenu,playerid), SetPVarInt(playerid,"SpecType", 2);
        case 4: ShowPlayerDialog(playerid, 8, DIALOG_STYLE_INPUT, "Причина бана"," ","Ban","Íàçàä"), ShowMenuForPlayer(specmenu,playerid), SetPVarInt(playerid,"SpecType", 3);
        case 5:
		{
		ShowMenuForPlayer(specmenu,playerid);
		new Float:shealth,Float:slx, Float:sly, Float:slz;
		GetPlayerHealth(GetPVarInt(playerid,"SpecID"), shealth);
		GetPlayerPos(GetPVarInt(playerid,"SpecID"), slx, sly, slz);
		SetPlayerPos(GetPVarInt(playerid,"SpecID"), slx, sly, slz+5);
		PlayerPlaySound(GetPVarInt(playerid,"SpecID"), 1130, slx, sly, slz+5);
		SendMes(playerid, COLOR_WHITE, "Вы дали поджопник игроку: %s",sendername(GetPVarInt(playerid,"SpecID")));
		SendMes(GetPVarInt(playerid,"SpecID"), COLOR_LIGHTRED, "Администратор %s дал вам пинок %s",sendername(playerid));
		}
		case 6: SendMes(playerid, COLOR_WHITE, "Статистика недоступна!");
		case 7:
		{
		ShowMenuForPlayer(specmenu,playerid);
		new ip[16];
		GetPlayerIp(GetPVarInt(playerid,"SpecID"), ip, 16);
		SendClientMessage(playerid, COLOR_WHITE, "Статистика IP адреса недоступна!");
		}
		case 8: TogglePlayerSpectating(playerid,false), SendClientMessage(playerid, COLOR_LIGHTRED, "Наблюдение завершено!"), TextDrawHideForPlayer(playerid,PressA), HideMenuForPlayer(specmenu,playerid);
    }

В OnDialogResponse у меня на кейсах (быстрее), поэтому здесь case big_smile

case 8:
		{
		if(GetPVarInt(playerid, "SpecType") == 1)
		{
			if(!response) return 1;
		    if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 8, DIALOG_STYLE_INPUT, "Причина кика"," ","Kick","Назад");
		    format(string, 100, "Администратор %s кикнул %s. Причина: %s",pNameEx(playerid), pNameEx(GetPVarInt(playerid,"SpecID")), inputtext);
		    SendClientMessageToAll(COLOR_LIGHTRED, string);
		    Kick(GetPVarInt(playerid,"SpecID"));
		    TogglePlayerSpectating(playerid,false), SendClientMessage(playerid, COLOR_LIGHTRED, "Наблюдение завершено"), TextDrawHideForPlayer(playerid,PressA), HideMenuForPlayer(specmenu,playerid);
		}
		if(GetPVarInt(playerid, "SpecType") == 2)
		{
		if(!response) return 1;
		new ip[32], data[32], unbandate;
		if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 8, DIALOG_STYLE_INPUT, "Причина варна"," ","Warn","Назад");
		PlayerInfo[GetPVarInt(playerid,"SpecID")][pWarn]++;
		if(PlayerInfo[GetPVarInt(playerid,"SpecID")][pWarn] < 3) format(string, 100, "Администратор %s предупредил %s. Причина: %s",pNameEx(playerid), pNameEx(GetPVarInt(playerid,"SpecID")), inputtext);
		else
		{
		    PlayerInfo[GetPVarInt(playerid,"SpecID")][pWarn] = 0;
		    GetPlayerIp(GetPVarInt(playerid,"SpecID"), ip, 32);
		    format(string, 150, "Администратор %s заблокировал %s. Причина: %s",pNameEx(playerid), pNameEx(GetPVarInt(playerid,"SpecID")), inputtext);
		    getdate(years, months, days);
		    gettime(hour2,minute2,second2);
		    unbandate = gettime() + 5*86400;
		    format(data, 32, "%02d.%02d.%04d %d:%d:%d", days, months, years, hour2,minute2,second2);
		    format(query, sizeof(query), "INSERT INTO bans (name, whobanned, ip, bandate, time, unbandate, reason) VALUES ('%s', '%s','%s', '%s', 7, %d, '%s')", sendername(GetPVarInt(playerid,"SpecID")), sendername(playerid), ip, data, unbandate, inputtext);
		    mysql_query(query);
		}
		SendClientMessageToAll(COLOR_LIGHTRED, string);
		Kick(GetPVarInt(playerid,"SpecID"));
		TogglePlayerSpectating(playerid,false), SendClientMessage(playerid, COLOR_LIGHTRED, "Наблюдение завершено"), TextDrawHideForPlayer(playerid,PressA), HideMenuForPlayer(specmenu,playerid);
		}
		if(GetPVarInt(playerid, "SpecType") == 3)
		{
			if(!response) return 1;
		    if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 8, DIALOG_STYLE_INPUT, "Причина бана"," ","Ban","Назад");
		    new ip[32], data[32], unbandate;
		    GetPlayerIp(GetPVarInt(playerid,"SpecID"), ip, 32);
		    format(string, 125, "Администратор %s заблокировал %s. Причина: %s",sendername(playerid), sendername(GetPVarInt(playerid,"SpecID")), inputtext);
		    SendClientMessageToAll(COLOR_LIGHTRED, string);
		    getdate(years, months, days);
		    gettime(hour2,minute2,second2);
		    unbandate = gettime() + 7*86400;
		    format(data, 32, "%02d.%02d.%04d %d:%d:%d", days, months, years, hour2,minute2,second2);
		    format(query, sizeof(query), "INSERT INTO bans (name, whobanned, ip, bandate, time, unbandate, reason) VALUES ('%s', '%s','%s', '%s', %d, %d, '%s')", sendername(GetPVarInt(playerid,"SpecID")), sendername(playerid), ip, data, 7, unbandate, inputtext);
		    mysql_query(query);
		    Kick(GetPVarInt(playerid,"SpecID"));
		    TogglePlayerSpectating(playerid,false), SendClientMessage(playerid, COLOR_LIGHTRED, "Наблюдение завершено"), TextDrawHideForPlayer(playerid,PressA), HideMenuForPlayer(specmenu,playerid);
		}
		}

[code]
Сама команда на ZCMD + sscanf2
[code]CMD:re(playerid, params[])
{
    if(PlayerLogged[playerid] == 0) return 1;
    if(PlayerInfo[playerid][pAdmin] < 2 || AdminLogged[playerid] == false) return 1;
       if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, COLOR_WHITE, "Ââåäèòå: /re [id èãðîêà]");
    if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid, COLOR_GREY, "Èãðîê îôôëàéí");
    if(PlayerLogged[params[0]] == 0) return SendClientMessage(playerid, COLOR_GREY, "Èãðîê íå àâòîðèçîâàëñÿ");
     new inter, world, Float:X, Float:Y, Float:Z, Float:FA;
     TextDrawHideForPlayer(playerid,PressA);
    if(GetPVarInt(playerid, "SpecBool") == 0)
    {
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, FA);
        inter = GetPlayerInterior(playerid);
        world = GetPlayerVirtualWorld(playerid);
    }
     SetPlayerInterior(playerid,GetPlayerInterior(params[0]));
    SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(params[0]));
    TogglePlayerSpectating(playerid,true);
     if(IsPlayerInAnyVehicle(params[0]))
    {
         new carid = GetPlayerVehicleID(params[0]);
         PlayerSpectateVehicle(playerid, carid);
     }
     else PlayerSpectatePlayer(playerid,params[0]);
    SendMes(playerid, COLOR_ORANGE, "Наблюдение за игроком: %s (ID: %d)", sendername(params[0]), params[0]);
    SetPVarInt(playerid,"SpecID", params[0]);
    SetPVarInt(params[0],"IDSpec", playerid);
    SetPVarInt(params[0],"SpecStat", 1);
    ShowMenuForPlayer(specmenu, playerid);
    if(GetPVarInt(playerid, "SpecBool") == 0)
    {
        SetPVarInt(playerid, "SpecBool", 1);
        SetPVarFloat(playerid, "SpecX", X);
        SetPVarFloat(playerid, "SpecY", Y);
        SetPVarFloat(playerid, "SpecZ", Z);
        SetPVarFloat(playerid, "SpecFA", FA);
        SetPVarInt(playerid, "SpecInt", inter);
        SetPVarInt(playerid, "SpecWorld", world);
    }
    new vehicleid = GetPlayerVehicleID(params[0]);
    new Float:shealth, Float:arm, Float: carhealth;
    GetPlayerHealth(params[0], shealth);
    GetPlayerArmour(params[0], arm);
    GetVehicleHealth(vehicleid, carhealth);
    format(string, 512, "]Player: %s~n~]Health: %.0f~n~]Armor: %.0f~n~]CarHp: %.0f~n~]Ping: %d~n~]Warn's: %d~n~]Ban's: %d", sendername(params[0]), shealth, arm, carhealth, GetPlayerPing(params[0]), PlayerInfo[params[0]][pWarn], PlayerInfo[params[0]][pBaned]);
    TextDrawSetString(PressA, string);
    TextDrawShowForPlayer(playerid,PressA);
     return 1;
}[/code]
В конец мода:
[code]stock pNameEx(playerid)
{
    new nick[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
    new getspace = strfind(nick, "_", true);
    if(getspace != -1) nick[getspace] = ' ';
    return nick;
}[/code]

Вне форума

Низ форума