AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Why isn't this code working? (https://forums.alliedmods.net/showthread.php?t=237088)

Flick3rR 03-17-2014 15:02

[HELP] Why isn't this code working?
 
Hi, guys! The idea of the plugin is an SkinModels menu... When you choose 1, it sets you model#1, when you choose 2, it sets you model#2. So, that's the code, but the first model is not setting... I don't know why, but if there are some mistakes in it, please share. :)
PHP Code:

/*
*    -----------------
*     Coded in 2011,
*     by anti-talent or talents
*     -----------------
*
*    .:: Description ::.
*
*     BaseBuilder VIP Menu.
*
*    .:: Contacts ::.
*
*    Email: [email protected]
*
*    Steam: pijele
*
*/
#pragma semicolon 1

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <vault>

#define ADMIN_BBVIP ADMIN_LEVEL_G

// Define the Plugin Version
new const VERSION[] = { "1.0" };

// PREFIX
new const PREFIX[] = { "!g[eXplosive]!n" };

new const 
g_szVipT[] = "models/player/sasa1/sasa1.mdl";
new const 
g_szVipCT[] = "models/player/sasa2/sasa2.mdl";

new 
VipUsed[33];
new 
HasSpeed;

new 
bool:g_bHasVipT[33];
new 
bool:g_bHasVipCT[33];
//new g_pVisiblity;
new mpd,/* mkb,*/ mhb;
new 
maxplayers;

public 
plugin_init()
{
    
//RegisterHam(Ham_Spawn, "player", "FwdHamSpawn_Post", 1);
    //RegisterHam(Ham_Item_PreFrame, "player", "FwdPreFrame_Post", 1);
    //RegisterHam(Ham_TakeDamage, "player", "FwdPlayerDamage");
    //RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
    
    //register_event("CurWeapon","event_curweapon","be","1=1");
    
    
register_plugin("Skins Menu","1.0","Flicker");
    
register_clcmd("say /skins""cmdVmenu");
    
register_clcmd("say_team /skins""cmdVmenu");
    
//g_pVisiblity = register_cvar( "km_invis", "200" ); // 255 = clearly visible
    // set_task(480.0, "kmodmsg", 0, _, _, "b");
    
    
    
    // Ham TakeDamage
    
register_forwardFM_CmdStart"fw_CmdStart" );
    
//RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1); 
}
   

public 
plugin_precache()
{
    
precache_model(g_szVipT);
    
precache_model(g_szVipCT);
}





public 
FwdHamSpawn_Post(id)
{
    if (!
is_user_alive(id))
        return 
PLUGIN_CONTINUE;
        
    
VipUsed[id] = false;
    
g_bHasVipT[id] = false
    
g_bHasVipCT[id] = false
    return 
PLUGIN_CONTINUE;
}  

public 
cmdVmenu(id)
{
    if(!(
get_user_flags(id) & ADMIN_BBVIP))
    {
        
client_printc(id"%s !tOnly !gVIPs !tcan use the Skin Menu!"PREFIX);
        
        return 
PLUGIN_HANDLED;
    }
    switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_T:
            
SkinMenu(id);
        
        case 
CS_TEAM_CT:
            
SkinMenu(id);
    }
    
    return 
PLUGIN_HANDLED;
}

public 
SkinMenu(id)
{
    new 
menu menu_create("\ySkin Menu:^n\r""SkinMenu_handler");
    
    
menu_additem(menu"\wGirl Model 1 \r[\yHot\r]""1"0);
    
menu_additem(menu"\wGirl Model 2 \r[\ySexy\r]""2"0);
    
menu_display(idmenu);
}

public 
SkinMenu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            
cs_set_user_model(id,"sasa1.mdl");
            
set_hudmessage(0191255, -1.0, -3.021.09.00.10.14);
            
show_hudmessage(id"You choose Girl Model 1!");
            
g_bHasVipT[id] = true;
            
VipUsed[id] = true;
            
        }
        case 
2:
        {
            
cs_set_user_model(id,"sasa2");
            
set_hudmessage(0191255, -1.0, -3.021.09.00.10.14);
            
show_hudmessage(id"You choose Girl Model 2!");
            
g_bHasVipCT[id] = true;
            
VipUsed[id] = true;
        }

    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}



// Colour Chat
stock client_printc(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^x04"); // Green Color
    
replace_all(msg190"!n""^x01"); // Default Color
    
replace_all(msg190"!t""^x03"); // Team Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    
    for (new 
0counti++)
    {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
    }



fysiks 03-17-2014 15:33

Re: [HELP] Why isn't this code working?
 
If the second one works then you need to look at the differences between the two. It should be obvious.

Flick3rR 03-17-2014 16:18

Re: [HELP] Why isn't this code working?
 
I can't see any differences.... That's the problem and I don't know why... :D :D :D

YamiKaitou 03-17-2014 16:23

Re: [HELP] Why isn't this code working?
 
Model #1
Code:

cs_set_user_model(id,"sasa1.mdl");
Model #2
Code:

cs_set_user_model(id,"sasa2");
Do you see a difference now?

Flick3rR 03-17-2014 17:01

Re: [HELP] Why isn't this code working?
 
I am dumb as f*ck. Thanks, YamiKaitou. Уou can delete all the topic now. I'm so shamed :D :D :D Thanks a lot!!!


All times are GMT -4. The time now is 06:00.

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