Raised This Month: $ Target: $400
 0% 

Required_kills_for_next_level


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 06-08-2010 , 14:05   Required_kills_for_next_level
Reply With Quote #1

Hi,
I am trying to get Required kills for next level :

PHP Code:
new PlayerXP[33]
new 
PlayerLevel[33]
new 
RequiredKills[id]

new const 
LEVELS[3] = 
{
    
1
    
2
    
4
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("Required""Required""a")
}

public 
Required(id)
 {
    
RequiredKills PlayerXP -= PlayerLevel += 1

Can some one help me =.= , i have the idea of how to do it , but i cant use it by scripting.
Requiredkills = Player Xp - next Player level.
__________________
  • Project : Level Plugin
o [||||||||||] - 100%
  • Project : OnePieceMod
o [||||||||||] - 20%

Last edited by SaM.ThE.MaN; 06-08-2010 at 14:09.
SaM.ThE.MaN is offline
Owner123
Member
Join Date: Jun 2010
Old 06-08-2010 , 14:10   Re: Required_kills_for_next_level
Reply With Quote #2

PHP Code:
RequiredKills[attacker] = LEVELS[PlayerLevel[attacker]] - PlayerXP[attacker
BTW. Change
PHP Code:
new RequiredKills[id
to
PHP Code:
new RequiredKills[33
And what is that event "Required" ? 0o

Last edited by Owner123; 06-08-2010 at 14:13.
Owner123 is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 06-08-2010 , 14:11   Re: Required_kills_for_next_level
Reply With Quote #3

Hook death event, then just add xp to killer, and check PlayerXP[id] if it's more than 2 then PlayerLevel++;
reinert is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 06-08-2010 , 14:39   Re: Required_kills_for_next_level
Reply With Quote #4

Code:
new const g_iRequiredKillsPerLevel[ ] = {     16,     32,     64,     128,     256 }; new g_iLevel[ 33 ], g_iKills[ 33 ], g_iRequiredKills[ 33 ]; g_iKills[ id ] = 37; while( g_iKills[ id ] >= g_iRequiredKillsPerLevel[ g_iLevel[ id ] ] ) {     g_iLevel[ id ]++; } g_iRequiredKills[ id ] = g_iRequiredKillsPerLevel[ g_iLevel[ id ] + 1 ] - g_iKills[ id ]; // this would make the level increase, as 37 is higher than the first two values in the global variable g_iRequiredKillsPerLevel, and therefore making g_iLevel variable increase in the while() loop // g_iRequiredKills holds the value that needs to be exceeded to gain another level
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 06-09-2010 , 07:36   Re: Required_kills_for_next_level
Reply With Quote #5

PHP Code:
new PlayerXP[33]
new 
PlayerLevel[33]
new 
RequiredKills[id]

new const 
LEVELS[3] = 
{
    
1
    
2
    
4
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("Required""Required""a")
}
/*
public Required(id)
 {
    RequiredKills = PlayerXP -= PlayerLevel += 1

*/ 
What the **** is this?!

PHP Code:
register_event("Required""Required""a"
There is no such thing as a "required" event.You may read all the events HERE

also,
PHP Code:
new const LEVELS[3] = 
{
    
1
    
2
    
4//no comma for this one!

and
PHP Code:
new RequiredKills[id
Unless you #define id 33, this would not work
__________________
There are 10 kinds of people.Those who understand binary, and those who don't.
Also, for those who understand binary, there is a donation tab too!
No steam || PM support!
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 06-09-2010 , 09:35   Re: Required_kills_for_next_level
Reply With Quote #6

dude i just ripped the levels of my code and 4got to remove the , from the code.

It doesnt matter what i use, even if i do this
public Required(id)
{
(bla bla , my script is still gonna work)
}

new RequiredKills[33] , I made it id by mistake so stop eating my brains for that mistake lol
__________________
  • Project : Level Plugin
o [||||||||||] - 100%
  • Project : OnePieceMod
o [||||||||||] - 20%
SaM.ThE.MaN is offline
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 06-12-2010 , 04:13   Re: Required_kills_for_next_level
Reply With Quote #7

Xella ,
can you explain it to me 1 by 1 what each of the following lines in the script does , i dont wanna be spoon fed i wanna LEARN!!!
__________________
  • Project : Level Plugin
o [||||||||||] - 100%
  • Project : OnePieceMod
o [||||||||||] - 20%
SaM.ThE.MaN is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-12-2010 , 09:15   Re: Required_kills_for_next_level
Reply With Quote #8

Here's another method which allows a Min\Max range for each rank. Also included is a SetRank function which will assign a rank to a player based on his XP points.

PHP Code:
//Constants for each rank, easier to use than number ranks
enum Ranks
{
    
Noob// 0
    
Rookie// 1
    
Good// 2
    
Best// 3
    
Pro // 4
}

//XP/point ranges for each rank.
new const RankXPRanks ][ ] = 
{
    {   
100 }, //Noob 0-100 pts
    
101 200 }, //Rookie 101-200 pts
    
201 300 }, //Good 201-300 pts
    
301 400 }, //Best 301-400 pts
    
401 999999999 //Pro 401+ pts
}

//This is used only to print/display the rank a player currently has.
new const RankNameRanks ][] = 
{
    
"Noob",
    
"Rookie",
    
"Good",
    
"Best",
    
"Pro"
}

//Create 2 arrays, g_XP[] is the number of XP points each player has;
//g_PlayerRank is the players current Rank (assigned by SetRank function)
new g_XP33 ] , Ranks:g_PlayerRank33 ];

public 
SetRankid 
{
    
//Loop through all of our ranks (See above enum)
    
for ( new Ranks:Noob <= Pro i++ )
    {
        
//Check if player is in current rank, suppose the player had 320 XP pts, this 
        //condition would be met at Pro rank since the XP range is 301-400. 
        // if ( 301 <= 320 <= 400 ) would be true so we assign Pro rank to player.
        
if ( RankXP][ ] <= g_XPid ] <= RankXP][ ] )
        {
            
g_PlayerRankid ] = i;
            break;
        }
    }

    
client_printprint_chat "XP=%d Rank=%s" g_XPid ] , RankNameg_PlayerRankid ] ] );  

__________________

Last edited by Bugsy; 06-12-2010 at 09:22.
Bugsy is offline
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 06-12-2010 , 10:08   Re: Required_kills_for_next_level
Reply With Quote #9

i already have an xp mod kinda script.
I wanted some one to explain what Xella had done to add it to my script, Since in my script i already have levels and Xp for next level. I only wanna know how to show required xp.
I can give you the full script
__________________
  • Project : Level Plugin
o [||||||||||] - 100%
  • Project : OnePieceMod
o [||||||||||] - 20%
SaM.ThE.MaN is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-12-2010 , 10:26   Re: Required_kills_for_next_level
Reply With Quote #10

PHP Code:
new const g_iRequiredKillsPerLevel[ ] = 
{
    
16,
    
32,
    
64,
    
128,
    
256
};

new 
g_iLevel33 ]; //Players current level
new g_iKills33 ]; //Players current # kills 
new g_iRequiredKills33 ]; //# kills needed for next level

//Example current kill#
g_iKillsid ] = 37;

//Keep looping while the kills are >= each kill level (range from 16-256). With each
//iteration, g_iLevel increases by 1 to change the required kill level we are checking.
//This loop would exit on the 3rd condition check leaving vals at: 
// g_iKills=37, g_iLevel=1, g_iRequiredKillsPerLevel=32
while( g_iKillsid ] >= g_iRequiredKillsPerLevelg_iLevelid ] ] )
{
    
/*Iterations
    1. g_iKills=37, g_iLevel=0, g_iRequiredKillsPerLevel=16
    2. g_iKills=37, g_iLevel=1, g_iRequiredKillsPerLevel=32 (loop exits here since 37 < 64)
    3. g_iKills=37, g_iLevel=2, g_iRequiredKillsPerLevel=64  */
    
g_iLevelid ]++;
}

//Here we determine the # kills needed for next level with these values:
// g_iLevel[ id ] = 1
// g_iLevel[ id ] + 1 = 2
// g_iRequiredKillsPerLevel[ 2 ] = 64
// g_iKills[ id ] = 37

// 27 = 64 - 37
g_iRequiredKillsid ] = g_iRequiredKillsPerLevelg_iLevelid ] + ] - g_iKillsid ]; 
__________________
Bugsy 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 05:25.


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