#1

So...How I can do these:

I have this anticheat "Or maybe an anticheat detector:"


pawn Код:
public weaponanti()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
     {

       if (GetPlayerWeapon(i) == 38)
       {
           new pname[200];
           new string[200];
           new ammo = GetPlayerAmmo(i);
           new plrIP[16];
           GetPlayerIp(i, plrIP, sizeof(plrIP));
           GetPlayerName(i, pname, sizeof(pname));
           format(string,sizeof(string),"%s [ID: %d] [IP:%s] is suspected of having Minigun Hacks (Ammo: %i) [Use /getinfo %d]",pname,i,plrIP,ammo,i);
           CallRemoteFunction("SendClientMessageToAdmins","isi",0xFF0000,string,1);
           format(string,sizeof(string),"Alex has a minigun");
           SetTimer("banningtimer",15000,0);
           banning[i] =1;
       }

}


stock AdminConnected(playerid)
{
    for(new a, g = GetMaxPlayers(); a < g; a++)
        if(IsPlayerConnected(a) && IsPlayerAdmin(a)) return 1;
    return 0;
}
So if the administrator is not connected then dont send the message, then ban him
Like
pawn Код:
AdminConnected
{else}
Ban(playerid);
How to add it, thanks.
Reply
#2

You have some missing brackets in that snippet firstly and secondly you have an unused parameter in your IsAdminConnected function, so you need to remove that unless you're going to use it!

pawn Код:
public weaponanti()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (GetPlayerWeapon(i) == 38)
        {
            if(!AdminConnected()) Ban(i);
            else
            {
                new pname[200];
                new string[200];
                new ammo = GetPlayerAmmo(i);
                new plrIP[16];
                GetPlayerIp(i, plrIP, sizeof(plrIP));
                GetPlayerName(i, pname, sizeof(pname));
                format(string,sizeof(string),"%s [ID: %d] [IP:%s] is suspected of having Minigun Hacks (Ammo: %i) [Use /getinfo %d]",pname,i,plrIP,ammo,i);
                CallRemoteFunction("SendClientMessageToAdmins","isi",0xFF0000,string,1);
                format(string,sizeof(string),"Alex has a minigun");
                SetTimer("banningtimer",15000,0);
                banning[i] =1;
            }
        }
    }
    return 1;
}

stock AdminConnected()
{
    for(new a, g = GetMaxPlayers(); a < g; a++)
        if(IsPlayerConnected(a) && IsPlayerAdmin(a)) return 1;
    return 0;
}
There are other problems with your code too, like creating an array with a huge amount of wasted cells and the fact that this snippet of code could get called several times depending on the amount of times this callback is called.

Since you're struggling with such basic PAWN, I highly suggest you read the PAWN manuals over at CompuPhase's website.
Reply
#3

pawn Код:
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\filterscripts\AlexTest.pwn(57) : error 017: undefined symbol "IsAdminConnected"
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\filterscripts\AlexTest.pwn(73) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

Use
pawn Код:
if(!AdminConnected()) Ban(i);
instead of

pawn Код:
if(!IsAdminConnected()) Ban(i);
?
Reply
#5

Just change the IsAdminConnected to AdminConnected, and fix the identation on the line 73.

BUMP:

Didnt see the post above.
Reply
#6

Quote:
Originally Posted by Alex_Obando
Посмотреть сообщение
pawn Код:
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\filterscripts\AlexTest.pwn(57) : error 017: undefined symbol "IsAdminConnected"
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\filterscripts\AlexTest.pwn(73) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
I'm pretty shocked you couldn't even fix that error yourself. If you had simply read the error instead of pasting it here, you would've realized I simply mis-typed your function name in the code and all you had to do was re-name it.

Again I seriously suggest that you start from the beginning with programming.
Reply
#7

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
I'm pretty shocked you couldn't even fix that error yourself. If you had simply read the error instead of pasting it here, you would've realized I simply mis-typed your function name in the code and all you had to do was re-name it.

Again I seriously suggest that you start from the beginning with programming.
As he said you should spend atleast 5 minutes more trying to understand the reason of those warning and errors instead of asking and solving it without understanding it, you could also change the name of the function AdminConnected to IsAdminConnected and would be fixed aswell.
Reply
#8

@JaTochNietDan nobody's perfect :P
Reply
#9

Quote:
Originally Posted by LetsOWN[PL]
Посмотреть сообщение
@JaTochNietDan nobody's perfect :P
There's a difference between being perfect and not even trying to figure out what the problem is and instantly looking to other people to fix it for you.
Reply
#10

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
There's a difference between being perfect and not even trying to figure out what the problem is and instantly looking to other people to fix it for you.
True.. But you must agree, that most of the peeps are too lazy to work for theirselfes, and without any trying, figuring or thinking they're posting new help threads :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)