SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 15/06/2010, 10:13 AM   #1
Headshot1108
Huge Clucker
 
Join Date: Mar 2008
Posts: 251
Reputation: 0
Default minigun

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 ?
Headshot1108 is offline  
Old 15/06/2010, 10:20 AM   #2
Naxix
Huge Clucker
 
Join Date: Aug 2009
Posts: 363
Reputation: 0
Default Re: minigun

Show us some code or we can't say why
Naxix is offline  
Old 15/06/2010, 10:30 AM   #3
Headshot1108
Huge Clucker
 
Join Date: Mar 2008
Posts: 251
Reputation: 0
Default Re: minigun

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
Headshot1108 is offline  
Old 15/06/2010, 10:36 AM   #4
whitedragon
Gangsta
 
Join Date: Sep 2009
Posts: 516
Reputation: 2
Default Re: minigun

why you dont load it on gamemodeinit? there it more useful
__________________
If i have typos sry but dont have time to do spellcheck
whitedragon is offline  
Old 15/06/2010, 10:37 AM   #5
Headshot1108
Huge Clucker
 
Join Date: Mar 2008
Posts: 251
Reputation: 0
Default Re: minigun

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?
Headshot1108 is offline  
Old 15/06/2010, 11:02 AM   #6
DJDhan
High-roller
 
DJDhan's Avatar
 
Join Date: Oct 2009
Location: Canada
Posts: 1,150
Reputation: 6
Default Re: minigun

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;
}
__________________
DJDhan is offline  
Old 15/06/2010, 11:23 AM   #7
Headshot1108
Huge Clucker
 
Join Date: Mar 2008
Posts: 251
Reputation: 0
Default Re: minigun

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 -_-
Headshot1108 is offline  
Old 15/06/2010, 11:29 AM   #8
DJDhan
High-roller
 
DJDhan's Avatar
 
Join Date: Oct 2009
Location: Canada
Posts: 1,150
Reputation: 6
Default Re: minigun

Arite I've modified my post now.

EDIT: Your code is not ok. Running timers per player is not very smart.
__________________
DJDhan is offline  
Old 15/06/2010, 11:30 AM   #9
Headshot1108
Huge Clucker
 
Join Date: Mar 2008
Posts: 251
Reputation: 0
Default Re: minigun

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");
}
Headshot1108 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
minigun gozo12 Help Archive 4 09/04/2010 08:14 PM
Minigun Igdirli 76 Help Archive 15 01/03/2010 02:51 PM
need help on minigun ban fs stuntage Help Archive 3 18/07/2009 09:54 AM
[GameMode] [GM]New Minigun rytis935 Gamemode Scripts 16 02/07/2009 12:02 PM


All times are GMT. The time now is 05:24 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.