Answered ZM Decrease Player Score

BunkerBaerIGER

Veteran
Messages
10
Reaction score
4
Points
783
Hey i need some help with my zm GSC menu. I want to decrease the player score but if i try
"self thread zm_score:: minus_to_player_score( points )" nothing happens...

Would be nice if someone help me :smile:

Discord: BunkerBaerIGER#4859
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
Code:
self maps/mp/zombies/_zm_score::minus_to_player_score( < value >, 1 );
 

BunkerBaerIGER

Veteran
Messages
10
Reaction score
4
Points
783
function func_give_perk(gperk, price) { self maps/mp/zombies/_zm_score::minus_to_player_score( price, 1 ); self thread zm_perks::give_perk(gperk, true); self thread func_menuexit(); }

the code works i got the perk but i want to reduce the player score


Linking "zm_mod" (mods\zm_weapon_shop stable 2951413 v593):

processing...



********************************************************************************

UNRECOVERABLE ERROR:

^1SCRIPT ERROR: No generated data for 'scripts/zm/gametypes/_clientids.gsc'

ERR(0) scripts/zm/gametypes/_clientids.gsc (124,11) in "func_give_perk()" : syntax error, unexpected TOKEN_DIVIDE, expecting TOKEN_LEFT_PAREN : self maps/





Linker will now terminate.

********************************************************************************



==================================================

Linker summary:



There were no errors or warnings.



==================================================

^1 self maps/

^1----------^

^1ERR(0) scripts/zm/gametypes/_clientids.gsc (124,11) in "func_give_perk()" : syntax error, unexpected TOKEN_DIVIDE, expecting TOKEN_LEFT_PAREN : self maps/
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,322
Reaction score
752
Points
973
function func_give_perk(gperk, price) { self maps/mp/zombies/_zm_score::minus_to_player_score( price, 1 ); self thread zm_perks::give_perk(gperk, true); self thread func_menuexit(); }

the code works i got the perk but i want to reduce the player score


Linking "zm_mod" (mods\zm_weapon_shop stable 2951413 v593):

processing...



********************************************************************************

UNRECOVERABLE ERROR:

^1SCRIPT ERROR: No generated data for 'scripts/zm/gametypes/_clientids.gsc'

ERR(0) scripts/zm/gametypes/_clientids.gsc (124,11) in "func_give_perk()" : syntax error, unexpected TOKEN_DIVIDE, expecting TOKEN_LEFT_PAREN : self maps/





Linker will now terminate.

********************************************************************************



==================================================

Linker summary:



There were no errors or warnings.



==================================================

^1 self maps/

^1----------^

^1ERR(0) scripts/zm/gametypes/_clientids.gsc (124,11) in "func_give_perk()" : syntax error, unexpected TOKEN_DIVIDE, expecting TOKEN_LEFT_PAREN : self maps/
Just noticed this was for BO3, you said BO2 in the chatbox.
So therefore I don't know, tho the error message doesn't say its the score code, its the 'self maps/'
 

vampytwist

"Don't you trust me?"
Messages
644
Reaction score
620
Points
758
Code:
maps/mp/zombies/

Is what's causing the error

Code:
zm_score::minus_to_player_score(price);
should work, how are you calling the function "func_give_perk"?
 

BunkerBaerIGER

Veteran
Messages
10
Reaction score
4
Points
783
I'm using this :

call it just like:
self addOpt("perks_menu", "Quick Revive [^12500^7]", &func_give_perk, "specialty_quickrevive" , 2500);

and modify the menu base:
function addOpt(menu, opt, func, inp, inp2)//<--- { m = self.menuAction[menu].opt.size; self.menuAction[menu].opt[m] = opt; self.menuAction[menu].func[m] = func; self.menuAction[menu].inp[m] = inp; self.menuAction[menu].inp2[m] = inp2; //And add this line for my second variable ? idk }

Ingame i got the perk and all is working but the player should lost 2500 score :smile:
 

BunkerBaerIGER

Veteran
Messages
10
Reaction score
4
Points
783
i think i need to add anything with inp2 at this line ?
if(self useButtonPressed()) { self thread [[self.menuAction[self.currentMenu].func[self.menuCurs]]](self.menuAction[self.currentMenu].inp[self.menuCurs]); wait .2; }
 

vampytwist

"Don't you trust me?"
Messages
644
Reaction score
620
Points
758
i think i need to add anything with inp2 at this line ?
if(self useButtonPressed()) { self thread [[self.menuAction[self.currentMenu].func[self.menuCurs]]](self.menuAction[self.currentMenu].inp[self.menuCurs]); wait .2; }

Yeah, you need to make it check if input 2 is defined then if it is you need it to run both the inputs then else if not just run the 1st
 

vampytwist

"Don't you trust me?"
Messages
644
Reaction score
620
Points
758
So overall this will/should fix your issue

Code:
#using scripts\zm\_zm_score;
#using scripts\zm\_zm_perks;

in Function initmenu(), replace if use buttonpressed with

Code:
            if(self useButtonPressed())
            {
               if(isDefined(self.menuaction[self.currentMenu].inp1[self.menuCurs]))
               {
                   self thread [[self.menuAction[self.currentMenu].func[self.menuCurs]]](self.menuAction[self.currentMenu].inp[self.menuCurs], self.menuAction[self.currentMenu].inp1[self.menuCurs]);
                   wait .2;
                } else
                   self thread [[self.menuAction[self.currentMenu].func[self.menuCurs]]](self.menuAction[self.currentMenu].inp[self.menuCurs]);
                   wait .2;
            }

and replace addopt function with
Code:
function addOpt(menu, opt, func, inp, inp1)
{
    m = self.menuAction[menu].opt.size;
    self.menuAction[menu].opt[m] = opt;
    self.menuAction[menu].func[m] = func;
    self.menuAction[menu].inp[m] = inp;
    self.menuAction[menu].inp1[m] = inp1;
}

Code:
function func_give_perk(gperk, price)
{
self thread zm_score::minus_to_player_score( price );
self thread zm_perks::give_perk(gperk, true);
self thread func_menuexit();
}
 
Top