Raised This Month: $ Target: $400
 0% 

Some nvault problem.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 08-02-2011 , 06:04   Some nvault problem.
Reply With Quote #1

Hello everyone, I got few problems this time.
1. I want to know how can I get the player's current line in the nvault file and print it out with a messages.
[Prefix] You are no. X of total X.
2. How can I get the largest number of coins of the first five ppl and print it out in a MOTD?
3. Please check if any part of my code worng.
Code:
public show_coins(id)
{
	new iUserName[33];
	get_user_name(id, iUserName, 32);
	
	formatex(szKey, 31, "%s-Coins", iUserName);
	formatex(szData, 255, "%i", iUserCoins[id]);
		
	nvault_get(szVault, szKey, szData, 255);
		
	new gUserCoins[32];
		
	parse(szData, gUserCoins, 31)
	
	iUserCoins[id] = str_to_num(gUserCoins);
	
	client_print_color(id, DontChange, "%s You have %i coins.", gPrefix, iUserCoins[id]);
	return PLUGIN_HANDLED;
}

public EventTerrsWin()
{
	new iPlayers[32], iNum;
	get_players(iPlayers, iNum, "ch");

	for(new i = 0; i < iNum; i++)
	{
		if(get_user_team(iPlayers[i]) == 1)
		{
			new iUserName[33];
			get_user_name(iPlayers[i], iUserName, 32);
			
			iUserCoins[iPlayers[i]] += 1;
			
			client_print_color(0, DontChange, "%s %s gains 1 coin.", gPrefix, iUserName);
			
			formatex(szKey, 31, "%s-Coins", iUserName);
			formatex(szData, 255, "%i", iUserCoins[iPlayers[i]]);
	
			nvault_set(szVault, szKey, szData);
			client_print_color(iPlayers[i], DontChange, "%s You have %i coins.", gPrefix, iUserCoins[iPlayers[i]]);
		}
	}
	
	return PLUGIN_CONTINUE;
}



Another question, can you explain the text in red means what?
Code:
public swearcheck(id) 
{
	new szSaid[192]
	read_args(szSaid,191)
	new bool:found = false
	new pos, i = 0
	while ( i < g_swearsNum )
	{
	if ( (pos = containi(szSaid,g_swearsNames[i][1])) != -1 ){ 
		new len = g_swearsNames[i][0] 
		while(len--)
		szSaid[pos++] = '*'
		found = true 
		continue
	}
	++i
	}

	if ( found ){ 
		new cmd[32]
		read_argv(0,cmd,31)          
		engclient_cmd(id,cmd,szSaid)    
	}
	return PLUGIN_CONTINUE 
} 
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others

Last edited by GarbageBox; 08-02-2011 at 06:31.
GarbageBox 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 03:22.


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