12.03.2012, 19:10
Hey, i know in the GF there was the
how was that defined, is there a better way?
pawn Код:
If Is A Cop
If Is A Cop
if(GetPlayerSkin(playerid) == ls cop skin id || GetPlayerSkin(playerid) == sf cop skin id || GetPlayerSkin(playerid) == lv cop skin id)
stock IsACop(playerid)
{
switch(GetPlayerSkin(playerid))
{
case 280..288: return true;
case 165, 166: return true;
default: return false;
}
}
The simplest way is
pawn Код:
|
if(GetPlayerSkin(playerid) == 276 || 274 || 275 || 275 || 277 ||278 || 279)
Actually you mean your code would be?
pawn Код:
|
I would use a switch for that very reason. If you use an if statement it and have a lot of skins to go through it will gain length pretty fast. With an if statement you could do
case 274..279: return true; It wont take as much space and will be more efficient |
public RandomFireTimer()
{
new rndfire = random(sizeof(RandomFireSpawn));
{
AddFire(RandomFireSpawn[rndfire][0][0], RandomFireSpawn[rndfire][0][1], RandomFireSpawn[rndfire][0][2]);
AddFire(RandomFireSpawn[rndfire][1][0], RandomFireSpawn[rndfire][1][1], RandomFireSpawn[rndfire][1][2]);
AddFire(RandomFireSpawn[rndfire][2][0], RandomFireSpawn[rndfire][2][1], RandomFireSpawn[rndfire][2][2]);
AddFire(RandomFireSpawn[rndfire][3][0], RandomFireSpawn[rndfire][3][1], RandomFireSpawn[rndfire][3][2]);
}
if(GetPlayerSkin(playerid) == 276 || 274 || 275 || 275 || 277 ||278 || 279)
{
SendClientMessage(playerid,0xff000000," Dispatch: A Fire Has Been Located. Please Respond."
SendClientMessage(playerid,0xff000000," Dispatch: The Location Has Been Marked On Your GPS."
}
return 1;
}