Anti-Weapon Hax :3
#1

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);
            }
        }
    }
}
Reply
#2

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.

Reply
#3

Quote:
Originally Posted by Snipa
View Post
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
Reply
#4

enum ForbiddenWeapons
{
2, //error 001: expected token: "-identifier-", but found "-integer value-"
6,
7
}
impossible

use an array for that
Reply
#5

instead of an enum, what about a define? GetPlayerWeapon, compare it with the banned weaps. Dunno if it'll work.
Reply
#6

You can't enumerate numbers.. just use GetPlayerWeapon and use the forbidden weapon ids.
Reply
#7

I believe its:
pawn Code:
new ForbiddenWeapons[] =
{
     2,
     6,
     7
};
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)