Stock New map
#1

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
Reply
#2

no good scripter online
Reply
#3

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

not working,,many compile errors
Reply
#5

another friend plz
Reply
#6

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.
Reply
#7

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
Reply
#8

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
Reply
#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
#10

Код:
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
		}
	}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)