[HELP] Banning Players With Weapons -
DaRkAnGeL[NBK] - 13.10.2011
Hey,
I Added this to my GM to reset player weapons but how would i make it if they have weapons they get banned ? heres the code:
pawn Код:
forward reset();
public reset()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
ResetPlayerWeapons(playerid);
}
return 1;
}
and OnGameModeInit()
pawn Код:
SetTimer("reset",1000,true);
how would that be done ? please help XD
Re: [HELP] Banning Players With Weapons -
Vince - 13.10.2011
pawn Код:
if(GetPlayerWeapon(playerid) != 0) { BanEx(playerid, "No Weapon Allowed"); }
Re: [HELP] Banning Players With Weapons -
DaRkAnGeL[NBK] - 13.10.2011
Thank you Vince
Re: [HELP] Banning Players With Weapons -
grand.Theft.Otto - 13.10.2011
Your code checks for people with weapons every second.
I added a second timer under your timer callback to check if they still have weapons after 10 seconds, if they do, it will ban them with a message:
pawn Код:
forward reset();
public reset()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
ResetPlayerWeapons(playerid);
SetTimerEx("WeaponBan",10000,false,"d",playerid);
}
return 1;
}
forward WeaponBan(playerid);
public WeaponBan(playerid)
{
if(GetPlayerWeapon(playerid) != 0))
{
new string[128], name[24];
GetPlayerName(playerid,name,24);
format(string,128,"%s (%d) Has Been Automatically Banned For Weapon Hacks.",name,playerid);
SendClientMessageToAll(-1,string);
print(string);
Ban(playerid);
return 1;
}
}
Re: [HELP] Banning Players With Weapons -
DaRkAnGeL[NBK] - 13.10.2011
Код:
C:\Users\Admin\Desktop\SAMP\Fas FreeRoam\gamemodes\drift.pwn(377) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
also how can i change the fact that i get banned on connect?
Re: [HELP] Banning Players With Weapons -
DaRkAnGeL[NBK] - 13.10.2011
Код:
forward reset();
public reset()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
ResetPlayerWeapons(playerid);
SetTimerEx("WeaponBan",10000,false,"d",playerid);
}
return 1;
}
forward WeaponBan(playerid);
public WeaponBan(playerid)
{
if(GetPlayerWeapon(playerid) != 0)
{
new string[128], name[24];
GetPlayerName(playerid,name,24);
format(string,128,"%s (%d) Has Been Automatically Banned For Weapon Hacks.",name,playerid);
SendClientMessageToAll(-1,string);
print(string);
Ban(playerid);
}
return 1;
}
no errors will this still work?
Re: [HELP] Banning Players With Weapons -
grand.Theft.Otto - 13.10.2011
It should work, I didn't test it myself.
And by default you will get a message saying ' You are banned from this server ' if you attempt to connect while banned.
If you want your own custom message, that takes time and work by creating variables and writing to your userfile, etc..
Re: [HELP] Banning Players With Weapons -
DaRkAnGeL[NBK] - 13.10.2011
nope it spammed bans on every id ever posible into the 10thousends
Re: [HELP] Banning Players With Weapons -
grand.Theft.Otto - 13.10.2011
Try this:
pawn Код:
forward WeaponBan();
public WeaponBan()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerWeapon(i) != 0))
{
new string[128], name[24];
GetPlayerName(i,name,24);
format(string,128,"%s (%d) Has Been Automatically Banned For Weapon Hacks.",name,i);
SendClientMessageToAll(-1,string);
print(string);
Ban(i);
}
}
}
return 1;
}
Re: [HELP] Banning Players With Weapons -
DaRkAnGeL[NBK] - 14.10.2011
crashes server-samp.exe