Raised This Month: $ Target: $400
 0% 

Points errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
krystann
Junior Member
Join Date: Mar 2012
Location: Romania - Cluj
Old 08-30-2012 , 10:06   Points errors
Reply With Quote #1

What is wrong with this plugin?
Receive error child
I want to explain / show what you modified to be child
and
I want to register points Player plugin and a command to display a list.
Code:
#include <amxmodx>
#include <amxmisc>
#include <csx>
#include <nvault>

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"

#pragma semicolon 1

#define MAX_BUFFER_LENGTH       2047

new g_NvID

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_clcmd("say /puncte", "cmdpuncte", 0);
	register_clcmd("say_team /puncte", "cmdpuncte", 0);
	
	g_NvID = nvault_open("playtimevault");
}

public client_disconnect(id)
{
	new szPlayTime[8], szAuthID[35], iPlayTime,ts;
	get_user_name(id, szAuthID, 34);

	if( !nvault_lookup( g_NvID, szAuthID , szPlayTime , 7 , ts ) )
	{
		format(szPlayTime, 7, "%d" , get_user_time(id, 1) );
		nvault_set( g_NvID , szAuthID , szPlayTime);
	}
	else
	{
		iPlayTime = str_to_num(szPlayTime) + get_user_time(id, 1);
		format(szPlayTime, 7, "%d" , iPlayTime );
		nvault_set( g_NvID , szAuthID , szPlayTime);
	}
}

Float:points(izStats[8])
{
	if (!izStats[4])
	{
		return (0.0);
	}

	return (100.0 * float(izStats[5]) / float(izStats[4]));
}

format_points(sBuffer[2048])
{
	new loc1 = get_statsnum();
	new loc2 = get_statsnum();
	new loc3 = get_statsnum();

	new iMax = get_statsnum();
	new izStats[8], izBody[8], t_sName[32], msg[112];
	new iLen = 0;

	if (iMax > 10)
	{
		iMax = 10;
	}

	loc1 = 1;
	loc2 = 2;
	loc3 = 3;
	new szTime[8];
      	new ts;
	
	
	iLen = format(sBuffer, 2047, "<body bgcolor=#000000><font color=#FFB000><pre>");
	iLen += format(sBuffer[iLen], 2047 - iLen, "%2s %-22.22s %6s %6s %4s %6s %4s %4s^n", "#", "Nick", " Puncte", "Victorii", "PlayTime");

	for (new i = 0; i < loc1 && 2047 - iLen > 0; i++)
	{
		get_stats(i, izStats, izBody, t_sName, 31);
	
  	
		replace_all(t_sName, 31, "<", "[");
		replace_all(t_sName, 31, ">", "]");
   	
 
		new iCurTime = get_user_time( i , 1 );
		new iTotalTime = 0;

		if( nvault_lookup(g_NvID, t_sName , szTime, 7, ts) )
		{
          		iTotalTime = str_to_num(szTime);
		}

		iLen += format(sBuffer[iLen], 2047 - iLen, "%2d <font color=#ff0000>%-22.22s</font> %6d %6d %4d %3.0f%% %3.0f%% %4d h <img src=http://nebunie.net/1.png>^n", i + 1, t_sName, izpoints[0], izvicotrii[1], ((iCurTime + iTotalTime) / 3600));
      
	}
	
	
	for (new i = 1; i < loc2 && 2047 - iLen > 0; i++)
	{
		get_stats(i, izStats, izBody, t_sName, 31);
		replace_all(t_sName, 31, "<", "[");
		replace_all(t_sName, 31, ">", "]");

		new iCurTime = get_user_time( i , 1 );
		new iTotalTime = 0;

		if( nvault_lookup(g_NvID, t_sName , szTime, 7, ts) )
		{
          		iTotalTime = str_to_num(szTime);
		}

		iLen += format(sBuffer[iLen], 2047 - iLen, "%2d <font color=#07fcff>%-22.22s</font> %6d %6d %4d %3.0f%% %3.0f%% %4d h <img src=http://nebunie.net/2.png>^n", i + 1, t_sName, izizpoints[0], izvicotrii[[1], accuracy(izStats), ((iCurTime + iTotalTime) / 3600));
	}

	for (new i = 2; i < loc3 && 2047 - iLen > 0; i++)
	{
		get_stats(i, izStats, izBody, t_sName, 31);
		replace_all(t_sName, 31, "<", "[");
		replace_all(t_sName, 31, ">", "]");
  
		new iCurTime = get_user_time( i , 1 );
		new iTotalTime = 0;

		if( nvault_lookup(g_NvID, t_sName , szTime, 7, ts) )
		{
          		iTotalTime = str_to_num(szTime);
		}

		iLen += format(sBuffer[iLen], 2047 - iLen, "%2d <font color=#fff007>%-22.22s</font> %6d %6d %4d %3.0f%% %3.0f%% %4d h <img src=http://nebunie.net/3.png>^n", i + 1, t_sName, izizpoints[0], izvicotrii[[1], accuracy(izStats), ((iCurTime + iTotalTime) / 3600));
	}


	for (new i = 3; i < iMax && 2047 - iLen > 0; i++)
	{
		get_stats(i, izStats, izBody, t_sName, 31);
		replace_all(t_sName, 31, "<", "[");
		replace_all(t_sName, 31, ">", "]");

		new iCurTime = get_user_time( i , 1 );
		new iTotalTime = 0;

		if( nvault_lookup(g_NvID, t_sName , szTime, 7, ts) )
		{
          		iTotalTime = str_to_num(szTime);
		}

		iLen += format(sBuffer[iLen], 2047 - iLen, "%2d %-22.22s %6d %6d %4d %3.0f%% %3.0f%% %4d h^n", i + 1, t_sName, izStats[0], izStats[1], izStats[2], effec(izStats), accuracy(izStats), ((iCurTime + iTotalTime) / 3600));
	}

	iLen += format(sBuffer[iLen], 2047 - iLen, "^n%s", msg);
//	iLen += format(sBuffer[iLen], 2047 - iLen, "^nHighGunGame Powered by krystann!");

}

public cmdpuncte(id)
{
	format_points(g_sBuffer);
	show_motd(id, g_sBuffer, "Top Puncte");

	}

	return PLUGIN_CONTINUE;
}

public plugin_end()
{
    nvault_close(g_NvID);
}

Last edited by krystann; 08-30-2012 at 10:07.
krystann is offline
Torge
Veteran Member
Join Date: Oct 2011
Old 08-30-2012 , 10:19   Re: Points errors
Reply With Quote #2

Quote:
I want to register points Player plugin and a command to display a list.
First, you need to create a variable:

PHP Code:
new g_iPlayerPoints[33]; 
This is for adding points:

PHP Code:
g_iPlayerPoints[id] += 1
Torge is offline
krystann
Junior Member
Join Date: Mar 2012
Location: Romania - Cluj
Old 08-30-2012 , 10:55   Re: Points errors
Reply With Quote #3

Thanks for the reply, but still can not understand child?
krystann is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-30-2012 , 11:44   Re: Points errors
Reply With Quote #4

Quote:
Originally Posted by krystann View Post
Thanks for the reply, but still can not understand child?
Only a mother can understand its child....
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
krystann
Junior Member
Join Date: Mar 2012
Location: Romania - Cluj
Old 08-30-2012 , 13:30   Re: Points errors
Reply With Quote #5

Quote:
Originally Posted by Liverwiz View Post
Only a mother can understand its child....
Im sorry for the speak english but i translate to google translate and child = copile
krystann 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 21:07.


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