Jump to content

[REZOLVAT] Problema: /unban cu reason


Edybgdq1994
 Share

Recommended Posts

Username:edybgdq1994
Problema întălnită:Vreau sa fac /unban si sa fie si reason gen: /unban <nume> <reason>
Detalii despre problemă:imi da eroare // nu-mi merge.
Ce ai încercat să faci înainte să postezi?: Sa refac, dar nu mi merge.
Cod sursă (recomandat pastebin.com) :https://pastebin.com/pLRrBY6F
Alte detalii:Imi da eroarea: error 033: array must be indexed (variable "reason")    ++ nu-mi merge comanda, gen daca pun reason imi zice ""invalid player id"", si daca nu pun reason imi merge, dar nu-mi scrie nimic la reason.

Link to comment
Share on other sites

Incearca

 

CMD:unban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5) return SendClientMessage(playerid, COLOR_LIGHTGREEN3, AdminOnly);
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
    if(IsPlayerConnected(playerid)) {
        new id[30],escape[30],reason[300],str1[256],string[128],sendername[30],qstr[256];
        if(sscanf(params, "s[30]s[300]", id,reason)) return SCM(playerid, COLOR_GREY, "Syntax:{FFFFFF} /unban <name> <reason>");
        mysql_real_escape_string(id, escape);
        format(qstr,sizeof(qstr),"SELECT * FROM bans WHERE `PlayerName`='%s' AND `Active`='1'",escape);
        new Cache: banuri = mysql_query(SQL,qstr);
        
        if(cache_get_row_count() > 0) {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string,sizeof(string),"/unban: %s has unbanned user %s, reason: %s",sendername,escape,reason);
            ABroadCast(COLOR_ADMCOMMANDS, string,1);
            mysql_format(SQL,str1,sizeof(str1),"UPDATE bans SET `Active`='0' WHERE `PlayerName`='%s'",escape);
            mysql_tquery(SQL,str1,"","");
        }
        else return SendClientMessage(playerid, COLOR_LIGHTGREEN3, "Invalid player."); cache_delete(banuri);
    }
    return 1;
}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...