//the enum...
enum DrugInfo
{
Crack,
Marijuana,
Weed,
Cocaine,
Canabis,
Ganja,
Heroin,
}
new DrugType[MAX_PLAYERS][DrugInfo];
//and the random that is in a callback
new randomvalue[3]={Weed,Crack,Canabis};
DrugType[playerid][randomvalue[random(sizeof randomvalue)] =1;
C:\Games\Rockstar Games\GTA San Andreas\sampserver\filterscripts\DontDoDrugsMan.pwn(368) : warning 213: tag mismatch
C:\Games\Rockstar Games\GTA San Andreas\sampserver\filterscripts\DontDoDrugsMan.pwn(368) : warning 213: tag mismatch
C:\Games\Rockstar Games\GTA San Andreas\sampserver\filterscripts\DontDoDrugsMan.pwn(369) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
3 Warnings.
new randomvalue[3]={Weed,Crack,Canabis};
new randomvalue[3]={DrugType[playerid][Weed], DrugType[playerid][Crack], DrugType[playerid][Canabis]};
new randomvalue[3]={DrugType[playerid][Weed], DrugType[playerid][Crack], DrugType[playerid][Canabis]};
DrugType[playerid][randomvalue[random(sizeof randomvalue)]] =1;
C:\Games\Rockstar Games\GTA San Andreas\sampserver\filterscripts\DontDoDrugsMan.pwn(370) : error 008: must be a constant expression; assumed zero
C:\Games\Rockstar Games\GTA San Andreas\sampserver\filterscripts\DontDoDrugsMan.pwn(371) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
pawn Код:
pawn Код:
|
Whe initialising variables you must use constant expressions, other vars will not work.
|
DrugType[playerid] |= randomvalue[random(sizeof randomvalue)];
enum DrugInfo
{
Crack,
Marijuana,
Weed,
Cocaine,
Canabis,
Ganja,
Heroin,
}
new DrugType[MAX_PLAYERS][DrugInfo];
GivePlayerRandomDrug(playerid)
{
new
iRand = random(7);
switch(iRand)
{
case Crack:
{
DrugType[playerid][Crack]++;
SendClientMessage(playerid, 0x00FF00AA, "You have found a package of crack.");
}
case Marijuana:
{
DrugType[playerid][Marijuana]++;
SendClientMessage(playerid, 0x00FF00AA, "You have found a package of marijuana.");
}
case Weed:
{
DrugType[playerid][Weed]++;
SendClientMessage(playerid, 0x00FF00AA, "You have found a package of weed.");
}
case Cocaine:
{
DrugType[playerid][Cocaine]++;
SendClientMessage(playerid, 0x00FF00AA, "You have found a package of cocain.");
}
case Canabis:
{
DrugType[playerid][Canabis]++;
SendClientMessage(playerid, 0x00FF00AA, "You have found a package of cannabis.");
}
case Ganja:
{
DrugType[playerid][Ganja]++;
SendClientMessage(playerid, 0x00FF00AA, "You have found a package of ganja.");
}
case Heroin:
{
DrugType[playerid][Heroin]++;
SendClientMessage(playerid, 0x00FF00AA, "You have found a package of heroin.");
}
}
}