• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help It works, and then screws up
#11
(10-06-2011, 21:13)Nukem Wrote: EDIT: look @ bottom of post

(10-06-2011, 21:01)Justin Wrote: ...

How about the gametypes then? gametypes are also in sv_maprotation.

Well, that code wasn't intended for that but I would just use @iAegle 's code then.

i'm bored so I coded this though (no idea what-so-ever if it works)
Code:
//gametype tdm map mp_cosmodrome map mp_nuked

strings = StrTok(GetDvar("sv_maprotation"), "gametype " + GetDvar("g_gametype"));

for(a = 0; a < strings.size; a++)
    new_mapstring += strings[a];
    
// map mp_cosmodrome map mp_nuked

maps = StrTok(new_mapstring, " map ");

//not sure if the space before the first 'map' (" map") is counted in the array, so I just start with array[1]

for( i = 1; i < maps.size; i++ )
{
//etc...
}

lol you can really just ignore the code now.

The above code that @iAegle posted will probably not work as a string can have "gametype tdm map mp_lol" and it would return true.

if(GetSubStr(maps[i], 0, 3) == "mp_")
//code...

strings = StrTok(GetDvar("sv_maprotation"), "gametype " + GetDvar("g_gametype"));
Here it will fail already.
sv_maprotation "gametype dm map mp_map1 gametype sd map mp_map2"
What if different gametype in sv_maprotation then g_gametype? xD
  Reply
#12
(10-06-2011, 21:13)Nukem Wrote: EDIT: look @ bottom of post

(10-06-2011, 21:01)Justin Wrote: ...

How about the gametypes then? gametypes are also in sv_maprotation.

Well, that code wasn't intended for that but I would just use @iAegle 's code then.

i'm bored so I coded this though (no idea what-so-ever if it works)
Code:
//gametype tdm map mp_cosmodrome map mp_nuked

strings = StrTok(GetDvar("sv_maprotation"), "gametype " + GetDvar("g_gametype"));

for(a = 0; a < strings.size; a++)
    new_mapstring += strings[a];
    
// map mp_cosmodrome map mp_nuked

maps = StrTok(new_mapstring, " map ");

//not sure if the space before the first 'map' (" map") is counted in the array, so I just start with array[1]

for( i = 1; i < maps.size; i++ )
{
//etc...
}

lol you can really just ignore the code now.

The above code that @iAegle posted will probably not work as a string can have "gametype tdm map mp_lol" and it would return true.

if(GetSubStr(maps[i], 0, 3) == "mp_")
//code...

C++ equivalent:
Code:
_strnicmp(string1, string2, max_index)
{
return(GetSubStr(string1, 0, max_index) == string2);
}

If you use strTok " " it won't matter because it will be split up into alot of strings ... which you could then check 1 by 1 or something
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

  Reply
#13
One question, why go to this extent just for map voting? Can't you just use a global variable instead of setting clientDvars?
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
  Reply
#14
Probably because he want's to use those clientdvars inside .menu.
  Reply
#15
(10-07-2011, 08:37)Justin Wrote: Probably because he want's to use those clientdvars inside .menu.

This, maps can be enabled and disabled so I need to set the dvars for every player and since I cannot use that much makeDvarServerInfo .. things I need to do it like this
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SecondaryWeaponAkimbo works but cant fire JoSchaap 12 7,381 07-06-2012, 16:59
Last Post: [Z00MBY] Alex
  How ItsMods works for me Arteq 15 7,155 05-29-2012, 07:52
Last Post: JariZ
  First the timer works, now it doesnt show up !? Xzite 2 1,898 03-17-2012, 00:28
Last Post: Xzite
  Code works, but after a while it doesnt !? Xzite 3 2,868 03-16-2012, 14:29
Last Post: Xzite
  Mod Menu for BO that works on ranked ModLover1 4 1,960 01-28-2012, 12:20
Last Post: d0h!
  Fixed! With English language it works! Elite_Nudel 10 6,293 12-19-2011, 06:46
Last Post: Elite_Nudel
  [Tutorial] Custom ranks in MW2 (Works on Steam and aIW) Nekochan 4 2,490 07-29-2011, 11:08
Last Post: d0h!
  [Tutorial] Color Name... It works... dropi 6 3,671 11-30-2010, 16:02
Last Post: Julio

Forum Jump:


Users browsing this thread: 1 Guest(s)