Stock New map
#9

Quote:
Originally Posted by sanamalik400
Посмотреть сообщение
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
You aren't doing it correctly.
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;
}
Is equivalent to doing;

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;
}
Reply


Messages In This Thread
Stock New map - by sanamalik400 - 03.10.2015, 13:12
Re: Stock New map - by sanamalik400 - 03.10.2015, 14:58
Re: Stock New map - by [ABK]Antonio - 03.10.2015, 15:10
Re: Stock New map - by sanamalik400 - 03.10.2015, 20:43
Re: Stock New map - by sanamalik400 - 03.10.2015, 20:46
Re: Stock New map - by [ABK]Antonio - 03.10.2015, 22:11
Re: Stock New map - by sanamalik400 - 03.10.2015, 22:40
Re: Stock New map - by sanamalik400 - 03.10.2015, 22:42
Re: Stock New map - by [ABK]Antonio - 03.10.2015, 23:17
Re: Stock New map - by AbyssMorgan - 04.10.2015, 06:50

Forum Jump:


Users browsing this thread: 1 Guest(s)