Raised This Month: $ Target: $400
 0% 

[Solved] Player Level


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 05-17-2009 , 15:33   [Solved] Player Level
Reply With Quote #1

[solved]

Hello, I would like to know one thing.

How can I check a players level?

ex.

PHP Code:
new const Levels[7] = {
 
50,
 
400,
 
1900,
 
3500,
 
7100,
 
15700
}
 
new 
PlayerExp[33];
new 
PlayerLevel[33];
 
/.../
 
public 
whatever(id)
{
    if(
PlayerLevel[id] == Levels[PlayerLevel[6]]
        return 
PLUGIN_HANDLED;

Can I do something like this, or how could I do it?
__________________
Achievements API - a simple way for you to create your OWN custom achievements!

Last edited by Xellath; 05-18-2009 at 10:03.
Xellath is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 05-17-2009 , 15:40   Re: Player Level
Reply With Quote #2

PHP Code:
if(PlayerLevel[id] == 6)
        return 
PLUGIN_HANDLED
__________________

padilha007 is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 05-17-2009 , 15:50   Re: Player Level
Reply With Quote #3

Thanks a bunch, but IF the player is level 2 for example is there a way to still acheive the same thing as if he's level 3?

PHP Code:
PlayerLevel[id] == 2
Or something?

He should be able to get that thing even if he is lvl 3.. NOT strictly lvl 2.

EDIT:
Also..

If I'm going to set a players model, using cs_set_user_model().. can I precache like this then?

PHP Code:
public plugin_precache()
{
    
MODEL_1 "models/dir/dir.."

__________________
Achievements API - a simple way for you to create your OWN custom achievements!

Last edited by Xellath; 05-17-2009 at 15:52.
Xellath is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-17-2009 , 16:21   Re: Player Level
Reply With Quote #4

level 2 or 3
PHP Code:
if(PlayerLevel[id] == || PlayerLevel[id] == 3
level 2 or above
PHP Code:
if(PlayerLevel[id] >= 2
and using cs_set_user_model() you can set only models inside "models/player/<name>/<name>.mdl" (where name is the model name that you set in the function) and you can precache them like this:
PHP Code:
precache_model("models/player/my_model/my_model.mdl"
(where my_model is your model... that you also set in the cs_set_user_model() )
__________________
Hunter-Digital is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-18-2009 , 03:05   Re: Player Level
Reply With Quote #5

Quote:
Originally Posted by Hunter-Digital View Post
level 2 or 3
PHP Code:
if(PlayerLevel[id] == || PlayerLevel[id] == 3
level 2 or above
PHP Code:
if(PlayerLevel[id] >= 2
Or something like:
PHP Code:
switch(PlayerLevel[id])
{
    case 
1:
    {
        
// Stuff for level 1
    
}
    case 
2..3:
    {
        
// Stuff for level 2 and 3
    
}
    case 
4..6:
    {
        
// Stuff for levels 4, 5, and 6
    
}
    default:
    {
        
// Stuff for all other levels
    
}

__________________
fysiks is offline
goldberg
BANNED
Join Date: Nov 2009
Old 11-19-2009 , 04:21   Re: [Solved] Player Level
Reply With Quote #6

thanks
goldberg 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 01:33.


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