SA-MP Forums Archive
Some help needed. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Some help needed. (/showthread.php?tid=338942)



Some help needed. - HighPitchedVoice - 01.05.2012

I want the following code with the joining / leaving stuff ONLY be for administrators but I kept on trying and no idea how to do it.. :/
pawn Код:
format(pFILE[playerid], 128, "LARP/Users/Aliases/%s.txt", plname);
    dini_Create(pFILE[playerid]);
    dini_Set(pFILE[playerid], "Nameip", playersip);

    if(strlen(dini_Get("LARP/Users/Aliases/ips.txt", plname)) == 0)
    {
        dini_Set("LARP/Users/Aliases/ips.txt", plname, playersip);
    }
    else
    {
        if( strfind( dini_Get("LARP/Users/Aliases/ips.txt", plname), playersip, true) == -1 )
        {
            format(string,sizeof(string),"%s, %s", dini_Get("LARP/Users/Aliases/ips.txt",plname), playersip);
            dini_Set("LARP/Users/Aliases/ips.txt", plname, string);
        }
    }

    new pAKA[256];
    pAKA = dini_Get("LARP/Users/Aliases/alias.txt",playersip);
    new pIPs[256];
    pIPs = dini_Get("LARP/Users/Aliases/ips.txt",plname);

    if (strlen(pAKA) < 3)
    {
        format(string,sizeof(string),"* %s (%d) has joined Raven's Roleplay. (%s)", plname, playerid,playersip);
        if (strlen(pIPs) < 3) SendIP = 0;
        else if (!strcmp(pIPs,playersip,true)) SendIP = 0;
        else
        {
            if(strlen(pIPs) >= 128)
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: -Too Many, Be Careful-", plname, playerid);
            }
            else
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: %s", plname, playerid, pIPs);
            }
            SendIP = 1;
        }
    }
    else if (!strcmp(pAKA,plname,true))
    {
        format(string,sizeof(string),"* %s (%d) has joined Raven's Roleplay. (%s)", plname, playerid,playersip);
        if (strlen(pIPs) < 3) SendIP = 0;
        else if (!strcmp(pIPs,playersip,true)) SendIP = 0;
        else
        {
            if(strlen(pIPs) >= 128)
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: -Too Many, Be Careful-", plname, playerid);
            }
            else
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: %s", plname, playerid, pIPs);
            }
            SendIP = 1;
        }
    }
    else
    {
        format(string,sizeof(string),"* %s (%d) has joined the Server (%s). (Alias: %s)", plname, playerid,playersip, pAKA);
        if (strlen(pIPs) < 3) SendIP = 0;
        else if (!strcmp(pIPs,playersip,true)) SendIP = 0;
        else
        {
            if(strlen(pIPs) >= 128)
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: -Too Many, Be Careful-", plname, playerid);
            }
            else
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: %s", plname, playerid, pIPs);
            }
            SendIP = 1;
        }
    }

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && playerid != i)
        {
            if(PlayerInfo[i][pAdmin] > 1)
            {
                SendClientMessage(i,COLOR_GREEN,string);
                if(SendIP == 1)
                {
                    SendClientMessage(i,COLOR_GREEN,string2);
                    SendIP = 0;
                }
            }
            else
            {
                format(string,sizeof(string),"* %s (%d) has joined Raven's Roleplay", plname, playerid);
                SendClientMessage(i,COLOR_GREY,string);
            }
        }
    }



Re: Some help needed. - Mimic - 01.05.2012

[mistake ignore comment]


Re: Some help needed. - HighPitchedVoice - 01.05.2012

Okay.


Re: Some help needed. - HighPitchedVoice - 01.05.2012

Bump


Re: Some help needed. - Youice - 01.05.2012

1st_Its so easy
2nd_ don't say "BUMP"
3rd_ here is the code::

Код:
format(pFILE[playerid], 128, "LARP/Users/Aliases/%s.txt", plname);
    dini_Create(pFILE[playerid]);
    dini_Set(pFILE[playerid], "Nameip", playersip);

    if(strlen(dini_Get("LARP/Users/Aliases/ips.txt", plname)) == 0)
    {
        dini_Set("LARP/Users/Aliases/ips.txt", plname, playersip);
    }
    else
    {
        if( strfind( dini_Get("LARP/Users/Aliases/ips.txt", plname), playersip, true) == -1 )
        {
            format(string,sizeof(string),"%s, %s", dini_Get("LARP/Users/Aliases/ips.txt",plname), playersip);
            dini_Set("LARP/Users/Aliases/ips.txt", plname, string);
        }
    }

    new pAKA[256];
    pAKA = dini_Get("LARP/Users/Aliases/alias.txt",playersip);
    new pIPs[256];
    pIPs = dini_Get("LARP/Users/Aliases/ips.txt",plname);

    if (strlen(pAKA) < 3)
    {
        format(string,sizeof(string),"* %s (%d) has joined Raven's Roleplay. (%s)", plname, playerid,playersip);
        if (strlen(pIPs) < 3) SendIP = 0;
        else if (!strcmp(pIPs,playersip,true)) SendIP = 0;
        else
        {
            if(strlen(pIPs) >= 128)
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: -Too Many, Be Careful-", plname, playerid);
            }
            else
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: %s", plname, playerid, pIPs);
            }
            SendIP = 1;
        }
    }
    else if (!strcmp(pAKA,plname,true))
    {
        format(string,sizeof(string),"* %s (%d) has joined Raven's Roleplay. (%s)", plname, playerid,playersip);
        if (strlen(pIPs) < 3) SendIP = 0;
        else if (!strcmp(pIPs,playersip,true)) SendIP = 0;
        else
        {
            if(strlen(pIPs) >= 128)
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: -Too Many, Be Careful-", plname, playerid);
            }
            else
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: %s", plname, playerid, pIPs);
            }
            SendIP = 1;
        }
    }
    else
    {
        format(string,sizeof(string),"* %s (%d) has joined the Server (%s). (Alias: %s)", plname, playerid,playersip, pAKA);
        if (strlen(pIPs) < 3) SendIP = 0;
        else if (!strcmp(pIPs,playersip,true)) SendIP = 0;
        else
        {
            if(strlen(pIPs) >= 128)
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: -Too Many, Be Careful-", plname, playerid);
            }
            else
            {
                format(string2,sizeof(string2),"* %s (%d)'s Other IPs: %s", plname, playerid, pIPs);
            }
            SendIP = 1;
        }
    }

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pAdmin] >= 1)
            {
                SendClientMessage(i,COLOR_GREEN,string);
                if(SendIP == 1)
                {
                    SendClientMessage(i,COLOR_GREEN,string2);
                    SendIP = 0;
                }
            }
            else
            {
                format(string,sizeof(string),"* Admin %s (%d) has joined Raven's Roleplay", plname, playerid);
                SendClientMessage(i,COLOR_GREY,string);
            }
        }
    }



Re: Some help needed. - Youice - 02.05.2012

Edit: If it worked tell me!