AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Random model. (https://forums.alliedmods.net/showthread.php?t=209110)

Unkolix 02-21-2013 09:34

Random model.
 
How to make that ct would get 1 of 4 models and t would get 1 of 4 models?
Other models:
CT: vip_ct, vip1_ct, vip2_ct, vip3_ct
TR: vip_tr, vip1_tr, vip2_tr, vip3_tr
PHP Code:

public resetModel(idlevelcid
{
    if (
get_user_flags(id) & ADMIN_LEVEL_H
    {
        if (
cs_get_user_team(id) == CS_TEAM_T
        {
            
cs_set_user_model(id"vip_tr")
        }
        else if(
cs_get_user_team(id) == CS_TEAM_CT
        {
            
cs_set_user_model(id"vip_ct")
        }
        else 
        {
            
cs_reset_user_model(id)
        }
    }
    return 
PLUGIN_CONTINUE



ironskillz1 02-21-2013 09:50

Re: Random model.
 
Quote:

Originally Posted by Unkolix (Post 1898898)
How to make that ct would get 1 of 4 models and t would get 1 of 4 models?
Other models:
CT: vip_ct, vip1_ct, vip2_ct, vip3_ct
TR: vip_tr, vip1_tr, vip2_tr, vip3_tr
PHP Code:

public resetModel(idlevelcid
{
    if (
get_user_flags(id) & ADMIN_LEVEL_H
    {
        if (
cs_get_user_team(id) == CS_TEAM_T
        {
            
cs_set_user_model(id"vip_tr")
        }
        else if(
cs_get_user_team(id) == CS_TEAM_CT
        {
            
cs_set_user_model(id"vip_ct")
        }
        else 
        {
            
cs_reset_user_model(id)
        }
    }
    return 
PLUGIN_CONTINUE



Code:

if( random_num (0, 4) <= 1)
{
      cs_set_user_model(id, "vip_ct")
}


EDUTz 02-21-2013 19:48

Re: Random model.
 
const vip_models[4]
{
vip1,
vip2,
vip3,
vip4
}

cs_set_user_model(id, vip_models[random_num(0, 4)])


All times are GMT -4. The time now is 21:36.

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