(FS) Cистемный администратор 0.1a BETA

Description: Готовые решения скриптов, filterScript
Moderator: SJplayer

SJplayer M
Topic author, Модератор
Модератор
Avatar
SJplayer M
Topic author, Модератор
Модератор
Posts: 196
Joined: 25 May 2013
With us: 11 years 4 months

#1by SJplayer » 26 Dec 2013, 21:21

Cистемный администратор 0.1a BETA
Автор: boomerboom

Требования:
  • sscanf2
  • YSI\y_ini
  • zcmd
  • foreach
  • Dini
  • ((Google them))

Code: Select all



    
#include <a_samp>
    #include <sscanf2>
    #include <YSI\y_ini>
    #include <zcmd>
    #include <foreach>
    #include <Dini>
    new muted[MAX_PLAYERS];
    #define DIALOG_REGISTER 800
    #define DIALOG_LOGIN 8001
    #define DIALOG_SUCCESS_1 8003
    #define DIALOG_SUCCESS_2 8004
    #define Grey 0xC0C0C0C8
    #define PATH "/Users/%s.ini"
    #define COL_WHITE "{FFFFFF}"
    #define COL_RED "{F81414}"
    #define COL_GREEN "{00FF22}"
    #define COL_LIGHTBLUE "{00CED1}"
    //Shades of red
#define COLOR_INDIANRED 0xCD5C5CFF
#define COLOR_LIGHTCORAL 0xF08080FF
#define COLOR_SALMON 0xFA8072FF
#define COLOR_DARKSALMON 0xE9967AFF
#define COLOR_LIGHTSALMON 0xFFA07AFF
#define COLOR_CRIMSON 0xDC143CFF
#define COLOR_RED 0xFF0000FF
#define COLOR_FIREBRICK B22222FF
#define COLOR_DARKRED 0x8B0000FF

//Shades of pink
#define COLOR_PINK 0xFFC0CBFF
#define COLOR_LIGHTPINK 0xFFB6C1FF
#define COLOR_HOTPINK 0xFF69B4FF
#define COLOR_DEEPPINK 0xFF1493FF
#define COLOR_MEDIUMVIOLETRED 0xC71585FF
#define COLOR_PALEVIOLETRED 0xDB7093FF

//Shades of Orange
#define COLOR_CORAL 0xFF7F50FF
#define COLOR_TOMATO 0xFF6347FF
#define COLOR_ORANGERED 0xFF4500FF
#define COLOR_DARKORANGE 0xFF8C00FF
#define COLOR_ORANGE 0xFFA500FF

//Shades of Yellow
#define COLOR_GOLD 0xFFD700FF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_LIGHTYELLOW 0xFFFFE0FF
#define COLOR_LEMONCHIFFON 0xFFFACDFF
#define COLOR_LIGHTGOLDENRODYELLOW 0xFAFAD2FF
#define COLOR_PAPAYAWHIP 0xFFEFD5FF
#define COLOR_MOCCASIN 0xFFE4B5FF
#define COLOR_PEACHPUFF 0xFFDAB9FF
#define COLOR_PALEGOLDENROD 0xEEE8AAFF
#define COLOR_KHAKI 0xF0E68CFF
#define COLOR_DARKKHAKI 0xBDB76BFF

//Shades of Purple
#define COLOR_LAVENDER 0xE6E6FAFF
#define COLOR_THISTLE 0xD8BFD8FF
#define COLOR_PLUM 0xDDA0DDFF
#define COLOR_VIOLET 0xEE82EEFF
#define COLOR_ORCHID 0xDA70D6FF
#define COLOR_FUCHSIA 0xFF00FFFF
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_MEDIUMORCHID 0xBA55D3FF
#define COLOR_MEDIUMPURPLE 0x9370DBFF
#define COLOR_AMETHYST 0x9966CCFF
#define COLOR_BLUEVIOLET 0x8A2BE2FF
#define COLOR_DARKVIOLET 0x9400D3FF
#define COLOR_DARKORCHID 0x9932CCFF
#define COLOR_DARKMAGENTA 0x8B008BFF
#define COLOR_PURPLE 0x800080FF
#define COLOR_INDIGO 0x4B0082FF
#define COLOR_SLATEBLUE 0x6A5ACDFF
#define COLOR_DARKSLATEBLUE 0x483D8BFF
#define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF

//Shades of Green
#define COLOR_GREENYELLOW 0xADFF2FFF
#define COLOR_CHARTREUSE 0x7FFF00FF
#define COLOR_LAWNGREEN 0x7CFC00FF
#define COLOR_LIME 0x00FF00FF
#define COLOR_LIMEGREEN 0x32CD32FF
#define COLOR_PALEGREEN 0x98FB98FF
#define COLOR_LIGHTGREEN 0x90EE90FF
#define COLOR_MEDIUMSPRINGGREEN 0x00FA9AFF
#define COLOR_SPRINGGREEN 0x00FF7FFF
#define COLOR_MEDIUMSEAGREEN 0x3CB371FF
#define COLOR_SEAGREEN 0x2E8B57FF
#define COLOR_FORESTGREEN 0x228B22FF
#define COLOR_GREEN 0x008000FF
#define COLOR_DARKGREEN 0x006400FF
#define COLOR_YELLOWGREEN 0x9ACD32FF
#define COLOR_OLIVEDRAB 0x6B8E23FF
#define COLOR_OLIVE 0x808000FF
#define COLOR_DARKOLIVEGREEN 0x556B2FFF
#define COLOR_MEDIUMAQUAMARINE 0x66CDAAFF
#define COLOR_DARKSEAGREEN 0x8FBC8FFF
#define COLOR_LIGHTSEAGREEN 0x20B2AAFF
#define COLOR_DARKCYAN 0x008B8BFF
#define COLOR_TEAL 0x008080FF

//Shades of Blue/Cyan
#define COLOR_AQUA 0x00FFFFFF
#define COLOR_CYAN 0x00FFFFFF
#define COLOR_LIGHTCYAN 0xE0FFFFFF
#define COLOR_PALETURQUOISE 0xAFEEEEFF
#define COLOR_AQUAMARINE 0x7FFFD4FF
#define COLOR_TURQUOISE 0x40E0D0FF
#define COLOR_MEDIUMTURQUOISE 0x48D1CC
#define COLOR_DARKTURQUOISE 0x00CED1FF
#define COLOR_CADETBLUE 0x5F9EA0FF
#define COLOR_STEELBLUE 0x4682B4FF
#define COLOR_LIGHTSTEELBLUE 0xB0C4DEFF
#define COLOR_POWDERBLUE 0xB0E0E6FF
#define COLOR_LIGHTBLUE 0xADD8E6FF
#define COLOR_SKYBLUE 0x87CEEBFF
#define COLOR_LIGHTSKYBLUE 0x87CEFAFF
#define COLOR_DEEPSKYBLUE 0x00BFFFFF
#define COLOR_DODGERBLUE 0x1E90FFFF
#define COLOR_CORNFLOWERBLUE 0x6495EDFF
#define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF
#define COLOR_ROYALBLUE 0x4169E1FF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_MEDIUMBLUE 0x0000CDFF
#define DARKBLUE 0x00008BFF
#define COLOR_NAVY 0x000080FF
#define COLOR_MIDNIGHTBLUE 0x191970FF

//Shades of Brown
#define COLOR_CORNSILK 0xFFF8DCFF
#define COLOR_BLANCHEDALMOND 0xFFEBCDFF
#define COLOR_BISQUE 0xFFE4C4FF
#define COLOR_NAVAJOWHITE 0xFFDEADFF
#define COLOR_WHEAT 0xF5DEB3FF
#define COLOR_BURLYWOOD 0xDEB887FF
#define COLOR_TAN 0xD2B48CFF
#define COLOR_ROSYBROWN 0xBC8F8FFF
#define COLOR_SANDYBROWN 0xF4A460FF
#define COLOR_DARKGOLDENROD 0xB8860BFF
#define COLOR_PERU 0xCD853FFF
#define COLOR_SADDLEBROWN 0x8B4513FF
#define COLOR_SIENNA 0xA0522DFF
#define COLOR_BROWN 0xA52A2AFF
#define COLOR_MAROON 0x800000FF

//Shades of Grey
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_GAINSBORO 0xDCDCDCFF
#define COLOR_LIGHTGREY 0xD3D3D3FF
#define COLOR_SILVER 0xC0C0C0FF
#define COLOR_DARKGRAY 0xA9A9A9FF
#define COLOR_GRAY 0x808080FF
#define COLOR_DIMGRAY 0x696969FF
#define COLOR_LIGHTSLATEGRAY 0x778899FF
#define COLOR_SLATEGRAY 0x708090FF
#define COLOR_DARKSLATEGRAY 0x2F4F4FFF
#define COLOR_BLACK 0x000000FFPS.

    new String[128], Float:SpecX[MAX_PLAYERS], Float:SpecY[MAX_PLAYERS], Float:SpecZ[MAX_PLAYERS], vWorld[MAX_PLAYERS], Inter[MAX_PLAYERS];
    new IsSpecing[MAX_PLAYERS], Name[MAX_PLAYER_NAME], IsBeingSpeced[MAX_PLAYERS],spectatorid[MAX_PLAYERS];

    new WTimer1;

    forward Wheel1(playerid);

enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];

stock Path(playerid)
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(str,sizeof(str),UserPath,name);
    return str;
}

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

stock udb_hash(buf[]) {
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}

    public OnPlayerConnect(playerid)
    {
        if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password to login to acces your account","Login","Quit");
    }
        else
    
{
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Register",""COL_WHITE"{FFFFFF}You are {FF0000}not {FFFFFF}registered","Register","Quit");
    }
        return 1;
}



public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Register",""COL_RED"{FFFFFF}Wrong password\n"COL_WHITE"Type your password to registert","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);
                SendClientMessage(playerid, 0xFFFFFF, "{FFFFFF}You Have {00FF00}Successfully {FFFFFF}Registered A Account!");
                PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
            }
        }


        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX, "Notice", "Thank you for logging!", "Ok", "");
                    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
                }
                else
                
{
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"{FFFFFF}You Typed A {FF0000}Incorrect {FFFFFF}Password\n"COL_WHITE"Type Your Password Below To Login","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}

public Wheel1(playerid)
{
    new Wheel = random(6);
    switch(Wheel)
    {
        case 0: AddVehicleComponent(GetPlayerVehicleID(playerid), 1073);
        case 1: AddVehicleComponent(GetPlayerVehicleID(playerid), 1098);
        case 2: AddVehicleComponent(GetPlayerVehicleID(playerid), 1080);
        case 3: AddVehicleComponent(GetPlayerVehicleID(playerid), 1077);
        case 4: AddVehicleComponent(GetPlayerVehicleID(playerid), 1076);
        case 5: AddVehicleComponent(GetPlayerVehicleID(playerid), 1075);
    }
}

public OnPlayerDisconnect(playerid,reason)
{
    KillTimer(WTimer1);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Close(File);
    return 1;
}



public OnPlayerDeath(playerid,killerid,reason)
{
    if(IsBeingSpeced[playerid] == 1)
    {
        foreach(Player,i)
        {
            if(spectatorid[i] == playerid)
            {
                TogglePlayerSpectating(i,false);
            }
        }
    }
     return 1;
    }

public OnPlayerText(playerid,text[])
{

    if(muted[playerid] == 1)
    {
        SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B}You can not talk while your muted.");
        return 0;
    }
    return 1;
}

    CMD:slap(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");

        new target,pName[MAX_PLAYER_NAME],Float:x,Float:y,Float:z,string[124];
        if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /slap (playerid).");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
        GetPlayerName(target,pName,sizeof(pName));
        format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got slapped by an administrator.",pName);
        SendClientMessageToAll(-1,string);
        GetPlayerPos(target,x,y,z);
        SetPlayerPos(target,x,y,z+15);
        return 1;
    }

    CMD:banip(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
        new ip[44],string[124];
        if(sscanf(params,"s[44]",ip)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /ban (playerid).");
        format(string,sizeof(string),"banip %s",ip);
        SendRconCommand(string);
        format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got (IP)banned by an administrator.",ip);
        SendClientMessage(playerid,-1,string);
        PlayerPlaySound(playerid, 1009, 0.0, 0.0, 0.0);
        return 1;
    }

    CMD:freeze(playerid,params[])
    {
            if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
            new target,string[124],pName[24];
            if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /freeze (playerid).");
            if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"ERROR:Player not connected.");
            GetPlayerName(target,pName,24);
            format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got frozen by an administrator.",pName);
            SendClientMessageToAll(-1,string);
            TogglePlayerControllable(target,0);
            PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
            return 1;
    }

    CMD:unfreeze(playerid,params[])
    {
            if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
            new target,string[124],pName[24];
            if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /unfreeze (playerid).");
            if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected .");
            GetPlayerName(target,pName,24);
            format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got unfrozen by an administrator.",pName);
            SendClientMessageToAll(-1,string);
            TogglePlayerControllable(target,1);
            PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
            return 1;
    }

    CMD:goto(playerid,params[])
    {
            if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
            new target,Float:x,Float:y,Float:z;
            if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /goto (playerid).");
            if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected");
            GetPlayerPos(target,x,y,z);
            SetPlayerPos(playerid,x,y,z);
            PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
            return 1;
    }

    CMD:get(playerid,params[])
    {
            if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
            new target,Float:x,Float:y,Float:z;
            if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /get (playerid).");
            if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
            GetPlayerPos(playerid,x,y,z);
            SetPlayerPos(target,x,y,z);
            PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
            return 1;
    }

    CMD:mute(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
        new target,string[124],pName[24];
        if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} Use /mute (playerid).");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
        GetPlayerName(target,pName,sizeof(pName));
        format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got muted by an administrator.",pName);
        SendClientMessageToAll(-1,string);
        muted[target] = 1;
        PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
        return 1;
    }

    CMD:unmute(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
        new target,string[124],pName[24];
        if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{FF0000}[Usage]: {FFFF00}/Unmute (PlayerID).");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
        GetPlayerName(target,pName,sizeof(pName));
        format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got unmuted by an administrator.",pName);
        SendClientMessageToAll(-1,string);
        muted[target] = 0;
        PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        return 1;
    }

    CMD:kick(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
        new target,reason[66],string[124],pName[24];
        if(sscanf(params,"us[66]",target,reason)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B}/kick (PlayerID) (Reason).");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
        GetPlayerName(target,pName,sizeof(pName));
        format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got unmuted by an administrator.[ Reason: %s ]",pName,reason);
        SendClientMessageToAll(-1,string);
        Kick(target);
        PlayerPlaySound(playerid, 1009, 0.0, 0.0, 0.0);
        return 1;
    }

    CMD:ban(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
        new target,reason[66],string[124],pName[24];
        if(sscanf(params,"us[66]",target,reason)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B} /Ban (PlayerID) (Reason)");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
        GetPlayerName(target,pName,sizeof(pName));
        format(string,sizeof(string),"{F83934}[System]:{8B8B8B} %s got banned by a administrator - [ Reason: %s ]",pName,reason);
        SendClientMessageToAll(-1,string);
        Ban(target);
        PlayerPlaySound(playerid, 1009, 0.0, 0.0, 0.0);
        return 1;
    }

    CMD:ip(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
        new target,pIP[34],pName[24],string[124];
        if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"{F83934}[Usage]:{8B8B8B}/IP (PlayerID)");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
        GetPlayerName(target,pName,sizeof(pName));
        GetPlayerIp(target,pIP,34);
        format(string,sizeof(string),"{FFFF00}%s's IP is %s",pName,pIP);
        SendClientMessage(playerid,-1,string);
        PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        return 1;
    }

    CMD:setlevel(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
        new target,level,string[124],pName[24];
        if(sscanf(params,"ud",target,level)) return SendClientMessage(playerid,-1,"{FF0000}[Usage]: {FFFF00}/Setlevel (PlayerID) (Level)");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} Player is not connected.");
        if(level < 0 || level > 3) return SendClientMessage(playerid,-1,"{F83934}[Error]:Invalid level. (1 - 3)");
        GetPlayerName(target,pName,sizeof(pName));
        SendClientMessageToAll(-1,string);
        PlayerInfo[target][pAdmin] = level;
        PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        return 1;
    }

    COMMAND:spec(playerid, params[])
{
    new id;
    if(PlayerInfo[playerid][pAdmin] < 1) return 0;
    if(sscanf(params,"u", id))return SendClientMessage(playerid, Grey, "{F83934}[Usage]:{8B8B8B}/Spec (ID)");
    if(id == playerid)return SendClientMessage(playerid,Grey,"{F83934}[Error]:{8B8B8B} You Cannot Spectate Yourself");
    if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, Grey, "{F83934}[Error]:Player Not Found");
    if(IsSpecing[playerid] == 1)return SendClientMessage(playerid,Grey,"{F83934}[Error]:You Are Already Spectating Somebody");
    GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
    Inter[playerid] = GetPlayerInterior(playerid);
    vWorld[playerid] = GetPlayerVirtualWorld(playerid);
    TogglePlayerSpectating(playerid, true);
    if(IsPlayerInAnyVehicle(id))

        if(GetPlayerInterior(id) > 0)
        {
            SetPlayerInterior(playerid,GetPlayerInterior(id));
        }
        else  if(GetPlayerVirtualWorld(id) > 0)
        {
            SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
        }
    PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));

    {
        if(GetPlayerInterior(id) > 0)
        {
            SetPlayerInterior(playerid,GetPlayerInterior(id));
        }
        if(GetPlayerVirtualWorld(id) > 0)
        {
            SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
        }
        PlayerSpectatePlayer(playerid,id);
    }
    GetPlayerName(id, Name, sizeof(Name));
    format(String, sizeof(String),"{F83934}[System]:{8B8B8B} You're now Spectating %s.",Name);
    SendClientMessage(playerid,0x0080C0FF,String);
    IsSpecing[playerid] = 1;
    IsBeingSpeced[id] = 1;
    spectatorid[playerid] = id;
    return 1;
}

    COMMAND:specoff(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
    TogglePlayerSpectating(playerid, 0);
    return 1;
}

    public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        if(IsBeingSpeced[playerid] == 1)
        {
            foreach(Player,i)
            {
                if(spectatorid[i] == playerid)
                {
                    PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
                }
            }
        }
    }
    if(newstate == PLAYER_STATE_ONFOOT)
    {
        if(IsBeingSpeced[playerid] == 1)
        {
            foreach(Player,i)
            {
                if(spectatorid[i] == playerid)
                {
                    PlayerSpectatePlayer(i, playerid);
                }
            }
        }
    }
    return 1;
}

    public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    if(IsBeingSpeced[playerid] == 1)
    {
        foreach(Player,i)
        {
            if(spectatorid[i] == playerid)
            {
                SetPlayerInterior(i,GetPlayerInterior(playerid));
                SetPlayerVirtualWorld(i,GetPlayerVirtualWorld(playerid));
            }
        }
    }
    return 1;
}

    public OnPlayerSpawn(playerid)
{

    SetPlayerHealth(playerid, 99999);
    SetTimerEx("SpawnProtection", 10000, false, "i", playerid);
    SendClientMessage(playerid, 0xFF0000FF, "{F83934}[System]:{8B8B8B} Anti-Spawn kill protection");
    SetTimerEx("SpawnProtection1", 3000, false, "i", playerid);
    TogglePlayerControllable(playerid, false);
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerInterior(playerid, 0);
    return 1;

}



    CMD:report(playerid, params[])
{
    new tmp[256], idx;
    tmp = strrest(params, idx);
    if(!strlen(tmp)){
        SendClientMessage(playerid, 0x555252AA, "{F83934}[Usage]:{8B8B8B}/Report [PlayerID] [Reason]");
        return 1;
    }else{
        new pid = strval(tmp);
        tmp = strrest(params, idx);
        if(!IsPlayerConnected(pid)){
            SendClientMessage(playerid, 0x555252AA, "{F83934}[Error]:{8B8B8B} Invalid ID!");
            return 1;
        }else{
            if(!strlen(tmp)){
                SendClientMessage(playerid, 0x555252AA, "{F83934}[Usage]:{8B8B8B}/Report [PlayerID] [Reason]");
                return 1;
            }else{
                new name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], string[124];
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayerName(pid, name2, sizeof(name2));
                format(string, sizeof(string), "{00FFFF}>> - %s(%d) Has Reported %s(%d) For '%s'", name, playerid, name2, pid, tmp);
                for(new i=0; i<GetMaxPlayers(); i++){
                    if(IsPlayerConnected(i)){
                        if(PlayerInfo[playerid][pAdmin] < 1) {
                            SendClientMessage(i, 0x555252AA, string);
                            PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
                        }
                    }
                }
            }
        }
    }
    return 1;
}

strrest(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

    COMMAND:announce(playerid, params[])
{
    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
    new text[64], time, style;
    if(PlayerInfo[playerid][pAdmin] < 2) return 0;
    else if (sscanf(params, "iis[64]", style, time, text)) return SendClientMessage(playerid,Grey,"{F83934}[Usage]:{8B8B8B}/Announce (Style[0-6]) (Time) (Text)");
    else if (strlen(text) > 64) return SendClientMessage(playerid,Grey,"{F83934}[Error]:{8B8B8B} Message is too long.");
    else if (style == 2) return SendClientMessage(playerid,Grey,"{F83934}[Usage]:{8B8B8B} Bug with style No.2 don't use it!");
    else if (style < 0 || style > 6) return SendClientMessage(playerid,0x854900FF,"{F83934}[Error]:{8B8B8B}");
    else if (time > 20*1000) return SendClientMessage(playerid, Grey,"{F83934}[Error]:{8B8B8B} Message can not be longer then 20 seconds!");
    else {
        GameTextForAll(text, time, style);
    }
    return 1;
}

    CMD:acmds(playerid, params[])
{
    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
    SendClientMessage(playerid, 0x0077BB00 , "{00FF00}(Level 1 |  Moderator) ");
    SendClientMessage(playerid, 0x0077BB00 , "»»{FFFF00}/slap, /freeze, /unfreeze, /goto, /get, /mute, /unmute, /ip, /spec, /specoff««");
    SendClientMessage(playerid, 0x0077BB00 , "{00FF00}(Level 2 | Administrator) ");
    SendClientMessage(playerid, 0x0077BB00 , "»»{FFFF00}/kick, /ban, /announce, /explode, /setskin, /setweather, /clearchat««");
    SendClientMessage(playerid, 0x0077BB00 , "{00FF00}(Level 3 | Owners) ");
    SendClientMessage(playerid, 0x0077BB00 , "»»{FFFF00}/banip, /setlevel, /restart, /gmx««");
    return 1;
}

    CMD:explode(playerid, params[]){
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
       new amount;
       new Float:boomx, Float:boomy, Float:boomz;
       if(sscanf(params, "i", amount)) return SendClientMessage(playerid,Grey,"{F83934}[Usage]:{8B8B8B} /Explode [PlayerID]");
       GetPlayerPos(playerid,boomx, boomy, boomz);
       CreateExplosion(boomx, boomy , boomz, amount, 10);
       return 1;
}



    COMMAND:admins(playerid,params[])
{
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, COLOR_RED, " ");
          SendClientMessage(playerid, 0xFF0080C8, "[============Online Administrators============] ");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(PlayerInfo[i][pAdmin] > 1)
                {
                new admtext[64];
                new sendername[MAX_PLAYER_NAME];
                new string[256];
                if(PlayerInfo[i][pAdmin] == 1) { admtext = "{80FF00}Level 1 Moderator"; }
                  else if(PlayerInfo[i][pAdmin] == 2) { admtext = "{80FF00}Level 2 Administrator"; }
                else if(PlayerInfo[i][pAdmin] == 3) { admtext = "{80FF00}Level 3 Master Administrator"; }
                GetPlayerName(i, sendername, sizeof(sendername));
                format(string, 256, "{FF00FF}%s {80FF00}( %s )", sendername, admtext);
                SendClientMessage(playerid, 0xFFFF00C8, string);
                SendClientMessage(playerid, 0xFF0080C8, "[============Online Administrators============]");
                }
            }
        }
    }
    return 1;
}

    CMD:setskin(playerid, params[])
{

    new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], id, skinid, string[128];
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
    if(sscanf(params, "ui", id, skinid)) return SendClientMessage(playerid, -1, "{F83934}[Usage]:{8B8B8B}/Setskin (PlayerID) (SkinID)");
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    GetPlayerName(id, targetname, MAX_PLAYER_NAME);
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "{F83934}[Error]:{8B8B8B} Player Not Connected!");
    SetPlayerSkin(id, skinid);
    format(string, 128, "{F83934}[System]:{8B8B8B} Administrator %s(%d) has changed your skin To %i", name, playerid, skinid);
    SendClientMessage(id, 0xFFFF00C8, string);
    format(string, 128, "{F83934}[System]:{8B8B8B} You have successfully set his skin to %i", targetname, id, skinid);
    SendClientMessage(playerid, -1, string);
    return 1;
}

    CMD:setweather(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
        new string[128];
        new sendername[MAX_PLAYER_NAME];
        new weather;
        if(sscanf(params, "d", weather))
        return SendClientMessage(playerid, Grey, "{F83934}[Usage]:{8B8B8B}/Setweather (WeatherID)");
        if(PlayerInfo[playerid][pAdmin] < 2)
        return SendClientMessage(playerid, Grey, "{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
        {
            SetWeather(weather);
            SendClientMessage(playerid, Grey, "[LOST:RP] The weather has been changed");
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, 256, "{F83934}[System]:{8B8B8B} Administrator %s changed the weather to weather ID(%d)", sendername,weather);
            SendClientMessage(playerid, -1, string);
        }
        return 1;
    }

    CMD:clearchat(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2)
    {
        ClearChatboxAll(playerid);
    }
    else
    
{
        SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
        return 1;
    }
    return 1;
}

ClearChatboxAll(playerid)
{
    for(new i = 0; i < 50; i++)
    {
        SendClientMessage(playerid, 0xFFFFFFC8, "");
    }
    return 1;
}

    CMD:restart(playerid, params[])
{
        if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,-1,"{F83934}[Error]:{8B8B8B} You're not authorized to use this command.");
        foreach(Player,i)
        {
            KillTimer(WTimer1);
            new INI:File = INI_Open(UserPath(playerid));
            INI_SetTag(File,"data");
            INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
            INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
            INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
            INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
            INI_Close(File);
            return 1;
        }
        return 1;
}


Команды:
  • slap
  • banip
  • ban
  • setlevel
  • freeze
  • unfreeze
  • goto
  • get
  • mute
  • unmute
  • kick
  • ip
  • spec
  • specoff
  • report
  • announce
  • explode
  • admins
  • setskin
  • setweather
  • clearchat
  • acmds

3 типа сообщений:
  • [Error]
  • [Usage]
  • [System]

Code: Select all

{F83934}[Error]:{8B8B8B} Вы не имеете права использовать эту команду.

Code: Select all

{F83934}[Usage]:{8B8B8B} Используйте (playerid).

Code: Select all

{F83934}[System]:{8B8B8B} Администратор %s(%d) изменил ваш скин на: %i


Return to “Скрипты / FS”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest