Admin -
Alex_Obando - 29.08.2011
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.
Re: Admin -
JaTochNietDan - 29.08.2011
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.
Respuesta: Admin -
Alex_Obando - 29.08.2011
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.
Re: Admin -
LetsOWN[PL] - 29.08.2011
Use
pawn Код:
if(!AdminConnected()) Ban(i);
instead of
pawn Код:
if(!IsAdminConnected()) Ban(i);
?
Respuesta: Admin -
kirk - 29.08.2011
Just change the IsAdminConnected to AdminConnected, and fix the identation on the line 73.
BUMP:
Didnt see the post above.
Re: Respuesta: Admin -
JaTochNietDan - 29.08.2011
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.
Respuesta: Re: Respuesta: Admin -
kirk - 29.08.2011
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.
Re: Admin -
LetsOWN[PL] - 29.08.2011
@JaTochNietDan nobody's perfect :P
Re: Admin -
JaTochNietDan - 29.08.2011
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.
Re: Admin -
LetsOWN[PL] - 29.08.2011
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