Raised This Month: $ Target: $400
 0% 

Save player data to mysql


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
jonatat
Senior Member
Join Date: Dec 2017
Old 05-31-2018 , 02:25   Save player data to mysql
Reply With Quote #1

Hello all. I have simple SQL request from server to save player data into mysql. Like kills, deaths, steam_id and etc. Then player join in the server, made some kills SQL not update existing table row, but creating a new one without steam id, nickname and etc... Whats wrong? My code:

PHP Code:
public SavePlayer(id)
{
if(!
pLoaded[id]) 
return 
PLUGIN_HANDLED;

if(
pPoints[id] < 0)
pPoints[id] = 0;

new 
Name[64], steam[64];
get_user_name(idName63);

get_user_authid(idsteam63);

static 
szQuery[3800];
formatexszQuery3799"REPLACE INTO `users` (`steam_id`, `player_name`, `kills`, `deaths`, `headshots`, `aces`, `m_aces`, `mix_played`, `mix_lost`, `mix_won`, `mix_draw`, `points`, `last_online`) VALUES ('%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', NOW());"steamGetSecureName(Name), pKills[id], pDeaths[id], pHeadshots[id], pAces[id], pMiniAces[id], pMixPlayed[id], pMixLost[id], pMixWon[id], pMixDraw[id], pPoints[id]);
#if AMXX_VERSION_NUM >= 183
SQL_SetCharset(g_hTuple,"utf8");
#endif

SQL_ThreadQuery(g_hTuple"QuerySetData"szQuery);

return 
PLUGIN_CONTINUE;

jonatat is offline
 


Thread Tools
Display Modes

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 04:43.


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