minigun
#1

Hey guys i have a little problem..
In my server i have an anti minigun check and few people won't be banned from the server.
I have also a weapon check command where I can see all his weapons. I wrote /weapons at the guy who wasn't got banned by having a minigun, and the minigun wasn't in the list. I gave me a minigun and at me the minigun was in the list. (the command works right, also the anti-minigun timer).
My question why ?
Reply
#2

Show us some code or we can't say why
Reply
#3

ah yes forgot:

In onplayerconnect:

Code:
WeaponTimer[playerid] = SetTimerEx("WeaponHack", 1000, true, "d",playerid);
disconnect:

Code:
KillTimer(WeaponTimer[playerid]);
public:

pawn Code:
forward WeaponHack(playerid);
public WeaponHack(playerid)
{
    if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1) return 0;
    new string[128];
    new w7;
    new a7;
    new day,month,year,hour,minute;
    new ip[256];
    for(new i; i < 13; i++)
    {
        GetPlayerWeaponData(playerid, i, w7, a7);
        if(w7 == 38 && a7 >= 1)
        {
                GetPlayerIp(playerid,ip,sizeof(ip));
                getdate(year,month,day);
                gettime(hour,minute);
                format(string, sizeof(string), "%s was banned from the server. [Reason: Minigun]", PlayerName(playerid));
                SendClientMessageToAll(_COLOR_RED, string);
                SendClientMessage(playerid,_COLOR_RED," ");
                SendClientMessage(playerid,_COLOR_RED," ");
                SendClientMessage(playerid,_COLOR_RED,"You was banned from this server!");
                SendClientMessage(playerid,_COLOR_WHITE,"Reason: Minigun");
                SendClientMessage(playerid,_COLOR_WHITE,"Admin: Anti-Cheat");
                format(string2, sizeof(string2), "Date: %d/%d/%d",day,month,year);
                SendClientMessage(playerid,_COLOR_WHITE,string);
                if (minute <= 9)
                {
                format(string,25,"Time: %d:0%d",hour,minute);
                SendClientMessage(playerid,_COLOR_WHITE,string);
                }
                else
                {
                format(string,25,"Time: %d:%d",hour,minute);
                SendClientMessage(playerid,_COLOR_WHITE,string);
                }
                format(string, sizeof(string), "IP: %s",ip);
                SendClientMessage(playerid,_COLOR_WHITE,string;
                if(LoggedIn[playerid] == 1) dUserSetINT(PlayerName(playerid)).("Banned",1);
                WriteBanToFile(playerid, "Anti-Cheat", "Minigun");
                BanEx(playerid,"Minigun");
                return 1;
        }
    }
    return 0;
}
btw: i don't do a for loop in my public (i = max_players etc), because i got many problems with this
Reply
#4

why you dont load it on gamemodeinit? there it more useful
Reply
#5

Quote:
Originally Posted by whitedragon
why you dont load it on gamemodeinit? there it more useful
because there was the problem too..

In /weapons the minigun isn't there too (not at all, only at few people.)
How i said, i gave me a minigun, and my minigun was listed.
at few people who the anti minigun bugs, the minigun wasn't listed in the /weapons command, so how the timer can work right?
Reply
#6

You are sending playerid and then scanning all players


Put this at the Top somewhere
Code:
new weaponhacktimer;
Put this under OnGameModeInit()

Code:
weaponhacktimer = SetTimer("WeaponHack", 1000, true);
Code:
forward WeaponHack();
public WeaponHack()
{

	
	new string[128];
	new w7;
	new a7;
	new day,month,year,hour,minute;
	new ip[256];
	for(new j=0; j < MAX_PLAYERS; j++)
	{
             if(IsPlayerAdmin(j) || PlayerInfo[j][pAdmin] > 0) return 0;
          for(new i=0;i<13,i++)
          {
		GetPlayerWeaponData(j, i, w7, a7);
		if(w7 == 38 && a7 >= 1)
		{
			GetPlayerIp(j,ip,sizeof(ip));
			getdate(year,month,day);
			gettime(hour,minute);
			format(string, sizeof(string), "%s was banned from the server. [Reason: Minigun]", PlayerName(playerid));
			SendClientMessageToAll(_COLOR_RED, string);
			SendClientMessage(j,_COLOR_RED," ");
			SendClientMessage(j,_COLOR_RED," ");
			SendClientMessage(j,_COLOR_RED,"You was banned from this server!");
			SendClientMessage(j,_COLOR_WHITE,"Reason: Minigun");
			SendClientMessage(j,_COLOR_WHITE,"Admin: Anti-Cheat");
			format(string2, sizeof(string2), "Date: %d/%d/%d",day,month,year);
			SendClientMessage(j,_COLOR_WHITE,string);
			if (minute <= 9)
			{
				format(string,25,"Time: %d:0%d",hour,minute);
				SendClientMessage(j,_COLOR_WHITE,string);
			}
			else
			{
				format(string,25,"Time: %d:%d",hour,minute);
				SendClientMessage(j,_COLOR_WHITE,string);
			}
			format(string, sizeof(string), "IP: %s",ip);
			SendClientMessage(j,_COLOR_WHITE,string;
			if(LoggedIn[j] == 1) dUserSetINT(PlayerName(playerid)).("Banned",1);
			WriteBanToFile(j, "Anti-Cheat", "Minigun");
			BanEx(j,"Minigun");
			
		}
	}
     }
	return 1;
}
Reply
#7

Quote:
Originally Posted by DJDhan
You are sending playerid and then scanning all players


Put this at the Top somewhere
Code:
new weaponhacktimer;
Put this under OnGameModeInit()

Code:
weaponhacktimer = SetTimer("WeaponHack", 1000, true);
Code:
forward WeaponHack();
public WeaponHack()
{

	
	new string[128];
	new w7;
	new a7;
	new day,month,year,hour,minute;
	new ip[256];
	for(new i; i < 13; i++)
	{
             if(IsPlayerAdmin(i) || PlayerInfo[i][pAdmin] > 0) return 0;
		GetPlayerWeaponData(playerid, i, w7, a7);
		if(w7 == 38 && a7 >= 1)
		{
			GetPlayerIp(playerid,ip,sizeof(ip));
			getdate(year,month,day);
			gettime(hour,minute);
			format(string, sizeof(string), "%s was banned from the server. [Reason: Minigun]", PlayerName(playerid));
			SendClientMessageToAll(_COLOR_RED, string);
			SendClientMessage(playerid,_COLOR_RED," ");
			SendClientMessage(playerid,_COLOR_RED," ");
			SendClientMessage(playerid,_COLOR_RED,"You was banned from this server!");
			SendClientMessage(playerid,_COLOR_WHITE,"Reason: Minigun");
			SendClientMessage(playerid,_COLOR_WHITE,"Admin: Anti-Cheat");
			format(string2, sizeof(string2), "Date: %d/%d/%d",day,month,year);
			SendClientMessage(playerid,_COLOR_WHITE,string);
			if (minute <= 9)
			{
				format(string,25,"Time: %d:0%d",hour,minute);
				SendClientMessage(playerid,_COLOR_WHITE,string);
			}
			else
			{
				format(string,25,"Time: %d:%d",hour,minute);
				SendClientMessage(playerid,_COLOR_WHITE,string);
			}
			format(string, sizeof(string), "IP: %s",ip);
			SendClientMessage(playerid,_COLOR_WHITE,string;
			if(LoggedIn[playerid] == 1) dUserSetINT(PlayerName(playerid)).("Banned",1);
			WriteBanToFile(playerid, "Anti-Cheat", "Minigun");
			BanEx(playerid,"Minigun");
			
		}
	}
	return 1;
}
dude..

This code is wrong...
also i would be 13 players and playerid is missing.

my code is ok, the i isnt for the players, its for the weapon slots -_-
Reply
#8

Arite I've modified my post now.

EDIT: Your code is not ok. Running timers per player is not very smart.
Reply
#9

Quote:
Originally Posted by Headshot1108
Quote:
Originally Posted by whitedragon
why you dont load it on gamemodeinit? there it more useful
because there was the problem too..
I'm trying to solve this, I know with a loop would be better.

EDIT: In my /weapons command the minigun won't show (AT FEW PEOPLE), so say me how any kind of timer should work ?

here my command, its from LAdmin:

pawn Code:
dcmd_weaps(playerid,params[]) {
  if(PlayerInfo[playerid][Level] >= 1 || IsPlayerAdmin(playerid)) {
      if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /weaps [playerid]");
    new player1, string[128], string2[64], WeapName[24], slot, weap, ammo, Count, x;
        player1 = strval(params);

        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            format(string2,sizeof(string2),"[>> %s Weapons (id:%d) <<]", PlayerName2(player1), player1); SendClientMessage(playerid,blue,string2);
            for (slot = 0; slot < 14; slot++) { GetPlayerWeaponData(player1, slot, weap, ammo); if( ammo != 0 && weap != 0) Count++; }
            if(Count < 1) return SendClientMessage(playerid,blue,"Player has no weapons");

            if(Count >= 1)
            {
                for (slot = 0; slot < 14; slot++)
                {
                    GetPlayerWeaponData(player1, slot, weap, ammo);
                    if( ammo != 0 && weap != 0)
                    {
                        GetWeaponName(weap, WeapName, sizeof(WeapName) );
                        if(ammo == 65535 || ammo == 1) format(string,sizeof(string),"%s%s (1)",string, WeapName );
                        else format(string,sizeof(string),"%s%s (%d)",string, WeapName, ammo );
                        x++;
                        if(x >= 5)
                        {
                          SendClientMessage(playerid, blue, string);
                          x = 0;
                            format(string, sizeof(string), "");
                        }
                        else format(string, sizeof(string), "%s, ", string);
                    }
              }
                if(x <= 4 && x > 0) {
                    string[strlen(string)-3] = '.';
                  SendClientMessage(playerid, blue, string);
                }
          }
          return 1;
        } else return SendClientMessage(playerid, red, "Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)