Jump to content

Question

Posted (edited)

Cum fac sa pot folosi doar eu o anumita comanda>?. Am incercat ceva dar o pot folosi si unii jucatori nu toti si nu stiu de ce. Cum fac sa o pot folosi doar eu ???.

Si alta chestie.... Cand cineva se logheaza cu RCON , cum fac sa apara pe chat ca Jucatorul ..... a incercat sa se logheze cu rcon /s-a logat cu RCON ...?

if(strlen(PlayerName(playerid)) != strlen("[K]Punker."))
    return SendError(playerid, "Only [K]Punker. have ACCES to use this command!");

P.S: GM ESS

Edited by Punker

4 answers to this question

Recommended Posts

  • 0
Posted
Acum 22 ore, Banditul a spus:

Strcmp nu strlen. Strlen intoarce lungimea stringului care e un numar.

http://wiki.sa-mp.com/wiki/Strcmp

http://wiki.sa-mp.com/wiki/OnRconLoginAttempt

Cu RCON am rezolvat si zici ca ar trebui sa fie asa ca sa mearga ? 

if(strcmp (PlayerName(playerid)) != strcmp ("[K]Punker.")) return SendError(playerid, "Only [K]Punker. have ACCES to use this command!");

  • 0
Posted (edited)

Spre exemplu la realchat ca sa scrie cu rosu doar daca esti tu , uite 

       new nume[64];
        GetPlayerName(playerid, nume, sizeof(nume));
        if((strcmp(nume, "Yamato", true) == 0))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "{FF0000}%s: {FFFFFF}%s", sendername, text);
            ProxDetector(20.0, playerid,                          string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        }

 

In loc de Yamato pui numele tau , iar ca sa vezi chestia aia cu rcon login uite asta 

 

public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success)
    {
        new string[128],sendername[25];
        format(string, sizeof(string), "Player with IP %s has typed a wrong server password: %s.", ip, password);
        ABroadCast(0xFF0000FF, string, 6);
        new pip[16];
        foreach(Player,i)
        {
            GetPlayerIp(i, pip, sizeof(pip));
            if(!strcmp(ip, pip, true) && PlayerInfo[pAdmin] < 6)
            {
                SendClientMessage(i, 0xFFFFFFFF, "{FF0000}AdmBot{FFFFFF}: Wrong Password. Banned!");
                GetPlayerName(i, sendername, sizeof(sendername));
                format(string, sizeof(string), "AdmCmd: %s was banned by AdmBot, reason: Wrong RCON Password", sendername);
                SendClientMessageToAll(COLOR_LIGHTRED, string);
                KickEx(i);
            }
        }
    }
    return 1;
}

 

sau asta 

 

public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success)
    {
        new pip[16];
        new string[176];
        new giveplayerid;
        for(new i = 0; i <= MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                GetPlayerIp(i, pip, sizeof(pip));
                if(!strcmp(ip, pip, true))
                {
                    new sendername[MAX_PLAYER_NAME];
                    GetPlayerName(i, sendername, sizeof(sendername));
                    if(LogingAttempts!= 5)
                    {
                        format(string, sizeof(string),"[RCON]: %s (%d) tried to login at RCON and Failed!",sendername,i);
                        ABroadCast(COLOR_LIGHTRED,string,1);
                        LogingAttempts ++;
                    }
                    else
                    {
                        format(string, sizeof(string), "LOCALHOST: Banning player '%s'. Reason: Too many Failed Logins at RCON", sendername);
                        Ban(giveplayerid);
                    }
                }
            }
        }
    }
    else
    {
        new pip[16];
        new string[176];
        for(new i = 0; i <= MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                GetPlayerIp(i, pip, sizeof(pip));
                if(!strcmp(ip, pip, true))
                {
                    new sendername[MAX_PLAYER_NAME];
                    GetPlayerName(i, sendername, sizeof(sendername));
                    format(string, sizeof(string),"[RCON]: %s (%d) tried to login at RCON and Succesed!",sendername,i);
                    ABroadCast(COLOR_LIGHTRED,string,1);
                }
            }
        }
    }
    return 1;
}

Edited by Yamato
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.