AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Model problem (https://forums.alliedmods.net/showthread.php?t=135052)

zirualas 08-12-2010 02:23

Model problem
 
How i can change model of the player? I wanna change T model to CT but then i write this code and select from menu skin he's don't wear up :|
PHP Code:

precache_model("models\player\model\model.mdl"


naven 08-12-2010 03:06

Re: Model problem
 
Use this:
PHP Code:

 /* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "Jail Break model"
#define VERSION "1.2"
#define AUTHOR "naven"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Spawn"player""runda"1);
}
public 
runda(id){
    if(
cs_get_user_team(id) == CS_TEAM_T) {    
    if(
is_user_connected(id))
    
cs_set_user_model(id"wiezien")
    }
    else if(
cs_get_user_team(id) == CS_TEAM_CT){
    
cs_set_user_model(id"klawisz")
}
}
public 
plugin_precache(){
    
precache_model("models/player/wiezien/wiezien.mdl")
    
precache_model("models/player/klawisz/klawisz.mdl")



zirualas 08-12-2010 03:12

Re: Model problem
 
Thx but i need into in "Fun Buy" Here's my code:
Code:

#include <amxmodx>
#include <cstrike>
#include <colorchat>
#include <fun>

#define PLUGIN "Fun Buy"
#define VERSION "1.0"
#define AUTHOR "ZiruAl"

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)

    register_clcmd( "say /funbuy", "FunBuy" );
    register_clcmd( "say_team /funbuy", "FunBuy" );

}
public FunBuy(id)
{
    new menu = menu_create("\gFun Buy Menu:", "menu_handler");

    menu_additem(menu, "\w Low Gravity - \r4000", "1", 0);
    menu_additem(menu, "\w Buy C4 - \r16000", "2", 0);
    menu_additem(menu, "\w CT skin - \r14500", "3", 0);

    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
    menu_display(id, menu, 0);
}

public menu_handler(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
   
    new data[6], iName[64];
    new acess, callback;

    menu_item_getinfo(menu, item, acess, data,6, iName, 63, callback);
    new key = str_to_num(data);
   
    switch(key)
    {
        case 1 : //gravity
        {
            new name[32];
           
            if (cs_get_user_money(id) < 4000)
            {
                get_user_name(id, name, 31)
                ColorChat(id, GREEN, "%s ^x03-Don't have enought money", name)
                return PLUGIN_HANDLED;
            }
           
            if (!is_user_alive(id))
            {
                ColorChat(id, GREEN, "%s ^x03-need to be alive", name)
                return PLUGIN_HANDLED;
            }
           
            if (cs_get_user_money(id) >= 4000 )
            {
                get_user_name(id, name, 31)
                ColorChat(0, GREEN, "%s ^x03-Buy a gravitation", name)
                set_user_gravity(id, 0.87)
                cs_set_user_money(id , cs_get_user_money(id) - 4000, 0)
            }
        }
        case 2 :
        {
            new name[32];
           
            if (cs_get_user_money(id) < 16000)
            {
                get_user_name(id, name, 31)
                ColorChat(id, GREEN, "%s ^x03-Don't have enought money", name)
                return PLUGIN_HANDLED;
            }
           
            if (!is_user_alive(id))
            {
                ColorChat(id, GREEN, "%s ^x03-need to be alive", name)
                return PLUGIN_HANDLED;
            }
           
            if (cs_get_user_money(id) >= 16000 )
            {
                get_user_name(id, name, 31)
                ColorChat(0, GREEN, "%s ^x03-Buy a C4", name)
                give_item(id, "weapon_c4")
        cs_set_user_plant(id, 1, 1)
                cs_set_user_money(id , cs_get_user_money(id) - 16000, 0)
            }
        }
        case 3 :
        {
            new name[32];
           
            if (cs_get_user_money(id) < 14500)
            {
                get_user_name(id, name, 31)
                ColorChat(id, GREEN, "%s ^x03-Don't have enought money", name)
                return PLUGIN_HANDLED;
            }
           
            if (!is_user_alive(id))
            {
                ColorChat(id, GREEN, "%s ^x03-need to be alive", name)
                return PLUGIN_HANDLED;
            }
           
            if (cs_get_user_money(id) >= 14500 )
            {
              get_user_name(id, name, 31)
                ColorChat(0, GREEN, "%s ^x03-Buy a CT skin", name)
                precache_model("models\player\pipec\pipec.mdl")
                cs_set_user_money(id , cs_get_user_money(id) - 14500, 0)

            }

        }
    }
    menu_destroy(menu);
    return PLUGIN_HANDLED;
 }


naven 08-12-2010 03:25

Re: Model problem
 
ALWAYS USE precache in public plugin_precache!!!

zirualas 08-12-2010 06:00

Re: Model problem
 
Check my error.
PHP Code:

//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// testas.sma
// C:\Program Files\Counter-strike\cstrike\addons\amxmodx\scripting\testas.sma(1
23) : error 035argument type mismatch (argument 1)
//
// 1 Error.
// Could not locate output file C:\Program Files\Counter-strike\cstrike\addons\a
mxmodx\scripting\compiled\testas.amx (compile failed).
//
// Compilation Time: 0.08 sec
// ----------------------------------------

Press enter to exit ... 

Here my code.
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <colorchat>
#include <fun>

#define PLUGIN "Fun Buy"
#define VERSION "1.0"
#define AUTHOR "ZiruAl"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd"say /funbuy""FunBuy" );
    
register_clcmd"say_team /funbuy""FunBuy" );

}
    public  
plugin_precache ( )
    {
    
precache_model("models/player/pipec/pipec.mdl")
    }

public 
FunBuy(id)
{
    new 
menu menu_create("\gFun Buy Menu:""menu_handler");

    
menu_additem(menu"\w Low Gravity - \r4000""1"0);
    
menu_additem(menu"\w Buy C4 - \r16000""2"0);
    
menu_additem(menu"\w CT skin - \r14500""3"0);

    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0);
}

public 
menu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
acesscallback;

    
menu_item_getinfo(menuitemacessdata,6iName63callback);
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
//gravity
        
{
            new 
name[32];
            
            if (
cs_get_user_money(id) < 4000)
            {
                
get_user_name(idname31)
                
ColorChat(idGREEN"%s ^x03-Don't have enought money"name)
                return 
PLUGIN_HANDLED;
            }
            
            if (!
is_user_alive(id))
            {
                
ColorChat(idGREEN"%s ^x03-need to be alive"name)
                return 
PLUGIN_HANDLED;
            }
            
            if (
cs_get_user_money(id) >= 4000 )
            {
                
get_user_name(idname31)
                
ColorChat(0GREEN"%s ^x03-Buy a gravitation"name)
                
set_user_gravity(id0.87)
                
cs_set_user_money(id cs_get_user_money(id) - 40000)
            }
        }
        case 
:
        {
            new 
name[32];
            
            if (
cs_get_user_money(id) < 16000)
            {
                
get_user_name(idname31)
                
ColorChat(idGREEN"%s ^x03-Don't have enought money"name)
                return 
PLUGIN_HANDLED;
            }
            
            if (!
is_user_alive(id))
            {
                
ColorChat(idGREEN"%s ^x03-need to be alive"name)
                return 
PLUGIN_HANDLED;
            }
            
            if (
cs_get_user_money(id) >= 16000 )
            {
                
get_user_name(idname31)
                
ColorChat(0GREEN"%s ^x03-Buy a C4"name)
                
give_item(id"weapon_c4")
        
cs_set_user_plant(id11)
                
cs_set_user_money(id cs_get_user_money(id) - 160000)
            }
        }
        case 
:
        {
            new 
name[32];
            
            if (
cs_get_user_money(id) < 14500)
            {
                
get_user_name(idname31)
                
ColorChat(idGREEN"%s ^x03-Don't have enought money"name)
                return 
PLUGIN_HANDLED;
            }
            
            if (!
is_user_alive(id))
            {
                
ColorChat(idGREEN"%s ^x03-need to be alive"name)
                return 
PLUGIN_HANDLED;
            }
            
            if (
cs_get_user_money(id) >= 14500 )
            {
                
get_user_name(idname31)
                
ColorChat(0GREEN"%s ^x03-Buy a CT skin"name)
                
cs_set_user_model("pipec")
                
cs_set_user_money(id cs_get_user_money(id) - 145000)
            }
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
 } 


naven 08-12-2010 06:02

Re: Model problem
 
PHP Code:

 cs_set_user_model("pipec"

Ok, you are setting model, but on what?
Correct form:
PHP Code:

 cs_set_user_model(id,"pipec"


zirualas 08-12-2010 06:54

Re: Model problem
 
Thx man

mottzi 08-12-2010 12:56

Re: Model problem
 
Note that the model will be resettet to normal at each spawn.

zirualas 08-12-2010 13:48

Re: Model problem
 
So i need type cs_reset_user_model(id)? Or do something thith bool?

naven 08-12-2010 14:25

Re: Model problem
 
He means, that every round model will be reseted itself to default, so you need to set it every round if you want it lasts longer than one round.


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

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