A filterscript to disable weapons.
#1

Hi,

I got an roleplay server but i want to disable all weapons.
Is there a filterscript to disable those weapons ? Or is there someone that is able to create one for me ?
The weapons are blocked in interiors but i want to disable the weapons in the whole server.

Kind regards,
Ruben
Reply
#2

Just don't give them any weapons at all, and to be sure you can use something like:

pawn Code:
public OnGameModeinit()
{
      // other code here
      return SetTimer("Disableweapons",5000,true);
}

forward Disableweapons();
public Disableweapons()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
         ResetPlayerWeapons(i);
     }
      return 1;
}
You could use OnPlayerUpdate to make it more accurate (removes weapons more quikly) but I'm not really a fan of the callback cause it can use lagg if you overuse it.
Reply
#3

A single statement is really nothing to worry about for OnPlayerUpdate. Of course you shouldn't use it for file writing or other slow stuff.
Reply
#4

Quote:
Originally Posted by -Danny-
View Post
Just don't give them any weapons at all, and to be sure you can use something like:

pawn Code:
public OnGameModeinit()
{
      // other code here
      return SetTimer("Disableweapons",5000,true);
}

forward Disableweapons();
public Disableweapons()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
         ResetPlayerWeapons(i);
     }
      return 1;
}
You could use OnPlayerUpdate to make it more accurate (removes weapons more quikly) but I'm not really a fan of the callback cause it can use lagg if you overuse it.
Thanks alot.
Today i made a stunting gamemode.
But where do i put these lines ?

pawn Code:
public OnGameModeinit()
{
      // other code here
      return SetTimer("Disableweapons",5000,true);
}

forward Disableweapons();
public Disableweapons()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
         ResetPlayerWeapons(i);
     }
      return 1;
}
Reply
#5

Quote:
Originally Posted by rubenejbr
View Post
Thanks alot.
Today i made a stunting gamemode.
But where do i put these lines ?

pawn Code:
public OnGameModeinit()
{
      // other code here
      return SetTimer("Disableweapons",5000,true);
}

forward Disableweapons();
public Disableweapons()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
         ResetPlayerWeapons(i);
     }
      return 1;
}
You can just paste it into your script editor, it can be on any place BUT NOT in an existing callback. Also, if you've already defined OnGameModeInit, paste the Init code in that callback without the header (public OnGameModeInit())

Oh and, slight mistake in my code: Change OnGameModeinit to OnGameModeInit. Note the capitalized I.

@Vince: I know that you can use it till some point (when the code is too heavy and it will cause lagg), but I prefer to not use it in samples and other. Maybe the guy already has a shitload of OPU stuff. A few small things becomes a big thing. But you're right on that point - if he only uses this statement it would work perfectly.
Reply
#6

Like -Danny- said, can't you just NOT give them weapons in the first place? Then ban anyone that DOES have weapons, as they're cheating.
Reply
#7

Thanks guys

I will use the part that Danny sent me.

Thanks alot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)