| 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_forward( FM_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(id, menu);
}
public SkinMenu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
cs_set_user_model(id,"sasa1.mdl");
set_hudmessage(0, 191, 255, -1.0, -3.0, 2, 1.0, 9.0, 0.1, 0.1, 4);
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(0, 191, 255, -1.0, -3.0, 2, 1.0, 9.0, 0.1, 0.1, 4);
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 = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!g", "^x04"); // Green Color
replace_all(msg, 190, "!n", "^x01"); // Default Color
replace_all(msg, 190, "!t", "^x03"); // Team Color
if (id) players[0] = id; else get_players(players, count, "ch");
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
|