#1

Well, I'm using this script. I want to add a warning system. I mean, If player try to hack weapons at first time it should be restplayerweapons and if he try to hack again then it should ban player.

i have tried but idk what's wrong.

PHP код:
public BadCheck()
{
    new 
weapstring[228], string3[256], pname[MAX_PLAYER_NAME]; //  
    
for(new iGetMaxPlayers(); bi++) // 
    
{
        
GetPlayerName(ipnamesizeof(pname));
        
weap GetPlayerWeapon(i);
        for(new 
wsizeof(BadWeapons); w++)
        {
            if(
pInfo[i][pAdmin] < 1)
            {
                if(
weap == BadWeapons[w])
                   {
                   
format(string,sizeof(string),"SERVER ANTI-CHEAT: %s is trying to hack weapons."pname);
                   
SendMessageToAdmins(RED,string);
                   
ResetPlayerWeapons(i);
                }
            }
        }
    }
    return 
1;

Well, This work good but i want to add if player try to hack again which means 2nd time then it should kick player.
Reply
#2

PHP код:

// top
new gTimesHacked[MAX_PLAYERS];
public 
BadCheck()
{
    new 
weapstring[228], string3[256], pname[MAX_PLAYER_NAME]; //  
    
for(new iGetMaxPlayers(); bi++) // 
    
{
        
GetPlayerName(ipnamesizeof(pname));
        
weap GetPlayerWeapon(i);
        for(new 
wsizeof(BadWeapons); w++)
        {
            if(
pInfo[i][pAdmin] < 1)
            {
                if(
weap == BadWeapons[w])
                   {
                                   
gTimesHacked[i]++;
                                   if(
gTimesHacked[i] > 1)
                                   {
                                        
Kick(i);
                                   }
                   
format(string,sizeof(string),"SERVER ANTI-CHEAT: %s is trying to hack weapons."pname);
                   
SendMessageToAdmins(RED,string);
                   
ResetPlayerWeapons(i);
                }
            }
        }
    }
    return 
1;

You can also put a variable in the player enum. Rememeber to reset at connection.
Reply
#3

What do you mean by reset at connection?

You mean

gTimesHacked[playerid] = 0; ?
Reply
#4

Well, it's not working. It stills kicking at first time.
Reply
#5

Make sure you return after you've reset the weapons. Otherwise the loop will continue... Resulting in the variable getting added to multiple times. And then the user will be kicked.

Oh and yes, I mean like that.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)