03.10.2015, 23:17
Quote:
and when i use like this then 1 error..
C:\Users\muaz baba\Desktop\zGM[Fahad]\gamemodes\zma.pwn(521 : error 029: invalid expression, assumed zero C:\Users\muaz baba\Desktop\zGM[Fahad]\gamemodes\zma.pwn(521 : warning 215: expression has no effect C:\Users\muaz baba\Desktop\zGM[Fahad]\gamemodes\zma.pwn(521 : warning 215: expression has no effect Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase |
This is called a ternary operator.
variable = condition ? (true) : (false)
It's basically an if statement inside of your declaration instead of writing it all the way out.
pawn Код:
stock LoadNewMap()
{
new file[64];
LastMapStarted = mapid;
mapid = mapid == MAX_MAP_FILES ? (1) : (mapid+1);
format(file, sizeof(file), "/Maps/%d.ini", mapid);
if(!fexist(file)) return printf("[NOTICE] File Bugged.");
return mapid;
}
pawn Код:
stock LoadNewMap()
{
new file[64];
LastMapStarted = mapid;
if(mapid == MAX_MAP_FILES) mapid = 1;
else mapid++;
format(file, sizeof(file), "/Maps/%d.ini", mapid);
if(!fexist(file)) return printf("[NOTICE] File Bugged.");
return mapid;
}