06.04.2011, 00:53
How to use enums
Ill made this (1 min work)
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);
}
}
}
}