[Error in NXPClientcore.uc (170): 'control': Bad command or expression

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

[Error in NXPClientcore.uc (170): 'control': Bad command or expression

Post by Letylove49 » Sun Sep 18, 2022 9:53 pm

Code: Select all

Compiling NXPClientcore
Error in NXPClientcore.uc (170): 'control': Bad command or expression
Failed due to errors.  
i don't see what is bad here :


if (timeInterval >= 1)
control.sConf.advertTimeInterval = timeInterval;

Code: Select all

  class NXPClientCore extends NXPConfig;

/***************************************************************************************************
 *
 *  $DESCRIPTION  Replication block.
 *
 **************************************************************************************************/
replication {
reliable if (role == ROLE_SimulatedProxy) // Replicate to server...
addServerAdvert, updateServerAdvert, deleteServerAdvert, updateServerAdvertSettings;
}

/***************************************************************************************************
 *
 *  $DESCRIPTION  Modifies the setup of the Nexgen remote control panel.
 *  $OVERRIDE
 *
 **************************************************************************************************/
simulated function setupControlPanel() {

// Load localization support.
lng = spawn(class'NXPLang', self);

// Client

	client.mainWindow.mainPanel.addPanel(client.lng.chatLogTabTxt, class'NXPRCPChatLog', , "client");

// Server.

if (client.hasRight(client.R_ServerAdmin)) {
client.mainWindow.mainPanel.addPanel(client.lng.saTitleTxt, class'NXPServerAddsRCP', , "server,serversettings");
}

}
/***************************************************************************************************
 *
 *  $DESCRIPTION  Adds an advert to the server adverts list
 *  $PARAM        theAdvert     String containing the advert to add
 *
 **************************************************************************************************/
function addServerAdvert (string theAdvert) {
	local byte entryNum;
	local bool bFound;

	// Preliminary checks.
	if (!client.hasRight(client.R_ServerAdmin))
		return;

	// Find a free slot.
	while (!bFound && entryNum < arrayCount(control.sConf.serverAdverts)) {
		if (control.sConf.serverAdverts[entryNum] == "") {
			bFound = true;
		} else {
			entryNum++;
		}
	}

	// Cancel on error.
	if (!bFound) {
	    client.showMsg(control.lng.saNoRoomMsg);
		return;
	}

	// Store advert.
	control.sConf.serverAdverts[entryNum] = theAdvert;
    control.sConf.numAdverts++;

	// Save changes.
	control.sConf.saveConfig();

    // Signal update.
   	control.signalConfigUpdate(control.sConf.CT_AdvertSettings);

	client.showMsg(control.lng.settingsSavedMsg);

}

/***************************************************************************************************
 *
 *  $DESCRIPTION  Updates an advert in the server adverts list
 *  $PARAM        entryNum      Index of the advert to update
 *  $PARAM        theAdvert     String containing the advert to update
 *
 **************************************************************************************************/
function updateServerAdvert (byte entryNum, string theAdvert) {

	// Preliminary checks.
	if (!client.hasRight(client.R_ServerAdmin) ||
        entryNum >= arrayCount(control.sConf.serverAdverts) ||
	    control.sConf.serverAdverts[entryNum] == "")
		return;

	// Update ban.
	control.sConf.serverAdverts[entryNum] = theAdvert;

	// Save changes.
	control.sConf.saveConfig();

	// Notify clients.
	control.signalConfigUpdate(control.sConf.AdvertSettings);
	client.showMsg(control.lng.settingsSavedMsg));
	
	// Log action.
	logAdminAction(control.lng.lng.adminAddAdvertMsg);



}

/***************************************************************************************************
 *
 *  $DESCRIPTION  Deletes an advert in the server adverts list
 *  $PARAM        entryNum      Index of the advert to delete
 *
 **************************************************************************************************/
function deleteServerAdvert (byte entryNum) {
	local bool bFound;
	local int index;

	// Preliminary checks.
	if (!client.hasRight(client.R_ServerAdmin) ||
        entryNum >= arrayCount(control.sConf.serverAdverts) ||
	    control.sConf.serverAdverts[entryNum] == "")
		return;

	for (index = entryNum; index < arrayCount(control.sConf.serverAdverts); index++) {
		// Last entry?
		if (index + 1 == arrayCount(control.sConf.serverAdverts)) // Yes, clear fields.
			control.sConf.serverAdverts[index] = "";
		else // No, copy fields from next entry.
			control.sConf.serverAdverts[index] = control.sConf.serverAdverts[index + 1];
	}

	// Save changes.
	control.sConf.saveConfig();
    control.sConf.numAdverts--;

	

	// Notify clients.
	control.signalConfigUpdate(control.sConf.AdvertSettings);
	client.showMsg(control.lng.settingsSavedMsg));
	
	// Log action.
	logAdminAction(control.lng.lng.adminRemoveAdvertMsg);

}

/***************************************************************************************************
 *
 *  $DESCRIPTION  Updates the server advert settings
 *  $PARAM        timeInterval  Number of seconds between each show of an advert
 *  $PARAM        bRandomOrder  TRUE if adverts should be picked from the list at random
 *
 **************************************************************************************************/
function updateServerAdvertSettings (byte timeInterval, bool bRandomOrder) {
local NexgenClient client;
local NXPConfig sConf;

  spawn (class'NXPConfig', self);





	if (!client.hasRight(client.R_ServerAdmin))  
	   return;

    if (timeInterval >= 1)
  [b]      control.sConf.advertTimeInterval = timeInterval;[/b]
    else
   	    client.showMsg(control.lng.saInvTimeMsg);

    control.sConf.bRandomAdvertOrder = bRandomOrder;

	// Save changes.
	control.sConf.saveConfig();

	
   	// Notify clients.
	control.signalConfigUpdate(control.sConf.AdvertSettings);
	client.showMsg(control.lng.settingsSavedMsg));
	
	// Log action.
	logAdminAction(control.lng.lng.adminUpdateAdvertiseSettingsMsg);

}
<[MHA]>Letylove49 aka Shado170