Anti-Weapon Hax :3 - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Anti-Weapon Hax :3 (
/showthread.php?tid=246788)
Anti-Weapon Hax :3 - Unknown123 - 06.04.2011
How to use enums
Ill made this (1 min work)
pawn Code:
#include <a_samp>
public OnFilterScriptInit()
{
SetTimer("WaponHax", 1000, true);
return 1;
}
enum ForbiddenWeapons
{
2, //error 001: expected token: "-identifier-", but found "-integer value-"
6,
7
}
new BannedWeapons[MAX_PLAYERS][ForbiddenWeapons];
forward WaponHax();
public WaponHax()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerAdmin(i) && IsPlayerConnected(i))
{
if(BannedWeapons[i][ForbiddenWeapons]) //error 032: array index out of bounds (variable "BannedWeapons")
{
new gunname[32];
GetWeaponName(BannedWeapons[i][ForbiddenWeapons], gunname, 32); //error 032: array index out of bounds (variable "BannedWeapons")
new string[128];
format(string,sizeof(string),"ID (%d) is using a %s, and that weapon is inside the enum", i, gunname);
SendClientMessageToAll(0xFFFFFFAA, string);
}
}
}
}
Re: Anti-Weapon Hax :3 -
Snipa - 06.04.2011
pawn Code:
enum ForbiddenWeapons
{
2, //error 001: expected token: "-identifier-", but found "-integer value-"
6,
7
};
Looking at other errors..
Quote:
This forum requires that you wait 120 seconds between posts. Please try again in 2 seconds.
|
Re: Anti-Weapon Hax :3 - Unknown123 - 06.04.2011
Quote:
Originally Posted by Snipa
pawn Code:
enum ForbiddenWeapons { 2, //error 001: expected token: "-identifier-", but found "-integer value-" 6, 7 };
Looking at other errors..
|
ok, ill just wait then :P
Re: Anti-Weapon Hax :3 -
Donya - 06.04.2011
enum ForbiddenWeapons
{
2, //error 001: expected token: "-identifier-", but found "-integer value-"
6,
7
}
impossible
use an array for that
Re: Anti-Weapon Hax :3 -
Snipa - 06.04.2011
instead of an enum, what about a define? GetPlayerWeapon, compare it with the banned weaps. Dunno if it'll work.
Re: Anti-Weapon Hax :3 -
austin070 - 06.04.2011
You can't enumerate numbers.. just use GetPlayerWeapon and use the forbidden weapon ids.
Re: Anti-Weapon Hax :3 -
randomkid88 - 06.04.2011
I believe its:
pawn Code:
new ForbiddenWeapons[] =
{
2,
6,
7
};