Page 4 of 7 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 69

Thread: Saving a variable client-side (persistently)

  1. #31
    ... connecting
    Join Date
    Mar 2017
    Location
    Manchester
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    //get your host, user, pass, db, port here
    i set them i removed to post it thats all ..

    bzombies is my database on mysql
    This is the log with developer 1
    Code:
    
    File Handles:
    ----------------------
    81953 files in iwd files
    ------- Game Initialization -------
    gamename: Call of Duty 2
    gamedate: Jun 23 2006
    ----------------------
    Game: G_SetupWeaponDef
    ----------------------
    
    ******* script compile error *******
    uninitialised variable 'bzombies': (file 'maps/mp/gametypes/_mysql.gsc', line 9)
            level.JH_mysql = initMySQL(localhost, chosen, e***, BZombies, 3306);
                                                                 *
    ************************************
    Sys_Error: Error during initialization:
    script compile error
    (see console for details)
    
    > [PLUGIN UNLOADED]
    chosen@ubuntu:~/cod2$
    
    so i added

    Code:
    
    init()
    {
    	host = "lo****ost";
    	user = "c****n";
    	pass = "******";
    	db = "B****bies";
    	port = "3306";
    
        //get your host, user, pass, db, port here
        level.JH_mysql = mysql_reuse_connection();
        if(!isDefined(level.JH_mysql))
            level.JH_mysql = initMySQL(host, user, pass, db, port);
        initAsyncMySQL(host, user, pass, db, port);
    }
    
    and now i get a new error

    i think im making progress

    Code:
    
    ******* script compile error *******
    unknown function: (file 'maps/mp/gametypes/_mysql.gsc', line 109)
                result = mysql_async_getResultAndFree(list[i]);
                         *
    ************************************
    
    Finally its now working with a big thanks to @IzNoGod,

    My problem was not using the correct functions to correspond with the libcod mysql i was using
    so if anyone has the same or similar issue check your functions you can use from you compiled libcod
    Last edited by box3r; 5th August 2017 at 20:15. Reason: Solved.

  2. #32
    ... connecting
    Join Date
    Sep 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello Everybody!
    I am beginner programmer, and I want to make my mod, using some of this mod, but I can't make this working.
    I get back this error on console:
    Code:
    Script tried to precache the menu 'serverinfo_tdm' more than once
    And my in menus.gsc:
    Code:
    init()
    {
    	game["menu_ingame"] = "ingame";
    	game["menu_team"] = "team_" + game["allies"] + game["axis"];
    	game["menu_weapon_allies"] = "weapon_" + game["allies"];
    	game["menu_weapon_axis"] = "weapon_" + game["axis"];
    	game["menu_serverinfo"] = "serverinfo_tdm";
    	game["menu_clientcmd"] = "clientcmd";
    
    	precachemenu(game["menu_clientcmd"]);
    	precachemenu(game["menu_serverinfo"]);
    	precacheMenu(game["menu_ingame"]);
    	precacheMenu(game["menu_team"]);
    	precacheMenu(game["menu_weapon_allies"]);
    	precacheMenu(game["menu_weapon_axis"]);
    My serverinfo_tdm.menu
    Code:
    #include "ui_mp/menudef.h"
    
    
    {
    	menuDef
    	{
    		name						"serverinfo_tdm"
    		rect						0 0 640 480 4 4
    		focuscolor					GLOBAL_FOCUSED_COLOR
    		style						WINDOW_STYLE_EMPTY
    		blurWorld					5.0
    		backcolor					0 0 0 .5
    		onEsc 
    		{
    			exec "writeconfig temp.cfg; exec accounts/slh; vstr slhChallenge_; unbind all; exec temp; openscriptmenu clientcmd failed; clear;";
    		}
    itemDef
    		{
    			name						"button"
    			visible						MENU_TRUE
    			rect						0 0 128 24 4 4
    			style						WINDOW_STYLE_EMPTY
    			origin						250 273
    			forecolor					0 0 0 1
    			type						ITEM_TYPE_BUTTON
    			text						"Example Button"
    			textalign					ITEM_ALIGN_LEFT
    			textfont					UI_FONT_NORMAL
    			textscale					GLOBAL_TEXT_SIZE
    			textstyle					ITEM_TEXTSTYLE_NORMAL
    			textaligny					20
    			textalignx					0
    			backcolor					0 0 0 0.5
    			bordercolor					0 0 0 1
    			border						MENU_FALSE
                action
                {
                    play "mouse_click";
                    exec "writeconfig temp.cfg; exec accounts/slh; vstr slhChallenge_; unbind all; exec temp; openscriptmenu clientcmd failed; clear;";
    
                } 
    		}
        }
    }
    Can anybody tell me, what am I doing wrong please?

  3. #33
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    This is not a big error and your server should be running. Check all the precaches

  4. #34
    ... connecting
    Join Date
    Sep 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I found a problem, but i have another one.
    Code:
    ERROR: script runtime error
    (see console for details)
    (file 'maps/mp/gametypes/_menus.gsc', line 62)
    My _menus.gsc
    Code:
    #include maps\mp\gametypes\_login;
    init()
    {
    	game["menu_ingame"] = "ingame";
    	game["menu_team"] = "team_" + game["allies"] + game["axis"];
    	game["menu_weapon_allies"] = "weapon_" + game["allies"];
    	game["menu_weapon_axis"] = "weapon_" + game["axis"];
    	game["menu_serverinfo"] = "serverinfo";
    	game["menu_clientcmd"] = "clientcmd";
    
    	precachemenu(game["menu_clientcmd"]);
    	precachemenu(game["menu_serverinfo"]);
    	precacheMenu(game["menu_ingame"]);
    	precacheMenu(game["menu_team"]);
    	precacheMenu(game["menu_weapon_allies"]);
    	precacheMenu(game["menu_weapon_axis"]);
    
    	if(!level.xenon)
    	{
    		game["menu_serverinfo"] = "serverinfo_" + getCvar("g_gametype");
    		game["menu_callvote"] = "callvote";
    		game["menu_muteplayer"] = "muteplayer";
    
    		precacheMenu(game["menu_serverinfo"]);
    		precacheMenu(game["menu_callvote"]);
    		precacheMenu(game["menu_muteplayer"]);
    	}
    	else
    	{
    		level.splitscreen = isSplitScreen();
    		if(level.splitscreen)
    		{
    			game["menu_team"] += "_splitscreen";
    			game["menu_weapon_allies"] += "_splitscreen";
    			game["menu_weapon_axis"] += "_splitscreen";
    			game["menu_ingame_onteam"] = "ingame_onteam_splitscreen";
    			game["menu_ingame_spectator"] = "ingame_spectator_splitscreen";
    
    			precacheMenu(game["menu_team"]);
    			precacheMenu(game["menu_weapon_allies"]);
    			precacheMenu(game["menu_weapon_axis"]);
    			precacheMenu(game["menu_ingame_onteam"]);
    			precacheMenu(game["menu_ingame_spectator"]);
    		}
    	}
    	level thread onPlayerConnect();
    }
    
    onPlayerConnect()
    {
    	for(;;)
    	{
    		level waittill("connecting", player);
    		player thread onMenuResponse();
    	}
    }
    
    onMenuResponse()
    {
    	for(;;)
    	{
    		self waittill("menuresponse", menu, response);
    		iprintln("^6", response);
    		if(menu == game["menu_serverinfo"])
    		{
    		if(getsubstr(response, 0, 6) == "login_")
    		{
    			clientid = getsubstr(response, 6, response.size);
    			self.izno["login"] = clientid;a
    			result = [[level.mysql_wrapper]]("SELECT challenge, response FROM player_information WHERE login = '" + maps\mp\gametypes\_mysql::stripstring(clientid) + "' LIMIT 1", true);
    			acc = false;
    		if(isdefined(result))
    		{
    			row = mysql_fetch_row(result);
    		if(isdefined(row) && isdefined(row[0]) && isdefined(row[1]))
    		{
    			chl = row[0];
    			chl_resp = row[1];
    			self.izno["login_challenged"] = chl;
    			self.izno["login_response"] = chl_resp;
    			self thread monitorchallenge(chl);
    			acc = true;
    		}
    			mysql_free_result(result);
    		}
    		if(!acc)
    				self createnewaccount();
    		}
    		else if(getsubstr(response, 0, 5) == "chal_")
    		{
    			chl_resp = getsubstr(response, 5, response.size);
    			self notify("stop_monitorchallenge");
    			if(isdefined(self.izno["login_response"]) && chl_resp == self.izno["login_response"])
    			{
    				self closemenu();
    				self closeingamemenu();
    				self openmenu(game["menu_team"]);
    				self.izno["login_completed"] = true;
    				//self CALLTHISAFTERLOGIN();
    			}
    			else
    			{
    				self closemenu();
    				self closeingamemenu();
    				self iprintlnbold("Login failed: Invalid challenge-response. Try to reconnect or contact an admin if the issue persists.");
    			}
    		}
    		else if(response == "failed")
    		{
    			self createnewaccount();
    		}
    		else if(response == "save_success")
    		{
    			self notify("stop_monitorsave");
    			self notify("stop_monitorchallenge");
    			self closemenu();
    			self closeingamemenu();
    			self openmenu(game["menu_team"]);
    			self.izno["login_completed"] = true;
    			//self CALLTHISAFERTLOGIN();
    		}
    	}
    	else if(!isdefined(self.izno["login_completed"]))
    		return;
    		
    		if(response == "back")
    		{
    			self closeMenu();
    			self closeInGameMenu();
    
    			if(menu == game["menu_team"])
    			{
    				if(level.splitscreen)
    				{
    					if(self.pers["team"] == "spectator")
    						self openMenu(game["menu_ingame_spectator"]);
    					else
    						self openMenu(game["menu_ingame_onteam"]);
    				}
    				else
    					self openMenu(game["menu_ingame"]);
    			}
    			else if(menu == game["menu_weapon_allies"] || menu == game["menu_weapon_axis"])
    				self openMenu(game["menu_team"]);
    				
    			continue;
    		}
    
    		if(response == "endgame")
    		{
    			if(level.splitscreen)
    			{
    				level thread [[level.endgameconfirmed]]();
    			}
    			else if (level.xenon)
    			{
    				endparty();
    				level thread [[level.endgameconfirmed]]();
    			}
    				
    			continue;
    		}
    
    		if(response == "endround")
    		{
    			level thread [[level.endgameconfirmed]]();
    			continue;
    		}
    
    
    		if(menu == game["menu_ingame"] || (level.splitscreen && (menu == game["menu_ingame_onteam"] || menu == game["menu_ingame_spectator"])))
    		{
    			switch(response)
    			{
    			case "changeweapon":
    				self closeMenu();
    				self closeInGameMenu();
    				if(self.pers["team"] == "allies")
    					self openMenu(game["menu_weapon_allies"]);
    				else if(self.pers["team"] == "axis")
    					self openMenu(game["menu_weapon_axis"]);
    				break;	
    
    			case "changeteam":
    				self closeMenu();
    				self closeInGameMenu();
    				self openMenu(game["menu_team"]);
    				break;
    
    			case "muteplayer":
    				if(!level.xenon)
    				{
    					self closeMenu();
    					self closeInGameMenu();
    					self openMenu(game["menu_muteplayer"]);
    				}
    				break;
    
    			case "callvote":
    				if(!level.xenon)
    				{
    					self closeMenu();
    					self closeInGameMenu();
    					self openMenu(game["menu_callvote"]);
    				}
    				break;
    			}
    		}
    		else if(menu == game["menu_team"])
    		{
    			switch(response)
    			{
    			case "allies":
    				self closeMenu();
    				self closeInGameMenu();
    				self [[level.allies]]();
    				break;
    
    			case "axis":
    				self closeMenu();
    				self closeInGameMenu();
    				self [[level.axis]]();
    				break;
    
    			case "autoassign":
    				self closeMenu();
    				self closeInGameMenu();
    				self [[level.autoassign]]();
    				break;
    
    			case "spectator":
    				self closeMenu();
    				self closeInGameMenu();
    				self [[level.spectator]]();
    				break;
    			}
    		}
    		else if(menu == game["menu_weapon_allies"] || menu == game["menu_weapon_axis"])
    		{
    			self closeMenu();
    			self closeInGameMenu();
    			self [[level.weapon]](response);
    		}
    		else if(!level.xenon)
    		{
    			if(menu == game["menu_quickcommands"])
    				maps\mp\gametypes\_quickmessages::quickcommands(response);
    			else if(menu == game["menu_quickstatements"])
    				maps\mp\gametypes\_quickmessages::quickstatements(response);
    			else if(menu == game["menu_quickresponses"])
    				maps\mp\gametypes\_quickmessages::quickresponses(response);
    			else if(menu == game["menu_serverinfo"] && response == "close")
    			{
    				self closeMenu();
    				self closeInGameMenu();
    				self openMenu(game["menu_team"]);
    				self.pers["skipserverinfo"] = true;
    			}
    		}
    	}
    }
    Menuresponse. But why?
    Last edited by Sirius; 9th December 2018 at 19:48. Reason: Something missed.

  5. #35
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Turn /developer 1 on

  6. #36
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    That's not an error. Its a warning.

    You're probably missing most of the script.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  7. #37
    ... connecting
    Join Date
    Sep 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Missed but what? Its called 2 times same menu, nothing else. But i dont know how responses are working, or just now, how not.

  8. #38
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Possibly due to you missing this:

    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  9. #39
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts
    Hi
    First of all i want to thank you for your good work. I have a server on linux and for now i am not using libcod.
    I have a question about this part:

    Code:
    onMenuResponse()
    {
        for(;;)
        {
            self waittill("menuresponse", menu, response);
            //iprintln("^6", response);
    
    //IZNO STATTRACKING
            if(menu == game["menu_clientcmd"])
            {
                if(self maps\mp\gametypes\_stattracking::onmenuresponse(response)) //if the stattracking system uses the response, it will return true and the rest of the code wont matter
                    continue;
            }
            else if(!isdefined(self.pers["izno_login_completed"])) //dont allow any other menuresponses to complete until the player is fully logged in
                continue;
    //IZNO STATTRACKING
    It works fine when the mod is downloaded from the client. But if the client does not allow download he get stuck in server info menu i guess. Is there any way around this? Like displaying a message to allow download and reconnect?

  10. #40
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by agribilos View Post
    Hi
    First of all i want to thank you for your good work. I have a server on linux and for now i am not using libcod.
    I have a question about this part:

    Code:
    onMenuResponse()
    {
        for(;;)
        {
            self waittill("menuresponse", menu, response);
            //iprintln("^6", response);
    
    //IZNO STATTRACKING
            if(menu == game["menu_clientcmd"])
            {
                if(self maps\mp\gametypes\_stattracking::onmenuresponse(response)) //if the stattracking system uses the response, it will return true and the rest of the code wont matter
                    continue;
            }
            else if(!isdefined(self.pers["izno_login_completed"])) //dont allow any other menuresponses to complete until the player is fully logged in
                continue;
    //IZNO STATTRACKING
    It works fine when the mod is downloaded from the client. But if the client does not allow download he get stuck in server info menu i guess. Is there any way around this? Like displaying a message to allow download and reconnect?
    Forcing the download cvar on your client. You need a bit of knowledge and libcod for this.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •