Raised This Month: $51 Target: $400
 12% 

Question about files


Post New Thread Reply   
 
Thread Tools Display Modes
StrikerM
BANNED
Join Date: Nov 2019
Old 11-30-2019 , 07:59   Re: Question about files
Reply With Quote #21

Quote:
Originally Posted by Sanjay Singh View Post
SQL can be accessed by any of your servers so accessing the same table & changing data will also change data in all servers linked with that SQL plugin. @StrikerM
Yes, but i don't know how to make a SQL connection, i searched on the internet and i found only bad tutorials without explicit context.
StrikerM is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 11-30-2019 , 08:08   Re: Question about files
Reply With Quote #22

Quote:
Originally Posted by StrikerM View Post
Yes, but i don't know how to make a SQL connection, i searched on the internet and i found only bad tutorials without explicit context.
What tutorials did you find?
redivcram is offline
StrikerM
BANNED
Join Date: Nov 2019
Old 11-30-2019 , 08:45   Re: Question about files
Reply With Quote #23

Quote:
Originally Posted by redivcram View Post
What tutorials did you find?
I can't give link .. i don't think is allowed, but it was smth like 'enter the game add -mysql -u admin -e' and the db will create...
StrikerM is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-30-2019 , 10:15   Re: Question about files
Reply With Quote #24

1. Use this for AMX-X scripting. You can for the most part copy and paste, then adjust for your plugin : https://forums.alliedmods.net/showthread.php?t=46779
2. I can write your SQL queries when ready
__________________

Last edited by Bugsy; 11-30-2019 at 10:16.
Bugsy is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 11-30-2019 , 10:19   Re: Question about files
Reply With Quote #25

Quote:
Originally Posted by Bugsy View Post
1. Use this for AMX-X scripting. You can for the most part copy and paste, then adjust for your plugin : https://forums.alliedmods.net/showthread.php?t=46779
2. I can write your SQL queries when ready
can you help sql in my thread?
https://forums.alliedmods.net/showthread.php?t=319985
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
StrikerM
BANNED
Join Date: Nov 2019
Old 11-30-2019 , 11:18   Re: Question about files
Reply With Quote #26

Quote:
Originally Posted by Bugsy View Post
1. Use this for AMX-X scripting. You can for the most part copy and paste, then adjust for your plugin : https://forums.alliedmods.net/showthread.php?t=46779
2. I can write your SQL queries when ready
I did it, but i get this errors without reason, no loose indentation.

Code:
// C:\Users\Marian\Desktop\Server cs 1.6\cstrike\addons\amxmodx\scripting\mixmenu.sma(112) : warning 217: loose indentation
// C:\Users\Marian\Desktop\Server cs 1.6\cstrike\addons\amxmodx\scripting\mixmenu.sma(155) : warning 217: loose indentation
// C:\Users\Marian\Desktop\Server cs 1.6\cstrike\addons\amxmodx\scripting\mixmenu.sma(189) : warning 217: loose indentation
Code:
public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_clcmd("say", "Cmd_Say")
	register_clcmd("say", "ComenziChat");
	register_clcmd("say_team", "ComenziChat");
	
	register_clcmd("say /info", "InformatiePuncte");
	
	register_concmd("amx_t", "swap_team", ADMIN_KICK, "<name> - mutare jucator la t");
	register_concmd("amx_ct", "swap_team", ADMIN_KICK, "<name> - mutare jucator la ct");
	register_concmd("amx_spec", "swap_team", ADMIN_KICK, "<name> - mutare jucator la spec");

	register_event("HLTV", "new_round", "a", "1=0", "2=0");
	register_event("SendAudio", "t_win", "a", "2=%!MRAD_terwin");
	register_event("SendAudio", "ct_win", "a", "2=%!MRAD_ctwin");
	register_event("CurWeapon", "RundaLame", "be", "1=1");
	register_event("DeathMsg", "event_DeathMsg", "a");
	
	register_message(get_user_msgid("DeathMsg"), "RespawnIncalzire");
	
	register_logevent("RoundEnd", 2, "1=Round_End");

	register_forward(FM_GetGameDescription, "NumeModJoc");
	
	RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
	register_event("StatusValue", "SeteazaEchipa", "be", "1=1");
	CreazaListaBaniJucatori = CreateHudSyncObj();
	
	server_cmd("mp_flashlight 0");
	
	new DataDir[64];
	get_datadir(DataDir, 63);
	format(File, 127, "%s/SistemPuncte.dat", DataDir);
	
	new Host[64],User[64],Pass[64],Db[64];

	get_cvar_string("amx_sql_host",Host,63);
    get_cvar_string("amx_sql_user",User,63);
    get_cvar_string("amx_sql_pass",Pass,63);
    get_cvar_string("amx_sql_db",Db,63);
	
    g_SqlTuple = SQL_MakeDbTuple(Host,User,Pass,Db);
   
    new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511);
    if(SqlConnection == Empty_Handle)
	{
		set_fail_state(g_Error);
    }  
    new Handle:Queries[3];
    Queries[0] = SQL_PrepareQuery(SqlConnection,"CREATE TABLE IF NOT EXISTS zomg (you INT(11),are INT(11),a INT(11),noob INT(11))");
    Queries[1] = SQL_PrepareQuery(SqlConnection,"INSERT INTO zomg VALUES('1','2','3','4')");
    Queries[2] = SQL_PrepareQuery(SqlConnection,"INSERT INTO zomg VALUES('4','3','2','1')");
   
    for(new Count;Count < 3;Count++)
    {
        if(!SQL_Execute(Queries[Count]))
        {
            SQL_QueryError(Queries[Count],g_Error,511);
            set_fail_state(g_Error);
        }
        SQL_FreeHandle(Queries[Count]);
    }
    SQL_FreeHandle(SqlConnection);
}
112 line
Code:
get_cvar_string("amx_sql_host",Host,63);
155 line
Code:
new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
155 line
Code:
return 0; from
Code:
public client_disconnect(id)
{
	JucatoriMix--;
	DemoActiv[id] = 0;
	remove_task(id);
	SaveUserPoints(id);
	// ok, we're ready to connect
    new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
    if(SqlConnection == Empty_Handle)
        // stop the plugin with an error message
        set_fail_state(g_Error)
   
    // run a random query
    new Handle:Query = SQL_PrepareQuery(SqlConnection,"SELECT * FROM zomg WHERE you='1' OR you='4'")
   
    // run the query
    if(!SQL_Execute(Query))
    {
        // if there were any problems
        SQL_QueryError(Query,g_Error,511)
        set_fail_state(g_Error)
    }
   
    // checks to make sure there's more results
    // notice that it starts at the first row, rather than null
    new Data
    while(SQL_MoreResults(Query))
    {
        // columns start at 0
        Data = SQL_ReadResult(Query,0)
       
        server_print("Found data: %d",Data)

        SQL_NextRow(Query)
    }
   
    // of course, free the handle
    SQL_FreeHandle(Query)
   
    // and of course, free the connection
    SQL_FreeHandle(SqlConnection)
	return 0;
}

Last edited by StrikerM; 11-30-2019 at 11:21.
StrikerM is offline
1TAP GOD
Junior Member
Join Date: Sep 2018
Old 12-03-2019 , 01:48   Re: Question about files
Reply With Quote #27

Do you want a mix plugin with points and sql data saveing ?if you want that send me a pm i will give you that plugin for free you just need to translate the mesages,i see you are romanian

Last edited by 1TAP GOD; 12-03-2019 at 01:48.
1TAP GOD is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 12-03-2019 , 11:09   Re: Question about files
Reply With Quote #28

maybe he has his (two) servers on one VPS, so by that way he is using one file of data for two servers?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode