[Solved]NexgenABMSDL ( Private Release) : Call to 'reducePlayerScore': Bad ';' or missing ')'

Discussions about Coding and Scripting
Letylove49
Skilled
Posts: 174
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: <[MHA]> /UK Admin
Location: suisse

[Solved]NexgenABMSDL ( Private Release) : Call to 'reducePlayerScore': Bad ';' or missing ')'

Post by Letylove49 » Thu Oct 20, 2022 2:39 pm

hi
i'm tring to add the functions Reduceplayerscore and Zerofrag on NexgenABM for not lost it on moderate pannel when i use this plugin.

But i got this error : Error: C:\UT coding\UnrealTournament\NexgenABM201SDL\Classes\NexgenABMModeratePanel.uc(215) : Error, Call to 'reducePlayerScore': Bad ';' or missing ')'






Code: Select all

 /***************************************************************************************************
 *
 *  $DESCRIPTION  Notifies the dialog of an event (caused by user interaction with the interface).
 *  $PARAM        control    The control object where the event was triggered.
 *  $PARAM        eventType  Identifier for the type of event that has occurred.
 *  $REQUIRE      control != none
 *  $OVERRIDE
 *
 **************************************************************************************************/
function notify(UWindowDialogControl control, byte eventType) {
  super.notify(control, eventType);
  
  if (control == warnButton && !warnButton.bDisabled && eventType == DE_Click) {
    if(warnInp.getValue() == "") client.showMsg("<C00>You have to enter a reason.");
    else {
      xClient.warnPlayer(NexgenPlayerList(playerList.selectedItem).pNum, class'NexgenUtil'.static.trim(warnInp.getValue()), hideNameInp.bChecked);
    }
  }

    if (control == reduceScoreButton && !reduceScoreButton.bDisabled && eventType == DE_Click) {
    if(BanReasonInp.getValue() == "") client.showMsg("client.lng.needreasonReminderMsg.");
    else {		
	xClient.reducePlayerScore(NexgenPlayerList(playerList.selectedItem).pNum, client.sConf.reduceScorePenaltyAmount, class'NexgenUtil'.static.trim(banReasonInp.getValue());

  }
}
  
    if (control == zeroFragButton && !zeroFragButton.bDisabled && eventType == DE_Click) {
    if(BanReasonInp.getValue() == "") client.showMsg("client.lng.needreasonReminderMsg.");
    else {
	xClient.(NexgenPlayerList(playerList.selectedItem).pNum, client.sConf.zerofragPenaltyAmount, class'NexgenUtil'.static.trim(banReasonInp.getValue());
  }
    
}


  if (control == myKickButton && !myKickButton.bDisabled && eventType == DE_Click) {
			xClient.kickPlayer(NexgenPlayerList(playerList.selectedItem).pNum, class'NexgenUtil'.static.trim(banReasonInp.getValue()), hideNameInp.bChecked);
  }
}

the fonction reducePlayerScore :

Code: Select all

 /***************************************************************************************************
 *
 *  $DESCRIPTION  Reduces the score of the player by amount set in ini.
 *  $PARAM        playerNum  The player code of the player the player that score is to be reduced.
 *  $PARAM        reason     Description of why the player is having the score reduced.
 *
 **************************************************************************************************/

function reducePlayerScore(int playerNum, float reduceBy, string reason) {
	local NexgenClient target;


	// Preliminary checks.
	if (!client.hasRight(client.R_Moderate)) {
		return;
	}

       // Get target client.
	target = control.getClientByNum(playerNum);
	if (target == none) return;

     	// Check if player can kick/ban players that have an account on the server.
	if (target.bHasAccount && !client.hasRight(client.R_BanAccounts)) {
		client.showMsg(control.lng.noBanAccountRightMsg);
		return;
	}


    

    // reduce the players score.
    target.player.PlayerReplicationInfo.Score -= target.player.PlayerReplicationInfo.Score*reduceBy;

	// Show dialog.
	target.showPopup("NexgenReduceScoreDialog", reason);



     // Announce event.
	logAdminAction(control.lng.adminReducePlayerScoreMsg, target.playerName, reason);
	
}


/***************************************************************************************************
 *
 *  $DESCRIPTION  Reduces the score of the player by amount set in ini.
 *  $PARAM        playerNum  The player code of the player the player that score is to be reduced.
 *  $PARAM        reason     Description of why the player is having the score reduced.
 *
 **************************************************************************************************/

function ZeroFrag(int playerNum, float reduceBy, string reason) {
	local NexgenClient target;

	// Preliminary checks.
	if (!client.hasRight(client.R_Moderate)) {
		return;
	}


       // Get target client.
	target = control.getClientByNum(playerNum);
	if (target == none) return;

       	// Check if player can kick/ban players that have an account on the server.
	if (target.bHasAccount && !client.hasRight(client.R_BanAccounts)) {
		client.showMsg(control.lng.noBanAccountRightMsg);
		return;


    }

    // reduce the players score.
    target.player.PlayerReplicationInfo.Score -= target.player.PlayerReplicationInfo.Score*reduceBy;

	// Show dialog.
	target.showPopup("NexgenZeroFragDialog", reason);


	  // Announce event.
	logAdminAction(control.lng.adminZeroFragMsg, target.playerName,reason);
}

Last edited by Letylove49 on Fri Oct 21, 2022 8:02 pm, edited 1 time in total.
<[MHA]>Letylove49 aka -=]UK[=-Shado

User avatar
Barbie
Godlike
Posts: 2479
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Moderate Pannel (add a function to reduce or remove score of a player

Post by Barbie » Thu Oct 20, 2022 8:44 pm

I often divide complex statement into visual parts. Instead of

Code: Select all

xClient.reducePlayerScore(NexgenPlayerList(playerList.selectedItem).pNum, client.sConf.reduceScorePenaltyAmount, class'NexgenUtil'.static.trim(banReasonInp.getValue()), hideNameInp.bChecked));
I write it as

Code: Select all

xClient.reducePlayerScore
(
	NexgenPlayerList(playerList.selectedItem).pNum, 
	client.sConf.reduceScorePenaltyAmount, 
	class'NexgenUtil'.static.trim(banReasonInp.getValue()), 
	hideNameInp.bChecked)
);
So it can easily be seen that
1) the closing bracket after "bChecked" in line 6 is too much
2) the function "reducePlayerScore" is called with 4 parameters, but the function declaration has only 3 parameters.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett

Letylove49
Skilled
Posts: 174
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: <[MHA]> /UK Admin
Location: suisse

Re: Moderate Pannel (add a function to reduce or remove score of a player

Post by Letylove49 » Thu Oct 20, 2022 9:03 pm

Barbie wrote:
Thu Oct 20, 2022 8:44 pm
I often divide complex statement into visual parts. Instead of

Code: Select all

xClient.reducePlayerScore(NexgenPlayerList(playerList.selectedItem).pNum, client.sConf.reduceScorePenaltyAmount, class'NexgenUtil'.static.trim(banReasonInp.getValue()), hideNameInp.bChecked));
I write it as

Code: Select all

xClient.reducePlayerScore
(
	NexgenPlayerList(playerList.selectedItem).pNum, 
	client.sConf.reduceScorePenaltyAmount, 
	class'NexgenUtil'.static.trim(banReasonInp.getValue()), 
	hideNameInp.bChecked)
);
So it can easily be seen that
1) the closing bracket after "bChecked" in line 6 is too much
2) the function "reducePlayerScore" is called with 4 parameters, but the function declaration has only 3 parameters.
thanks i have removed hideNameInp.bChecked) that i have added by mistake.

but the error stay afer the modification : Call to reducePlayerScore: Bad ; or missing ).

Code: Select all

if (control == reduceScoreButton && !reduceScoreButton.bDisabled && eventType == DE_Click) {
    if(BanReasonInp.getValue() == "") client.showMsg("client.lng.needreasonReminderMsg.");
    else {		
	xClient.reducePlayerScore(NexgenPlayerList(playerList.selectedItem).pNum, client.sConf.reduceScorePenaltyAmount, class'NexgenUtil'.static.trim(banReasonInp.getValue());

  }
}

    if (control == zeroFragButton && !zeroFragButton.bDisabled && eventType == DE_Click) {
    if(BanReasonInp.getValue() == "") client.showMsg("client.lng.needreasonReminderMsg.");
    else {
	xClient.(NexgenPlayerList(playerList.selectedItem).pNum, client.sConf.zerofragPenaltyAmount, class'NexgenUtil'.static.trim(banReasonInp.getValue());

   }
}
<[MHA]>Letylove49 aka -=]UK[=-Shado

User avatar
Barbie
Godlike
Posts: 2479
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Moderate Pannel (add a function to reduce or remove score of a player

Post by Barbie » Thu Oct 20, 2022 10:02 pm

Letylove49 wrote:
Thu Oct 20, 2022 9:03 pm
but the error stay afer the modification : Call to reducePlayerScore: Bad ; or missing ).
Write the line in the way I suggested and you will notice the error.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett

Letylove49
Skilled
Posts: 174
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: <[MHA]> /UK Admin
Location: suisse

Re: NexgenABMSDL ( Private Release) : Call to 'reducePlayerScore': Bad ';' or missing ')'

Post by Letylove49 » Fri Oct 21, 2022 7:51 pm

like this

Code: Select all

xClient.reducePlayerScore
(NexgenPlayerList(playerList.selectedItem).pNum, 
client.sConf.reduceScorePenaltyAmount,
class'NexgenUtil'.static.trim(banReasonInp.getValue())[b])[/b];

yes that work now i have juste forgot to add Zerofrag

Code: Select all

 xClient.[b]Zerofrag[/b](NexgenPlayerList(playerList.selectedItem).pNum, client.sConf.zerofragPenaltyAmount, class'NexgenUtil'.static.trim(banReasonInp.getValue()));
thanks for your sugestion that helped me well.
<[MHA]>Letylove49 aka -=]UK[=-Shado