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

Need help, how to count kills, save them? (pointmod)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 03-21-2012 , 17:16   Need help, how to count kills, save them? (pointmod)
Reply With Quote #1

Hello guys, im trying to make a own pointmod on Counter strike 1.6.
But i dont know how to make a function that counts the kills u have like /rank system
and saves it can anyone help me?
Bilal Pro is offline
Old 03-22-2012, 16:16
Bilal Pro
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 03-22-2012 , 16:24   Re: Need help, how to count kills, save them? (pointmod)
Reply With Quote #2

There are many tutorials in the Code Snippets/Tutorials section. Search for something called nVault, typically what you would use to save information like that.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-22-2012 , 16:39   Re: Need help, how to count kills, save them? (pointmod)
Reply With Quote #3

Don't bump until 2 weeks have passed since last post.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 03-22-2012 , 16:45   Re: Need help, how to count kills, save them? (pointmod)
Reply With Quote #4

Quote:
Originally Posted by Exolent[jNr] View Post
Don't bump until 2 weeks have passed since last post.
Sorry exolent, i really cant wait that long for things i really need

and GXLZPGX, thanks i will try to make my own pointmod <3
Bilal Pro is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 03-22-2012 , 17:44   Re: Need help, how to count kills, save them? (pointmod)
Reply With Quote #5

Here is an example how you can save player points. Sorry for my english, but I think you can understand.

With this code you can save player points for the current map, if there is a mapchange or client disconnect the points are reseted. If you want to store them (database or server) you could use mysql or nvault, but it's a bit more complex and harder.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

//global variables where to save player points
new player_point[33]

//macro for item cost
#define GREN_COST 10

public plugin_init(){
    
register_plugin("""""")
    
    
//command to check or buy items
    
register_clcmd("say /mypoints""mypoints")
    
register_clcmd("say /gimmegrenade""grenade")
}

//this func prints the player points
public mypoints(id){
    
client_print(idprint_chat"You have %d points"player_point[id])
}

//this func give player a grenade if he have enought point
public grenade(id){
    
    
//if ppl doesen't have the required point
    
if(player_point[id] < GREN_COST)
        
client_print(idprint_chat"You don't have any points. Required: %d"GREN_COST)
    else{
        
//gives he a grenade and draw money
        
give_item(id"weapon_hegrenade")
        
player_point[id] -= GREN_COST
    
}
    
    return 
PLUGIN_HANDLED
}

public 
client_putinserver(id){
    
//statement to reset user points if he joins the server
    
player_point[id] = 0
}

public 
client_disconnect(id){
    
//reset player points if he leaves the server
    
player_point[id] = 0
}

// called when player die
public client_death(killervictimweaponhitzoneTK){
    
//if there is a suicide, or no killer
    
if(killer == victim)
        
//player loses 1 point
        
player_point[victim] -= 1
    
else{
        
//killer grants 1 point
        
player_point[killer] += 1
        
        
//victim loses 1 point
        
player_point[victim] -= 1
    
}
    
    
//you can give extra points if he makes kill with different weapons like:
    
switch(weapon)
    {
        case 
CSW_KNIFE:
        {
            
player_point[killer] += 2
        
}
        
        case 
CSW_DEAGLE:
        {
            
player_point[killer] += 3
        
}
        
        case 
CSW_HEGRENADE:
        {
            
player_point[killer] += 4
        
}
    }
    
    return 
PLUGIN_CONTINUE

I hope I didn't made a mistake in my code.
killergirl is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-22-2012 , 17:53   Re: Need help, how to count kills, save them? (pointmod)
Reply With Quote #6

Quote:
Originally Posted by Bilal Pro View Post
Sorry exolent, i really cant wait that long for things i really need
Doesn't matter. You will have to follow the rules or else your topics will be locked/trashed.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 03-22-2012 , 18:11   Re: Need help, how to count kills, save them? (pointmod)
Reply With Quote #7

Quote:
Originally Posted by Exolent[jNr] View Post
Doesn't matter. You will have to follow the rules or else your topics will be locked/trashed.
Im sorry again killergirl, thanks for this example i really appericiate it
Bilal Pro is offline
BeeFighter
Member
Join Date: Feb 2012
Old 03-22-2012 , 18:26   Re: Need help, how to count kills, save them? (pointmod)
Reply With Quote #8

http://forums.alliedmods.net/showthread.php?t=66497

Heres a full tutorial.
__________________
www.Gstar-Gaming.net

Servers:
Jailbreak
HidenSeek
Knife
Deathrun
Public

Join us now: www.gstar-gaming.net
BeeFighter is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 03-23-2012 , 02:51   Re: Need help, how to count kills, save them? (pointmod)
Reply With Quote #9

thanks
Bilal Pro 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 16:52.


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