AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved] Player Level (https://forums.alliedmods.net/showthread.php?t=92635)

Xellath 05-17-2009 15:33

[Solved] Player Level
 
[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?

padilha007 05-17-2009 15:40

Re: Player Level
 
PHP Code:

if(PlayerLevel[id] == 6)
        return 
PLUGIN_HANDLED


Xellath 05-17-2009 15:50

Re: Player Level
 
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.."



Hunter-Digital 05-17-2009 16:21

Re: Player Level
 
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() )

fysiks 05-18-2009 03:05

Re: Player Level
 
Quote:

Originally Posted by Hunter-Digital (Post 829508)
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
    
}



goldberg 11-19-2009 04:21

Re: [Solved] Player Level
 
thanks


All times are GMT -4. The time now is 01:33.

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