Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Killstreak On/Off codehelp
#1
Hello,
what is the problem with this?
(already tried without for (; ;) tag )
Code:
init()
    {
    level thread onPlayerConnect();
    }

onPlayerConnect()
    {
        level waittill( "connected", player );

        for( ; ; )
        {
        
            if ( getDvar("mapname") == "mp_rust" )
            {
                self setDvar( "scr_game_hardpoints", 0)
            }

            else
            {
                self setDvar( "scr_game_hardpoints", 1)
            }
        }
    }
Reply

#2
Code:
init()
    {
    level thread onPlayerConnect();
    }

onPlayerConnect()
    {
        level waittill( "connected", player );

        for( ; ; )
        {
        
            if ( getDvar("mapname") == "mp_rust" )
            {
                setDvar( "scr_game_hardpoints", 0)
            }

            else
            {
                setDvar( "scr_game_hardpoints", 1)
            }
        }
    }

self setdvar doesnt work Big Grin
Reply

#3
Code:
if ( getDvar("mapname") == "mp_rust" )
            {
                self setDvar( "scr_game_hardpoints", 0)
            }
.
HERE IS THE ERROR , IF YOU PUT BRACKETS ITS BECAUSE YOU WILL USE MORE THAN 1 FUNCT , HERE YOU ARE USING JUST ONE SO YOU WILL HAVE TO REMOVE THE BRACKETS
Reply

#4
(06-19-2012, 17:26)Yamato Wrote:
Code:
init()
    {
    level thread onPlayerConnect();
    }

onPlayerConnect()
    {
        level waittill( "connected", player );

        for( ; ; )
        {
        
            if ( getDvar("mapname") == "mp_rust" )
            {
                setDvar( "scr_game_hardpoints", 0)
            }

            else
            {
                setDvar( "scr_game_hardpoints", 1)
            }
        }
    }

self setdvar doesnt work Big Grin

Tried now without "self", cod still say compile error.

(06-19-2012, 17:35)Bloodfocus Wrote:
Code:
if ( getDvar("mapname") == "mp_rust" )
            {
                self setDvar( "scr_game_hardpoints", 0)
            }
.
HERE IS THE ERROR , IF YOU PUT BRACKETS ITS BECAUSE YOU WILL USE MORE THAN 1 FUNCT , HERE YOU ARE USING JUST ONE SO YOU WILL HAVE TO REMOVE THE BRACKETS

It isn't depending on the brackets here.
Reply

#5
Missing ';' after SetDvar.

Anyway that code doesn't really make sense. Firstly @Yamato is right, you don't call setDvar on an entity. Also this dvar is a server-side dvar so why are you using it in OnPlayerConnect?
[Image: azuw.jpg]
Reply

#6
(06-19-2012, 17:35)Bloodfocus Wrote:
Code:
if ( getDvar("mapname") == "mp_rust" )
            {
                self setDvar( "scr_game_hardpoints", 0)
            }
.
HERE IS THE ERROR , IF YOU PUT BRACKETS ITS BECAUSE YOU WILL USE MORE THAN 1 FUNCT , HERE YOU ARE USING JUST ONE SO YOU WILL HAVE TO REMOVE THE BRACKETS

Hopefully Troll ing

You are completely wrong about this.


edit: Didn't see @"TheRaZ"'s post, oh well...
Reply

#7
Thanks for helps, corrected ";" to setDvar, and modified the onPlayerConnect to onStart (also removed waittill) :
This is all in a new gsc named _zKSkapcsolo.gsc
and it is starting from _load.gsc: "thread maps\mp\_zKSkapcsolo::init();"
Code:
init()
    {
        level thread onStart();
    }

onStart()
    {
        for( ; ; )
        {
        
            if ( getDvar("mapname") == "mp_rust" )
            {
                setDvar( "scr_game_hardpoints", 0);
            }
            
            else
            {
                setDvar( "scr_game_hardpoints", 1);
            }
        }
    }

Now the game say: ERROR Flags are "256" Can not set "scr_game_hardpoints ... blabla
Reply

#8
Lol, why do you put it into a for loop? That will not work. Just do it without the loop and maybe add a small wait at the start of OnStart.
[Image: azuw.jpg]
Reply

#9
(06-19-2012, 19:18)zxz0O0 Wrote: Lol, why do you put it into a for loop? That will not work. Just do it without the loop and maybe add a small wait at the start of OnStart.

Right, now loop removed, but I still have a problem now.
It is working, but not on the actual map, so when Rust map is the next, the game is loading it noramlly, and killstreaks are on, the script only disabling the killstreaks if I restart rust, if I not restart it, an going to the nexp map for ex. Favela, the killstreaks are still off on Favela, and they are only on again on a third map, for ex. Karachi.

I can't explain it easier :/
But I try:

If map is Rust 1. -> Killstreaks ON
if the next map is Rust again 2. -> Killstreaks OFF
but I don't have 2 rust in maprotation, so after Rust 1. on Favela Killstreak are OFF,
after Favela on Karachi the killstreak are ON again.

So it is working on only the "all second map".



Code:
init()
    {
        level thread onStart();
    }

onStart()
    {
        wait 0.8;
              
            if ( getDvar("mapname") == "mp_rust" )
            {
                setDvar( "scr_game_hardpoints", 0);
            }
            
            else
            {
                setDvar( "scr_game_hardpoints", 1);
            }
    }
Reply

#10
I understand. Try without the wait (or wait 0.05) and if it doesn't work you need to use another method. The scenario you described happens when the game checks the dvar before you change it (game checks it at map start).
[Image: azuw.jpg]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Duration killstreak The Tronuo 2 2,786 07-12-2013, 18:33
Last Post: The Tronuo
  Preview Tank Killstreak Yamato 16 10,511 05-27-2013, 14:47
Last Post: Yamato
  [GSC] All Weapon/Camo/Perk/Killstreak Names DEREKTROTTER 33 25,943 01-30-2013, 15:26
Last Post: 99IRock
  [Request] Give KillStreak yuri8597 1 2,464 10-29-2012, 01:31
Last Post: DidUknowiPwn
  [Request] weapon/killstreak giver jari333 2 2,696 10-17-2012, 18:56
Last Post: OzonE
  [Tutorial] Killstreak list Yamato 0 2,557 06-08-2012, 12:25
Last Post: Yamato
  Anti Killstreak Editing AboAlwe 5 4,224 04-28-2012, 11:00
Last Post: schoerg
  [Request] Killstreak delay time Dumas 2 2,713 04-18-2012, 23:18
Last Post: Dumas
  [Release] install now ItsModLoader - mw3 Killstreak - Classes - Leveling - MOD hussi 3 3,319 04-03-2012, 01:58
Last Post: AZUMIKKEL
Wink [Release] Tank Killstreak Yamato 12 12,415 02-27-2012, 14:37
Last Post: Yamato

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.