Raised This Month: $ Target: $400
 0% 

Help Model Precaching


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
laziboi72
Senior Member
Join Date: Aug 2009
Location: deathrun_temple
Old 12-21-2009 , 14:17   Help Model Precaching
Reply With Quote #1

This code complies with no error/warnings its just that When I use this plugin cs1.6 works fine and I am able to get the "gun menu" to appear but the moment I select a weapon from the menu the game crashes and tells me that my models aren't precached... but i did include all the models in public precache...
can some one help? thanks

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <fakemeta> 

new gMOD;

new 
bool:hasAK[33] = false;
new 
bool:hasM4[33] = false;
new 
bool:hasM5[33] = false;
new 
bool:hasMG[33] = false;
new 
bool:hasXM[33] = false;
new 
bool:hasM3[33] = false;

new 
CVAR_AKCOST;
new 
CVAR_M4COST;
new 
CVAR_M5COST;
new 
CVAR_MGCOST;
new 
CVAR_XMCOST;
new 
CVAR_M3COST;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
gMOD register_menuid("GunMOD");
    
register_menucmd(gMOD1023"menuhandle");
    
register_clcmd("say /gunmenu""GunMenu")
    
register_clcmd("say_team /gunmenu""GunMenu")
    
    
CVAR_AKCOST register_cvar("amx_AKcost""15000"); 
    
CVAR_M4COST register_cvar("amx_M4cost""15000");
    
CVAR_M5COST register_cvar("amx_M5cost""15000");
    
CVAR_MGCOST register_cvar("amx_MGcost""15000");
    
CVAR_XMCOST register_cvar("amx_XMcost""15000");
    
CVAR_M3COST register_cvar("amx_M3cost""15000");
}
public 
plugin_precache(){    
    
precache_model("models/v_ak47_1.mdl")
    
precache_model("models/p_ak47_1.mdl")

    
precache_model("models/v_m3_1.mdl")
    
precache_model("models/p_m3_1.mdl")

    
precache_model("models/v_m4a1_1.mdl")
    
precache_model("models/p_m4a1_1.mdl")

    
precache_model("models/v_m249_2.mdl")
    
precache_model("models/p_m249_2.mdl")

    
precache_model("models/v_xm1014_1.mdl")
    
precache_model("models/P_xm1014_1.mdl")
    
    
precache_model("models/v_mp5_1.mdl")
    
precache_model("models/p_mp5_1.mdl")        
}   
public 
GunMenu(id)

    new 
akcost get_pcvar_num(CVAR_AKCOST);
    new 
m4cost get_pcvar_num(CVAR_M4COST);
    new 
m5cost get_pcvar_num(CVAR_M5COST);
    new 
m3cost get_pcvar_num(CVAR_M3COST);
    new 
mgcost get_pcvar_num(CVAR_MGCOST);
    new 
xmcost get_pcvar_num(CVAR_XMCOST);
    
    
    new 
menu[512];
    
format(menu511"\wGunMOD\w^n^n1. Buy M3    \y($%i)\w^n2. Buy XM    \y($%i)\w^n3. Buy MP5    \y($%i)\w^n4. Buy m4a1    \y($%i)\w^n5. Buy ak47    \y($%i)\w^n6.  Buy m249    \y($%i)\w^n^n7 .Exit^n"m3costxmcostm5costm4costakcostmgcost);
    
    new 
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<9);
    
show_menu(idkeysmenu, -1"GunMOD");
}


public 
menuhandle(idkeys

    switch(
keys
    { 
        case 
0SetM3(id)
        case 
1SetXM(id)
        case 
2SetM5(id)
        case 
3SetM4(id)
        case 
4SetAK(id)
        case 
5SetMG(id)
        default: return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
}
public 
SetM3(id)
{
    new 
money cs_get_user_money(id);
    new 
price get_pcvar_num(CVAR_M3COST);
        
    if(!
is_user_alive(id)) {
        
client_print(idprint_chat"Dead people can't buy weapons!");
    } else if(
hasM3[id]) {
        
client_print(idprint_chat"You already have a M3");
    } else if(
money price) {
        
client_print(idprint_chat"You can't afford that!");
    } else {
            
hasM3[id] = true;
            
cs_set_user_money(idmoney price);
            
            
give_item(id,"weapon_m3");
            
give_item(id,"ammo_buckshot");
            
give_item(id,"ammo_buckshot");
            
give_item(id,"ammo_buckshot");
            
            
set_pev(idpev_viewmodel"models/v_m3_1.mdl");
            
set_pev(idpev_weaponmodel"models/p_m3_1.mdl");
            
            
client_print(id,print_chat,"You have bought the M3 for %i dollars",price);
    
    }
    return 
PLUGIN_HANDLED;
}
public 
SetXM(id)
{
    new 
money cs_get_user_money(id);
    new 
price get_pcvar_num(CVAR_XMCOST);
        
    if(!
is_user_alive(id)) {
        
client_print(idprint_chat"Dead people can't buy weapons!");
    } else if(
hasXM[id]) {
        
client_print(idprint_chat"You already have a XM");
    } else if(
money price) {
        
client_print(idprint_chat"You can't afford that!");
    } else {
            
hasXM[id] = true;
            
cs_set_user_money(idmoney price);
            
            
give_item(id,"weapon_xm1014");
            
give_item(id,"ammo_buckshot");
            
give_item(id,"ammo_buckshot");
            
give_item(id,"ammo_buckshot");
            
            
set_pev(idpev_viewmodel"models/v_xm1014_1.mdl");
            
set_pev(idpev_weaponmodel"models/p_xm1014_1.mdl");
            
            
client_print(id,print_chat,"You have bought the XM for %i dollars",price);
        
    }
    return 
PLUGIN_HANDLED;
}
public 
SetM5(id)
{
    new 
money cs_get_user_money(id);
    new 
price get_pcvar_num(CVAR_M5COST);
        
    if(!
is_user_alive(id)) {
        
client_print(idprint_chat"Dead people can't buy weapons!");
    } else if(
hasM5[id]) {
        
client_print(idprint_chat"You already have a MP5");
    } else if(
money price) {
        
client_print(idprint_chat"You can't afford that!");
    } else {
            
hasM5[id] = true;
            
cs_set_user_money(idmoney price);
            
            
give_item(id,"weapon_mp5navy");
            
give_item(id,"ammo_9mm");
            
give_item(id,"ammo_9mm");
            
give_item(id,"ammo_9mm");
            
            
set_pev(idpev_viewmodel"models/v_mp5_1.mdl");
            
set_pev(idpev_weaponmodel"models/p_mp5_1.mdl");
            
            
client_print(id,print_chat,"You have bought the MP5 for %i dollars",price);
        
    }
    return 
PLUGIN_HANDLED;
}
public 
SetM4(id)
{
    new 
money cs_get_user_money(id);
    new 
price get_pcvar_num(CVAR_M4COST);
        
    if(!
is_user_alive(id)) {
        
client_print(idprint_chat"Dead people can't buy weapons!");
    } else if(
hasM4[id]) {
        
client_print(idprint_chat"You already have a M4");
    } else if(
money price) {
        
client_print(idprint_chat"You can't afford that!");
    } else {
            
hasM4[id] = true;
            
cs_set_user_money(idmoney price);
            
            
give_item(id,"weapon_m4a1");
            
give_item(id,"ammo_556nato");
            
give_item(id,"ammo_556nato");
            
give_item(id,"ammo_556nato");
            
            
set_pev(idpev_viewmodel"models/v_m4a1_1.mdl");
            
set_pev(idpev_weaponmodel"models/p_m4a1_1.mdl");
            
            
client_print(id,print_chat,"You have bought the M4 for %i dollars",price);

    }
    return 
PLUGIN_HANDLED;
}
public 
SetAK(id)
{
    new 
money cs_get_user_money(id);
    new 
price get_pcvar_num(CVAR_AKCOST);
        
    if(!
is_user_alive(id)) {
        
client_print(idprint_chat"Dead people can't buy weapons!");
    } else if(
hasAK[id]) {
        
client_print(idprint_chat"You already have a AK");
    } else if(
money price) {
        
client_print(idprint_chat"You can't afford that!");
    } else {
            
hasAK[id] = true;
            
cs_set_user_money(idmoney price);
            
            
give_item(id,"weapon_ak47");
            
give_item(id,"ammo_762nato");
            
give_item(id,"ammo_762nato");
            
give_item(id,"ammo_762nato");
            
            
set_pev(idpev_viewmodel"models/v_ak47_1.mdl");
            
set_pev(idpev_weaponmodel"models/p_ak47_1.mdl");
            
            
client_print(id,print_chat,"You have bought the AK for %i dollars",price);
        
    }
    return 
PLUGIN_HANDLED;
}
public 
SetMG(id)
{
    new 
money cs_get_user_money(id);
    new 
price get_pcvar_num(CVAR_MGCOST);
        
    if(!
is_user_alive(id)) {
        
client_print(idprint_chat"Dead people can't buy weapons!");
    } else if(
hasMG[id]) {
        
client_print(idprint_chat"You already have a MG");
    } else if(
money price) {
        
client_print(idprint_chat"You can't afford that!");
    } else {
            
hasMG[id] = true;
            
cs_set_user_money(idmoney price);
            
            
give_item(id,"weapon_ak47");
            
give_item(id,"ammo_762nato");
            
give_item(id,"ammo_762nato");
            
give_item(id,"ammo_762nato");
            
            
set_pev(idpev_viewmodel"models/v_m249_2.mdl");
            
set_pev(idpev_weaponmodel"models/p_m249_2.mdl");
            
            
client_print(id,print_chat,"You have bought the MG for %i dollars",price);
    
    }
    return 
PLUGIN_HANDLED;

__________________
Taking a break from modding dunno when i will be back

FAIL, RIGHT HERE
laziboi72 is offline
 


Thread Tools
Display Modes

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 04:08.


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