Jump to content
  • 0

Problema /ban!


scrilexxx

Question

8 answers to this question

Recommended Posts

  • 0
CMD:ban(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa te loghezi  mai intai.");
    if(IsPlayerConnected(playerid))
    {
        if (PlayerInfo[playerid][pAdmin] >= 3)
        {
            new id,reason[128],string[200],giveplayer[30],sendername[30],Type,str[128];
            if(sscanf(params, "uds[128]", id,Type,reason)) return SCM(playerid,COLOR_DS,"{B8DBFF}Syntax: /ban <Name/Playerid> <Type(1-account 2-permanent)> <reason>");
            if(IsPlayerConnected(id))
            {
                if(id != INVALID_PLAYER_ID)
                {
                    GetPlayerName(id, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    if(Type == 1)
                    {
						if(id == playerid) return SendClientMessage(playerid, -1, "Nu te poti bana singur!");
                        format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, reason);
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        PlayerInfo[id][pBanned] = 1;
                        SendClientMessage(id,COLOR_LIGHTRED,"[BAN INFO]: Poti face o cerere de unban pe forumul nostru.Forumul este http:.");
                        SendClientMessage(id,COLOR_LIGHTRED,"[HINT]: Te sfatuim sa faci o poza la aceste informatii,si sa o postezi cand faci cerere unban.Apasa F8 pentru a face poza.");
                        format(str,sizeof(str),"UPDATE users SET `Banned`='1' WHERE `name`='%s'",giveplayer);
                        mysql_query(SQL,str);
                        new ip[25];
                        GetPlayerIp(id, ip, sizeof(ip));
                        Banlog(ip,PlayerInfo[id][pSQLID],PlayerInfo[playerid][pSQLID],reason,0);
                        KickEx(id);
                    }
                    else if(Type == 2)
                    {
						if(id == playerid) return SendClientMessage(playerid, -1, "Nu te poti bana singur!");
                        format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, reason);
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        new giveplayerid;
                        if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_ERROR, "You cannot ban yourself.");
                        PlayerInfo[id][pBanned] = 1;
                        SendClientMessage(id,COLOR_LIGHTRED,"[BAN INFO]: Poti face o cerere de unban pe forumul nostru.Forumul este http://.");
                        SendClientMessage(id,COLOR_LIGHTRED,"[HINT]: Te sfatuim sa faci o poza la aceste informatii,si sa o postezi cand faci cerere unban.Apasa F8 pentru a face poza.");
                        format(str,sizeof(str),"UPDATE users SET `Banned`='1' WHERE `name`='%s'",giveplayer);
                        mysql_query(SQL,str);
                        new ip[25];
                        GetPlayerIp(id, ip, sizeof(ip));
                        Banlog(ip,PlayerInfo[id][pSQLID],PlayerInfo[playerid][pSQLID],reason,0);
                        Ban(id);
                    }
                    return 1;
                }
            }
            else return SendClientMessage(playerid, COLOR_DS, "{FFFFCC}Error: Player not connected.");
        }
        else return SendClientMessage(playerid, COLOR_DS, AdminOnly);
    }
    return 1;
}

Poftim, trebuia sa adaugi if(id == playerid) return SendClientMessage(playerid, -1, "Nu te poti bana singur!");

Link to comment
Share on other sites

  • 0
Just now, cristyifrim31O said:
CMD:ban(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa te loghezi  mai intai.");
    if(IsPlayerConnected(playerid))
    {
        if (PlayerInfo[playerid][pAdmin] >= 3)
        {
            new id,reason[128],string[200],giveplayer[30],sendername[30],Type,str[128];
            if(sscanf(params, "uds[128]", id,Type,reason)) return SCM(playerid,COLOR_DS,"{B8DBFF}Syntax: /ban <Name/Playerid> <Type(1-account 2-permanent)> <reason>");
            if(IsPlayerConnected(id))
            {
                if(id != INVALID_PLAYER_ID)
                {
                    GetPlayerName(id, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    if(Type == 1)
                    {
						if(id == playerid) return SendClientMessage(playerid, -1, "Nu te poti bana singur!");
                        format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, reason);
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        PlayerInfo[id][pBanned] = 1;
                        SendClientMessage(id,COLOR_LIGHTRED,"[BAN INFO]: Poti face o cerere de unban pe forumul nostru.Forumul este http:.");
                        SendClientMessage(id,COLOR_LIGHTRED,"[HINT]: Te sfatuim sa faci o poza la aceste informatii,si sa o postezi cand faci cerere unban.Apasa F8 pentru a face poza.");
                        format(str,sizeof(str),"UPDATE users SET `Banned`='1' WHERE `name`='%s'",giveplayer);
                        mysql_query(SQL,str);
                        new ip[25];
                        GetPlayerIp(id, ip, sizeof(ip));
                        Banlog(ip,PlayerInfo[id][pSQLID],PlayerInfo[playerid][pSQLID],reason,0);
                        KickEx(id);
                    }
                    else if(Type == 2)
                    {
						if(id == playerid) return SendClientMessage(playerid, -1, "Nu te poti bana singur!");
                        format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, reason);
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        new giveplayerid;
                        if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_ERROR, "You cannot ban yourself.");
                        PlayerInfo[id][pBanned] = 1;
                        SendClientMessage(id,COLOR_LIGHTRED,"[BAN INFO]: Poti face o cerere de unban pe forumul nostru.Forumul este http://.");
                        SendClientMessage(id,COLOR_LIGHTRED,"[HINT]: Te sfatuim sa faci o poza la aceste informatii,si sa o postezi cand faci cerere unban.Apasa F8 pentru a face poza.");
                        format(str,sizeof(str),"UPDATE users SET `Banned`='1' WHERE `name`='%s'",giveplayer);
                        mysql_query(SQL,str);
                        new ip[25];
                        GetPlayerIp(id, ip, sizeof(ip));
                        Banlog(ip,PlayerInfo[id][pSQLID],PlayerInfo[playerid][pSQLID],reason,0);
                        Ban(id);
                    }
                    return 1;
                }
            }
            else return SendClientMessage(playerid, COLOR_DS, "{FFFFCC}Error: Player not connected.");
        }
        else return SendClientMessage(playerid, COLOR_DS, AdminOnly);
    }
    return 1;
}

Poftim, trebuia sa adaugi if(id == playerid) return SendClientMessage(playerid, -1, "Nu te poti bana singur!");

new giveplayerid;
                        if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_ERROR, "You cannot ban yourself.");

Nu-i aceeasi chestie? 

Link to comment
Share on other sites

  • 0
Just now, scrilexxx said:
new giveplayerid;
                        if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_ERROR, "You cannot ban yourself.");

Nu-i aceeasi chestie? 

Tu in sscanf definesti i ca fiind jucatorul caruia ii trimiti. Nu, nu e aceeasi chestie, pentru ca e o simpla variabila, fara o functie anume.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.