Jump to content
  • 0

Ajutor comanda /setadmin


SARPEEEEEEEEEE

Question

1 answer to this question

Recommended Posts

  • 0
YCMD:setadmin(playerid, params[], help) {
    if(IsPlayerConnected(playerid)) {
		if(PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid, COLOR_ERROR, "{ff0000}ERROR >>> {ff5252}Nu ai acces sa folosesti aceasta comanda{ff0000}.");

		new id,adminlevel,sendername[30],giveplayer[30],string[200];

		if(sscanf(params, "ui",id,adminlevel)) return SendClientMessage(playerid, COLOR_GREY, "Sintaxa: {FFFFFF}/setadmin <playerid/name> <Admin Level>");
		if(IsPlayerConnected(id)) {
		    if(id != INVALID_PLAYER_ID) {
                GetPlayerName(id, giveplayer, sizeof(giveplayer));
                format(string, sizeof(string), "Esti sigur ca doresti sa ii setezi admin %d lui %s?", adminlevel, giveplayer);
                ShowPlayerDialog(playerid, DIALOG_SETADMIN, DIALOG_STYLE_MSGBOX, "Verificare /setadmin", string, "Da", "Nu");
            }
        } else {
            SendClientMessage(playerid, COLOR_GREY, "Acest jucator nu este conectat.");
        }
    }
    return true;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    if(dialogid == DIALOG_SETADMIN) {
        if(response) {
            GetPlayerName(id, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            PlayerInfo[id][pAdmin] = adminlevel;
            PlayerInfo[id][pChar] = 217;
            SetPlayerSkinEx(id, 217);
            printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, adminlevel);
            format(string, sizeof(string), "Ai fost promovat la admin %d de %s,", adminlevel, sendername);
            SendClientMessage(id, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "L-ai promovat pe %s la nivel %d admin.", giveplayer,adminlevel);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "AdmCmd: Admin %s i-a setat lui %s admin %d.", sendername,giveplayer,adminlevel);
            Iter_Add(PlayerAdmins, id);
            SendAdminMessage(COLOR_LOGS,string,4);
            new wakaname[25];
            if(adminlevel == 0) {
                PlayerInfo[id][pAW] = 0;
                UpdateVar(id, "AW", 0);
                SpecFaction[id] = 0;
                StopFly(playerid);
                UsedFly[playerid] = 0;
                SetPlayerHealthEx(playerid, 100);

                Iter_Remove(PlayerAdmins, id);
            }
            GetPlayerName(id,wakaname,25);
            new str[256];
            mysql_format(SQL, str,256,"UPDATE users SET `Admin`='%d',`CChar`='%d' WHERE `ID`='%d'",PlayerInfo[id][pAdmin],PlayerInfo[id][pChar],PlayerInfo[id][pSQLID]);
            mysql_tquery(SQL,str, "", "");
        } else {
            SendClientMessage(playerid, COLOR_GREY, "PUNE TU AICI UN MESAJ.");
        }
        return 1;
    }
    return 0;
}

Sper sa fie ceea ce trebuie.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.