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

rank kills only


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 01-19-2020 , 11:03   rank kills only
Reply With Quote #1

hello, i'd need a plugin that ranks player only by kills + points!
so, let me explain, when you kill a ct or t, you get random points, like from 1 to 10, and also the kill goes to your rank, so by /rank you'd get something like Points: xxx Killed T: xxx, Killed CT: xxx
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-19-2020 , 12:55   Re: rank kills only
Reply With Quote #2

I'm currently coding it as i write this reply. Might still take a while since i'm having some trouble with nVault. I'll keep you up to date.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 01-19-2020 , 15:25   Re: rank kills only
Reply With Quote #3

also i'd like to use those points in other plugins, if you can make a native or something i'd be glad!
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 01-20-2020 , 06:06   Re: rank kills only
Reply With Quote #4

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc> 
#include <cstrike>
#include <nvault>
#include <hamsandwich> 

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "raizo"


new his_points_te[33], his_points_ct[33]

new VaultPoints

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
	
    RegisterHam(Ham_Killed, "player", "PlayerKilledPoints", 1)
    
    VaultPoints = nvault_open ("rank_data")
    
    register_clcmd( "say /points","show_points" );
}

public plugin_natives()
{
    register_library("his_points")
    register_native("set_user_points_te","_set_user_points_te")
    register_native("set_user_points_ct","_set_user_points_ct")
}


public set_user_points_te(id, points) 
{
	his_points_te[id] = points;
}

public set_user_points_ct(id, points) 
{
	his_points_ct[id] = points;
}

public show_points(id)
{
    client_print_color(id,"!gYour points TERO %d || Your points CT %d",his_points_te[id],his_points_ct[id]) 
}

public PlayerKilledPoints(Victim, Killer) 
{
    if (Victim == Killer || !is_user_alive(Killer))
        return
	
    if(cs_get_user_team(Killer) == CS_TEAM_T)
    {	
        his_points_te[Killer] += random_num(1,10)
    }
    else if(cs_get_user_team(Killer) == CS_TEAM_CT)
    {
    	his_points_ct[Killer] += random_num(1,10)
    }
}


public client_putinserver(id)
{
    LoadData(id)
}

public client_disconnect(id)
{
    SaveData(id)
}

public plugin_end() nvault_close(VaultPoints)


public LoadData(playerid) 
{ 
    new vaultkey [ 64 ],vaultdata [ 256 ];
	
    format(vaultkey, 63,"%s-Mod", GetName(playerid))
    format(vaultdata, 255,"%i#%i#", his_points_te[playerid],his_points_ct[playerid])
    nvault_get(VaultPoints, vaultkey, vaultdata, 255);
    replace_all(vaultdata, 255, "#", " ");
	
    new playerpoints_te[50],playerpoints_ct[50];
	
    parse(vaultdata, playerpoints_te, 49, playerpoints_ct, 49);  

    his_points_te[playerid] = str_to_num(playerpoints_te); 
    his_points_ct[playerid] = str_to_num(playerpoints_ct); 
}


public SaveData(playerid) 
{ 
    new vaultkey[64], vaultdata[256]
	
    format(vaultkey, 63,"%s-Mod", GetName(playerid))
    format(vaultdata, 255,"%i#%i#", his_points_te[playerid],his_points_ct[playerid]) 
    nvault_set(VaultPoints, vaultkey, vaultdata)
} 
 
stock GetName(playerid) 
{
    new name[32]
    get_user_name(playerid, name, 31)

    return name
}

stock client_print_color(const id, const input[], any:...)  
{  
	new count = 1, players[32];  
	static msg[191];  
	vformat(msg, 190, input, 3);
	replace_all(msg, 190, "!g", "^x04"); // Green Color  
	replace_all(msg, 190, "!y", "^x01"); // Default Color  
	replace_all(msg, 190, "!t", "^x03"); // Team Color  
	if (id) players[0] = id; else get_players(players, count, "ch");  
         {  
	    for (new i = 0; i < count; i++)  
	    {  
		if (is_user_connected(players[i]))  
		{  
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);  
			write_byte(players[i]);  
			write_string(msg);  
			message_end();  
			
		}  
	    }  
         }  
}

Last edited by raizo11; 01-20-2020 at 06:07.
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-20-2020 , 07:17   Re: rank kills only
Reply With Quote #5

My version of the code, without natives though. I have an extra variable storing all points together and counting ur ts and ct kills like you asked.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <nvault>

#define PLUGIN "Points&Kills"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

new iTsKilled[33];
new 
iCtKilled[33];
new 
iPoints[33];

new 
szVaultName;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /rank""ShowStats");
    
    
register_event("DeathMsg""eDeath""a");
    
    
szVaultName nvault_open("PointsAndKills");
    
    if(
szVaultName == INVALID_HANDLE)
    {
        
set_fail_state("Error opening nVault");
    }
}

public 
plugin_end()
{
    
nvault_close(szVaultName);
}

public 
client_disconnect(id)
{
    new 
szAuth[35], szTemp[60]; 
    
get_user_authid(idszAuthcharsmax(szAuth));
    
    
formatex(szTempcharsmax(szTemp), "%i %i %i"iPoints[id], iTsKilled[id], iCtKilled[id]);
    
    
nvault_set(szVaultNameszAuthszTemp);
}

public 
client_authorized(id)
{
    new 
szAuth[64], szTemp[20], szTsKills[5], szCtKills[5], szPoints[10];
    
get_user_authid(idszAuthcharsmax(szAuth));
    
    
nvault_get(szVaultNameszAuthszTempcharsmax(szTemp));
    
    
parse(szTempszPointscharsmax(szPoints), szTsKillscharsmax(szTsKills), szCtKillscharsmax(szCtKills));
    
    
iPoints[id] = str_to_num(szPoints);
    
iTsKilled[id] = str_to_num(szTsKills);
    
iCtKilled[id] = str_to_num(szCtKills);
}  

public 
ShowStats(id)
{
    
client_print(idprint_chat"Points: %i | Killed T: %i | Killed CT: %i"iPoints[id], iTsKilled[id], iCtKilled[id]);
}

public 
eDeath()
{
    new 
iAttacker read_data(1);
    new 
iVictim read_data(2);
    
    if(
iAttacker != && iAttacker != iVictim && get_user_team(iAttacker) != get_user_team(iVictim))
    {
        if(
get_user_team(iVictim) == 1)
        {
            
iTsKilled[iAttacker]++;
        }
        
        else if(
get_user_team(iVictim) == 2)
        {
            
iCtKilled[iAttacker]++;
        }
        
        new 
szName[33]; get_user_name(iVictimszNamecharsmax(szName));
        new 
iRandomPoints random_num(,10);
        
        
iPoints[iAttacker] += iRandomPoints;
        
client_print(iAttackerprint_chat"[RANK] You get %i points for killing %s. Total points: %i"iRandomPointsszNameiPoints[iAttacker])
    }

I would recomend using my version untill raizo11 publishes a better one or untill i do. Naatives don't work this way and therefore can't be used
__________________

Last edited by Napoleon_be; 01-20-2020 at 07:44.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-20-2020 , 12:05   Re: rank kills only
Reply With Quote #6

@raizo you messed up with native positions there..also if you go with ID it should be with style 1..i tryed to fix his natives + added to get points, probably author will need it among adding points to players

Code:
#include <amxmodx>
#include <amxmisc> 
#include <cstrike>
#include <nvault>
#include <hamsandwich> 

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "raizo"


new his_points_te[33], his_points_ct[33]

new VaultPoints

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
	
    RegisterHam(Ham_Killed, "player", "PlayerKilledPoints", 1)
    
    VaultPoints = nvault_open ("rank_data")
    
    register_clcmd( "say /points","show_points" );
}

public plugin_natives()
{
    register_library("his_points")
    register_native("set_user_points_te","_set_user_points_te", 1)
    register_native("set_user_points_ct","_set_user_points_ct", 1 )

    register_native("get_user_points_te","_get_user_points_te", 1 )
    register_native("get_user_points_ct","_get_user_points_ct", 1 )
}


public _set_user_points_te(id, points) 
{
	his_points_te[id] = points;
}

public _set_user_points_ct(id, points) 
{
	his_points_ct[id] = points;
}
public _get_user_points_te( id ) 
{
	return his_points_te[ id ]
}
public _get_user_points_ct( id ) 
{
	return his_points_c[t id ]
}

public show_points(id)
{
    client_print_color(id,"!gYour points TERO %d || Your points CT %d",his_points_te[id],his_points_ct[id]) 
}

public PlayerKilledPoints(Victim, Killer) 
{
    if (Victim == Killer || !is_user_alive(Killer))
        return
	
    if(cs_get_user_team(Killer) == CS_TEAM_T)
    {	
        his_points_te[Killer] += random_num(1,10)
    }
    else if(cs_get_user_team(Killer) == CS_TEAM_CT)
    {
    	his_points_ct[Killer] += random_num(1,10)
    }
}


public client_putinserver(id)
{
    LoadData(id)
}

public client_disconnect(id)
{
    SaveData(id)
}

public plugin_end() nvault_close(VaultPoints)


public LoadData(playerid) 
{ 
    new vaultkey [ 64 ],vaultdata [ 256 ];
	
    format(vaultkey, 63,"%s-Mod", GetName(playerid))
    format(vaultdata, 255,"%i#%i#", his_points_te[playerid],his_points_ct[playerid])
    nvault_get(VaultPoints, vaultkey, vaultdata, 255);
    replace_all(vaultdata, 255, "#", " ");
	
    new playerpoints_te[50],playerpoints_ct[50];
	
    parse(vaultdata, playerpoints_te, 49, playerpoints_ct, 49);  

    his_points_te[playerid] = str_to_num(playerpoints_te); 
    his_points_ct[playerid] = str_to_num(playerpoints_ct); 
}


public SaveData(playerid) 
{ 
    new vaultkey[64], vaultdata[256]
	
    format(vaultkey, 63,"%s-Mod", GetName(playerid))
    format(vaultdata, 255,"%i#%i#", his_points_te[playerid],his_points_ct[playerid]) 
    nvault_set(VaultPoints, vaultkey, vaultdata)
} 
 
stock GetName(playerid) 
{
    new name[32]
    get_user_name(playerid, name, 31)

    return name
}

stock client_print_color(const id, const input[], any:...)  
{  
	new count = 1, players[32];  
	static msg[191];  
	vformat(msg, 190, input, 3);
	replace_all(msg, 190, "!g", "^x04"); // Green Color  
	replace_all(msg, 190, "!y", "^x01"); // Default Color  
	replace_all(msg, 190, "!t", "^x03"); // Team Color  
	if (id) players[0] = id; else get_players(players, count, "ch");  
         {  
	    for (new i = 0; i < count; i++)  
	    {  
		if (is_user_connected(players[i]))  
		{  
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);  
			write_byte(players[i]);  
			write_string(msg);  
			message_end();  
			
		}  
	    }  
         }  
}
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-20-2020 , 12:46   Re: rank kills only
Reply With Quote #7

I'm not certain if that's what he asked for. Think he wants a plugin that adds random points to a points array, and keep track of how many t's and ct's he killed. Author should give his feedback
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 01-20-2020 , 12:56   Re: rank kills only
Reply With Quote #8

Napoleon is right! I didn't asked for a ct/t points, i wanted points separated and kills separated! seems like Napoleon's code is what exactly i want, from the first view, i will test it and come with a feedback again!
and thanks all!
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Old 01-20-2020, 14:31
Nutu_
This message has been deleted by Nutu_.
Old 01-20-2020, 14:43
Nutu_
This message has been deleted by Nutu_.
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 01-20-2020 , 15:34   Re: rank kills only
Reply With Quote #9

okay, seems like I messed up with my explanation. the plugin works fine but seems to give points and kills randomly, not all the time! could it be fixed?
and also this should be like this..
Your rank is %s (the rank O.o) with points: xxx, ct kills: xx t kills: x
(i was writing in a hurry and just now i've seen what i wrote! could you do it for me please?)

ps: this is for deathrun mode, and i use the entity kill (https://forums.alliedmods.net/showthread.php?t=266396) which seems to work without problems with the plugin you made Napoleon but it is not giving all the time!
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-21-2020 , 07:11   Re: rank kills only
Reply With Quote #10

Only points are given randomly, kills are added 1 by 1 each time.

About the rank thingy, i'll see what i can do when i get home from work.

Also, what is it exactly that doesn't "give" all the time?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 22:16.


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