CabConModding
Facebook
Twitter
youtube
Discord
Contact us
RSS
Menu
CabConModding
Home
New
Top
Premium
Rules
FAQ - Frequently Asked Questions
Games
Fornite
Call of Duty: Black Ops 3
Clash of Clans
Grand Theft Auto 5
Apex Legends
Assassin’s Creed Origins
Forums
Premium
Latest posts
What's new
Latest posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Log in
Register
What's new
Premium
Latest posts
Menu
Log in
Register
Navigation
Install the app
Install
More options
Dark Theme
Contact us
Close Menu
Forums
Gaming
Call of Duty Classics
Call of Duty: Black Ops 3
Increment player's score cost when buying a door/debris
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="BUBBER_" data-source="post: 56300" data-attributes="member: 399920"><p>Hello,</p><p>I got the door count to increment per person when someone opens a door but how would I get the cumulative cost of doors/debris per person opened.</p><p></p><p>UPDATE: I got it to work using array::thread_all, I found this works for all trigger objects with a function handler. Some code was pulled from scripts\zm\_zm_blockers.gsc</p><p></p><p>[CODE=clike]function init(){</p><p> zombie_doors = GetEntArray( "zombie_door", "targetname" );</p><p> if (isdefined(zombie_doors)){</p><p> array::thread_all(zombie_doors,&monitorDoors);</p><p> }</p><p> zombie_debris = GetEntArray( "zombie_debris", "targetname" );</p><p> if (isdefined(zombie_debris)){</p><p> array::thread_all(zombie_debris,&monitorDebris);</p><p> }</p><p>}</p><p></p><p>function monitorDoors(){</p><p> self endon("disconnect");</p><p> self endon("destroyMenu");</p><p> level endon("game_ended");</p><p> self waittill( "trigger", who, force );</p><p> if ( isdefined( level.custom_door_buy_check ) )</p><p> {</p><p> if ( !who [[ level.custom_door_buy_check ]]( self ) )</p><p> {</p><p> return false;</p><p> }</p><p> }</p><p> if(GetDvarInt( "zombie_unlock_all") > 0 || IS_TRUE( force ) )</p><p> {</p><p> return true;</p><p> }</p><p></p><p> if( !who UseButtonPressed() )</p><p> {</p><p> return false;</p><p> }</p><p></p><p> if( who zm_utility::in_revive_trigger() )</p><p> {</p><p> return false;</p><p> }</p><p></p><p> if( IS_DRINKING(who.is_drinking) )</p><p> {</p><p> return false;</p><p> }</p><p> cost = 0;</p><p> upgraded = 0;</p><p> if( zm_utility::is_player_valid( who ) )</p><p> {</p><p> players = GetPlayers();</p><p> cost = self.zombie_cost;</p><p> if (self._door_open == true){</p><p> return false;</p><p> }</p><p> else if (who zm_score::can_player_purchase( cost )){</p><p> who incSpent(cost);</p><p> }</p><p> else{</p><p> return false;</p><p> }</p><p> }</p><p>}</p><p></p><p>function monitorDebris(){</p><p> self endon("disconnect");</p><p> self endon("destroyMenu");</p><p> level endon("game_ended");</p><p> while( 1 ){</p><p> self waittill( "trigger", who, force );</p><p></p><p> if(GetDvarInt( "zombie_unlock_all") > 0 || IS_TRUE( force ) )</p><p> {</p><p> //bypass.</p><p> }</p><p> else</p><p> {</p><p> if( !who UseButtonPressed() )</p><p> {</p><p> continue;</p><p> }</p><p></p><p> if( IS_DRINKING(who.is_drinking) )</p><p> {</p><p> continue;</p><p> }</p><p></p><p> if( who zm_utility::in_revive_trigger() )</p><p> {</p><p> continue;</p><p> }</p><p> }</p><p></p><p> if( zm_utility::is_player_valid( who ) )</p><p> {</p><p> // Can we afford this door?</p><p> players = GetPlayers();</p><p> if(GetDvarInt( "zombie_unlock_all") > 0)</p><p> {</p><p> // bypass charge.</p><p> }</p><p> else if ( /*players.size == 1 &&*/ who zm_score::can_player_purchase( self.zombie_cost ) )</p><p> {</p><p> who incSpent(self.zombie_cost);</p><p> return true;</p><p> }</p><p> else</p><p> {</p><p> continue;</p><p> }</p><p> }</p><p>}</p><p>}</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="BUBBER_, post: 56300, member: 399920"] Hello, I got the door count to increment per person when someone opens a door but how would I get the cumulative cost of doors/debris per person opened. UPDATE: I got it to work using array::thread_all, I found this works for all trigger objects with a function handler. Some code was pulled from scripts\zm\_zm_blockers.gsc [CODE=clike]function init(){ zombie_doors = GetEntArray( "zombie_door", "targetname" ); if (isdefined(zombie_doors)){ array::thread_all(zombie_doors,&monitorDoors); } zombie_debris = GetEntArray( "zombie_debris", "targetname" ); if (isdefined(zombie_debris)){ array::thread_all(zombie_debris,&monitorDebris); } } function monitorDoors(){ self endon("disconnect"); self endon("destroyMenu"); level endon("game_ended"); self waittill( "trigger", who, force ); if ( isdefined( level.custom_door_buy_check ) ) { if ( !who [[ level.custom_door_buy_check ]]( self ) ) { return false; } } if(GetDvarInt( "zombie_unlock_all") > 0 || IS_TRUE( force ) ) { return true; } if( !who UseButtonPressed() ) { return false; } if( who zm_utility::in_revive_trigger() ) { return false; } if( IS_DRINKING(who.is_drinking) ) { return false; } cost = 0; upgraded = 0; if( zm_utility::is_player_valid( who ) ) { players = GetPlayers(); cost = self.zombie_cost; if (self._door_open == true){ return false; } else if (who zm_score::can_player_purchase( cost )){ who incSpent(cost); } else{ return false; } } } function monitorDebris(){ self endon("disconnect"); self endon("destroyMenu"); level endon("game_ended"); while( 1 ){ self waittill( "trigger", who, force ); if(GetDvarInt( "zombie_unlock_all") > 0 || IS_TRUE( force ) ) { //bypass. } else { if( !who UseButtonPressed() ) { continue; } if( IS_DRINKING(who.is_drinking) ) { continue; } if( who zm_utility::in_revive_trigger() ) { continue; } } if( zm_utility::is_player_valid( who ) ) { // Can we afford this door? players = GetPlayers(); if(GetDvarInt( "zombie_unlock_all") > 0) { // bypass charge. } else if ( /*players.size == 1 &&*/ who zm_score::can_player_purchase( self.zombie_cost ) ) { who incSpent(self.zombie_cost); return true; } else { continue; } } } } [/CODE] [/QUOTE]
Verification
Post reply
Forums
Gaming
Call of Duty Classics
Call of Duty: Black Ops 3
Increment player's score cost when buying a door/debris
CabConModding is now on facebook! Check the latest Updates, the Site Status and much more now!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top