Русское сообщество по скриптингу

To do random between hat-models

Scripting help for english speaking users. While not very active, you still have a chance to get help here.
Правила форума
We cannot maintain english version version of our forum rules, but shortly (it's simple) - Don't be a dick. If you really want to know our rules you should check appropriate thread.

To do random between hat-models

Сообщение ^eNeMy » 10 дек 2016, 22:47

Hi guys very hope u can help me with that
Код: Выделить всё
#include < amxmodx > 
#include < zombieplague >
#include < engine > 

#define PLUGIN "Hat" 
#define VERSION "1.0" 
#define AUTHOR "pRoxxx" 

new Ent[33
new const 
g_model[] = 

    
"models/hats/Olen4er.mdl" ,
    
"models/hats/menti_ny.mdl" ,
    
"models/hats/santahat2.mdl"


public 
plugin_init()  

    
register_plugin(PLUGINVERSIONAUTHOR
     
    
register_event("Battery""armor""be"


public 
plugin_precache() 

    
precache_modelg_model 


public 
armor(id

    new 
arm read_data(1
    
    if(
zp_get_user_zombie(id))
    {
    
remove_hat(id)
        return
    }
        
    if(
arm 1
    { 
        if(
Ent[id] > 0
        { 
            
remove_hat(id
        } 
    } 
    else if(
arm 0
    { 
        if(
Ent[id] < 1
        { 
            
Ent[id] = create_entity("info_target"
            if(
is_valid_ent(id)) 
            { 
                
entity_set_model(Ent[id] , g_model
                
entity_set_int(Ent[id], EV_INT_movetypeMOVETYPE_FOLLOW
                
entity_set_edict(Ent[id], EV_ENT_aimentid
            } 
        } 
    } 


public 
remove_hat(id

    if(
Ent[id] > 0
    { 
        
remove_entity(Ent[id]) 
        
Ent[id] = 
    



public 
client_connect(id

    
remove_hat(id)    


public 
client_disconnect(id

    
remove_hat(id)      
}  
 

So I got this code, but its not workin randomly. It gets only first Olen4er.mdl model when ur armoring. Can u do this to change randomly by three hats models please?
Аватара пользователя
^eNeMy
 
Сообщения: 54
Зарегистрирован: 17 апр 2011, 20:13
Откуда: Belarus,Vitebsk
Благодарил (а): 28 раз.
Поблагодарили: 2 раз.
Опыт программирования: Меньше месяца
Языки программирования: Counter-Strike 1.6

Re: To do random between hat-models

Сообщение ko22009 » 19 янв 2017, 17:36

You need change this: entity_set_model(Ent[id] , g_model) to
Код: Выделить всё
v_rand random_num(02);
entity_set_model(Ent[id] , g_model[v_rand]) 
Аватара пользователя
ko22009
 
Сообщения: 131
Зарегистрирован: 19 янв 2017, 16:20
Благодарил (а): 12 раз.
Поблагодарили: 27 раз.
Опыт программирования: Больше трех лет
Языки программирования: Pawn
C++
Php
Python
C#


Вернуться в Scripting

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 1