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

KeyValues problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hy6
Junior Member
Join Date: Jul 2013
Location: Belarus
Old 01-06-2014 , 04:46   KeyValues problem
Reply With Quote #1

I make point system but have big problem: when i connect to my server and if no players all works correctly but if on server was player i get 0 points. Whats wrong???
Code:
new Handle:WelcomeTimers[MAXPLAYERS+1]
new points[MAXPLAYERS+1];
new Handle:kv;
new String:g_SteamID[MAXPLAYERS+1];

public OnClientPutInServer(client)
{
	WelcomeTimers[client] = CreateTimer(2.0, WelcomePlayer, client);
}

public Action:WelcomePlayer(Handle:timer, any:client)
{
	if (client < 1 || IsFakeClient(client))
	{
		return;
	}
		
		
	GetClientAuthString(client, g_SteamID[client], 30);		
	
		
	KvJumpToKey(kv, g_SteamID[client], true);
		
	points[client] = KvGetNum(kv, "points",200);
	
	KvSetNum(kv, "points", points[client]);

	KvRewind(kv);
	SaveStats();

	CPrintToChatAll("{green}Игрок {olive}%N{green}[{olive}%s{green}] присоединился к игре с {olive}%d {green}поинтами!",client,g_SteamID[client],points[client]);
	//CPrintToChat(client,"{green}Игрок {olive}%N{green}[{olive}%s{green}] присоединился к игре с {olive}%d {green}поинтами!",client,g_SteamID[client],points[client]);
	
}

SaveStats()
{
	KeyValuesToFile(kv, "cfg/stats.txt");
}
points give for kills. I have 4363 points and turn off server. When i turn on server and connect i get message that i have 4363 points. But when i connect to server with 3 players i dont get message and when enter in chat !pointsnumber(this command show number of points) i get message "You have 0 points."

Last edited by Hy6; 01-06-2014 at 04:50.
Hy6 is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 01-06-2014 , 04:49   Re: KeyValues problem
Reply With Quote #2

Do not trash forums with generic questions. Search before asking.
Also this is a pretty good start.
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
xf117
Senior Member
Join Date: Mar 2010
Location: Russia
Old 01-06-2014 , 05:37   Re: KeyValues problem
Reply With Quote #3

Your steamid is just a regular one dimensional array. You probably need something like
PHP Code:
new String:g_SteamID[MAXPLAYERS+1][64]; 
since you want to store steamid per each client.
xf117 is offline
Send a message via ICQ to xf117
Hy6
Junior Member
Join Date: Jul 2013
Location: Belarus
Old 01-06-2014 , 06:02   Re: KeyValues problem
Reply With Quote #4

xf117, thanks but no result. Problem not in it. I think that client not authorised but why? Is OnClientPutInServer mean event when player authrorised and in game? Or need use OnClientAuthorised?OnClientInGame?
Hy6 is offline
Hy6
Junior Member
Join Date: Jul 2013
Location: Belarus
Old 01-06-2014 , 06:11   Re: KeyValues problem
Reply With Quote #5

oh no event clientingame )
Hy6 is offline
Hy6
Junior Member
Join Date: Jul 2013
Location: Belarus
Old 01-06-2014 , 06:16   Re: KeyValues problem
Reply With Quote #6

i change OnClientAuthorised(client,const String:auth[])

dont help

any ideas?

Last edited by Hy6; 01-06-2014 at 08:11.
Hy6 is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 01-06-2014 , 07:09   Re: KeyValues problem
Reply With Quote #7

Dude, come on man..
Edit your last post..
Don't bump..

Have you first read the forum rules? If not please do so.
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 01-06-2014 at 07:10.
GsiX is offline
Hy6
Junior Member
Join Date: Jul 2013
Location: Belarus
Old 01-06-2014 , 07:28   Re: KeyValues problem
Reply With Quote #8

Problem solved: timers. I delete them and all normal now )
Hy6 is offline
wanted2411
Senior Member
Join Date: Jun 2012
Old 01-06-2014 , 09:00   Re: KeyValues problem
Reply With Quote #9

Solved.... OK

Last edited by wanted2411; 01-06-2014 at 09:03.
wanted2411 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 17:22.


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