SA-MP Forums Archive
Stock New map - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Stock New map (/showthread.php?tid=590735)



Stock New map - sanamalik400 - 03.10.2015

hello samp,,,
anyone can help me for fixing this,,
i have 10 maps for my gm,,when i start my server,,they work.good,,
but after 10 maps when server again load map 1.. and map.1 time complete.,,server not loading other maps,,server loading map 1 again and again,,and my gm crash..
PHP код:
stock LoadNewMap()
{
    new 
file[64];
    
mapid %= MAX_MAP_FILES;
    
format(filesizeof(file), "/Maps/%d.ini"mapid);
    if(!
fexist(file)) return printf("[NOTICE] File Bugged.");
    
LastMapStarted mapid;
    
mapid++;
    return 
mapid-1;

sorry for my bad english.,,i.hope u understand


Re: Stock New map - sanamalik400 - 03.10.2015

no good scripter online


Re: Stock New map - [ABK]Antonio - 03.10.2015

Quote:
Originally Posted by sanamalik400
Посмотреть сообщение
hello samp,,,
anyone can help me for fixing this,,
i have 10 maps for my gm,,when i start my server,,they work.good,,
but after 10 maps when server again load map 1.. and map.1 time complete.,,server not loading other maps,,server loading map 1 again and again,,and my gm crash..
PHP код:
stock LoadNewMap()
{
    new 
file[64];
    
mapid %= MAX_MAP_FILES;
    
format(filesizeof(file), "/Maps/%d.ini"mapid);
    if(!
fexist(file)) return printf("[NOTICE] File Bugged.");
    
LastMapStarted mapid;
    
mapid++;
    return 
mapid-1;

sorry for my bad english.,,i.hope u understand
Код:
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;
}



Re: Stock New map - sanamalik400 - 03.10.2015

not working,,many compile errors


Re: Stock New map - sanamalik400 - 03.10.2015

another friend plz


Re: Stock New map - [ABK]Antonio - 03.10.2015

Quote:
Originally Posted by sanamalik400
Посмотреть сообщение
not working,,many compile errors
Did you even compile it? Did the code you put even compile to start with? I just tested it my self and it compiled perfectly. It's on your end.


pawn Код:
main()
{  
    LoadNewMap();
}

#define MAX_MAP_FILES (5)
new mapid,
    LastMapStarted;

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;
}
Compiled 100% fine.


Re: Stock New map - sanamalik400 - 03.10.2015

Quote:

main()
{
LoadNewMap();
}

#define MAX_MAP_FILES (10)
new mapid,
new LastMapStarted = -1;

stock LoadNewMap()
{
new file[64];
LastMapStarted = mapid;
mapid = mapid==MAX_MAP_FILES(10) mapid+1); ////this line

format(file, sizeof(file), "/Maps/%d.ini", mapid);
if(!fexist(file)) return printf("[NOTICE] File Bugged.");
return mapid;
}

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 : error 001: expected token: ";", but found ":"
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 : fatal error 107: too many error messages on one line


Re: Stock New map - sanamalik400 - 03.10.2015

Quote:

stock LoadNewMap()
{
new file[64];
LastMapStarted = mapid;
mapid = mapid==MAX_MAP_FILES(10),(mapid+1); ///problem in this line

format(file, sizeof(file), "/Maps/%d.ini", mapid);
if(!fexist(file)) return printf("[NOTICE] File Bugged.");
return mapid;
}

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


Re: Stock New map - [ABK]Antonio - 03.10.2015

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



Re: Stock New map - AbyssMorgan - 04.10.2015

Код:
stock LoadNewMap(){
	new file[64];
	for(new mapid = 0; mapid < MAX_MAP_FILES; mapid++){
		format(file,sizeof(file),"/Maps/%d.ini",mapid);
		if(fexist(file)){
			//more charging options
		}
	}
}