AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HUD msg.. (https://forums.alliedmods.net/showthread.php?t=163379)

samba88 07-29-2011 17:00

HUD msg..
 
Hi i have done one HUD msg...
but it dont show me it..

PHP Code:

public hud_msg() {
   
    new 
saopshe[62]
    
format(saopshe,61,"- My Message -"


    
set_hudmessage(255,00, -1.00.820.58.00.21.01);
    
show_hudmessage(0"%s"saopshe);        
}

public 
setMessage() {
    
    new 
Float:freq_im get_pcvar_float(msg_freq);
    
    if (
freq_im 0.0)
    {
        
set_task(freq_im"hud_msg");
    }
    return 
PLUGIN_HANDLED


what i do false?

Hunter-Digital 07-29-2011 18:33

Re: HUD msg..
 
Debug your code, add a client_print before the hudmessage to see if that code is executed.


A side note, instead of:
Code:

show_hudmessage(0, "%s", saopshe);
you can just:
Code:

show_hudmessage(0, saopshe);

samba88 07-29-2011 18:55

Re: HUD msg..
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

new  freq_msg;

public 
plugin_init() {
    
    
register_plugin("blah""1.0""samba")
    
register_cvar("hud_msg""1.0"FCVAR_SERVER)
    
    
register_clcmd"say /test"" hud_msg" );
    
freq_msg=register_cvar("freq_msg""180")

}

public 
hud_msg() {
        
    new 
saopshe[62]
    
format(saopshe,61,"- My Message -"


    
set_hudmessage(255,00, -1.00.820.58.00.21.04);
    
show_hudmessage(0saopshe);
    
    
client_print(0print_console"%s"saopshe);
    
}

public 
set_msg() {
      
    new 
Float:freq_im get_pcvar_float(freq_msg);
    
    if (
freq_im 0.0)
        
set_task(freq_im"hud_msg");
    
    return 
PLUGIN_HANDLED


so if i type in chat /test its show me hud and print console msg but why it dont show me the msg automatically?

Krle 07-29-2011 19:45

Re: HUD msg..
 
PHP Code:

public set_msg()
{
set_hudmessage(42255420.050.2506.060.0)
        
show_hudmessage(id"Youre Text Gose Here...")


This will display youre HUD MSG in left corner green color

samba88 07-29-2011 20:00

Re: HUD msg..
 
merci..
but my questin is why my script dont show me my hud automatically

Krle 07-29-2011 21:44

Re: HUD msg..
 
I have the same problem with my code dude :D

Try this:
PHP Code:

public client_putinserver(id)
{
     
set_task(0.1"hud_msg")


Put this at the Beggining (under the plugin_init)

Hunter-Digital 07-30-2011 03:12

Re: HUD msg..
 
It doesn't matter where you place the functions.

Also, add "public" before client_putinserver or it won't work.

Quote:

Originally Posted by samba88 (Post 1521434)
merci..
but my questin is why my script dont show me my hud automatically

Because there's nothing calling it... you must hook an event or something to have it trigger at some point... public client_putinserver() is triggered when player enters server... but you're also sending the message to *all* players... so use something like this:

Code:

public client_putinserver(id)
{
    set_task(1.0, "hud_msg", id)
}

public hud_msg(id)
{
    set_hudmessage(255,0, 0, -1.0, 0.8, 2, 0.5, 8.0, 0.2, 1.0, 4);
    show_hudmessage(id, "Welcome !");
}


Krle 07-30-2011 07:02

Re: HUD msg..
 
Edited my post ^

Hey Hunter-Digital, can yo make my ShowHud option Shows to player right after he joins the server :S Because i have in ShowHud for both Classes... And can you make it to never disappears from HUD, because it only lasts 1 minute :)
Here take a look
PHP Code:

public ShowHud(id
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    { 
        
set_hudmessage(42255420.050.2506.060.0)
        
show_hudmessage(id"[Klasa : %s]^n[Level : %i]^n[Iskustvo : %i / %i]^n[Energija : %i]"CLASSES_CT[PlayerClassCT[id]], PlayerLevel[id], PlayerXP[id], LevelExperience[PlayerLevel[id]], get_user_health(id))
    }
    
    if (
cs_get_user_team(id)  == CS_TEAM_T)
    {
        
set_hudmessage(42255420.050.2506.060.0)
        
show_hudmessage(id"[Klasa : %s]^n[Level : %i]^n[Iskustvo : %i / %i]^n[Energija : %i]"CLASSES_T[PlayerClassT[id]], PlayerLevel[id], PlayerXP[id], LevelExperience[PlayerLevel[id]],  get_user_health(id))
    }


And here is the FULL code:
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <nvault>

#define MAXPLAYERS 32 /*No Weapon Drop On Death*/

#define WBOX "models/w_weaponbox.mdl" /*No Weapon Drop On Death*/

new const CLASSES_CT[][] = {
    
"None""Fast Avatar""Invisible Avatar""Low-Gravity Avatar"
}

new const 
CLASSES_T[][] = {
    
"None""Marinac""Komandant""Snajperista"
}

new const 
LevelExperience[] = {
    
0481632641282565121024
    
2048409681921638432768655361310722621445242881048576
}

new 
PlayerXP[33]
new 
PlayerLevel[33]
new 
PlayerClassCT[33]
new 
PlayerClassT[33]

new 
KillExpirience
new SaveExpirience
new g_Vault

new g_msgStatusIcon /*Buy Zone Remover*/

new bool:drop_locked /*No Weapon Drop*/

new g_entid[MAXPLAYERS 1/*No Weapon Drop On Death*/
new g_maxents /*No Weapon Drop On Death*/

public plugin_init()
{
    
register_plugin("Avatar Mod""0.4""Krle")
    
    
RegisterHam(Ham_Spawn"player""Beginning"1)
    
    
register_event("CurWeapon""CurWeapon""be""1=1")
    
register_event("DeathMsg""eDeath""a")
    
    
register_message(get_user_msgid("TextMsg"), "message_TextMsg"/*Win Message*/
    
    
g_msgStatusIcon get_user_msgid("StatusIcon"/*BuyZoneRemover*/
    
register_message(g_msgStatusIcon"msgStatusIcon"/*BuyZoneRemover*/
    
    
SaveExpirience register_cvar"xp_save""1")
    
KillExpirience register_cvar"xp_per_kill""20")
    
    
g_Vault nvault_open("AvatarMod")
    
    
register_clcmd("say /class""ChangeClass")
    
register_clcmd("say /xp""ShowHud")
    
register_clcmd("say /shop""Shop")
    
register_clcmd("say /tp""ThirdPersonView"/*Trece Lice*/
    
register_clcmd("say /fp""FirstPersonView"/*Prvo Lice*/
    
    
register_clcmd("say_team /class""ChangeClass")
    
register_clcmd("say_team /xp""ShowHud")
    
register_clcmd("say_team /shop""Shop")
    
register_clcmd("say_team /tp""ThirdPersonView"/*Trece Lice*/
    
register_clcmd("say_team /fp""FirstPersonView"/*Prvo Lice*/
    
    
register_clcmd("drop","drop",0,""/*No Weapon Drop*/
    
    
register_logevent("round_start"2"0=World triggered""1=Round_Start"/*No Weapon Drop*/
    
    
register_forward(FM_SetModel"forward_set_model"/*No Weapon Drop On Death*/
    
g_maxents get_global_int(GL_maxEntities/*No Weapon Drop On Death*/
    
    
set_task(30.0"Help")
}


/*=== ====== ======== ===*/
/*=== PLUGIN PRECACHE ===*/
/*=== ====== ======== ===*/
public plugin_precache()
{
    
precache_model("models/player/avatar/avatar.mdl")
    
precache_model("models/player/commander/commander.mdl")
    
precache_model("models/player/marine/marine.mdl")
    
    
precache_model("models/avatar_mod/v_soldier_ak47.mdl")
    
precache_model("models/avatar_mod/p_soldier_ak47.mdl")
    
precache_model("models/avatar_mod/v_soldier_deagle.mdl")
    
precache_model("models/avatar_mod/p_soldier_deagle.mdl")
    
precache_model("models/avatar_mod/v_soldier_m4a1.mdl")
    
precache_model("models/avatar_mod/p_soldier_m4a1.mdl")
    
precache_model("models/avatar_mod/v_soldier_awp.mdl")
    
precache_model("models/avatar_mod/p_soldier_awp.mdl")
    
    
precache_model("models/avatar_mod/v_avatar_knife.mdl")
    
    
precache_model("models/rpgrocket.mdl"/*ThirdPerson*/
}
/*=======================*/


public server_cfg()
{
    
server_cmd("sv_maxspeed 1600")
}


public 
eDeath()
{    
    new 
attacker read_data(1)
    new 
id read_data(2)
    
    if(
id != attacker)
    {
        
PlayerXP[attacker] += get_pcvar_num(KillExpirience)
    }
    
    if(
PlayerLevel[id] < 15)
    {
        while(
PlayerXP[attacker] >= LevelExperience[PlayerLevel[attacker]])
        {
            
PlayerLevel[attacker] += 1
            client_print
(attackerprint_chat"[Avatar Mod] Cestitamo, sada ste level ^3%i !"PlayerLevel[id])
        }
        
ShowHud(attacker)
        
SaveData(attacker)
    }
    return 
PLUGIN_HANDLED 
}

/*=== ==== == = === ===== ===*/
/*=== SHOW XP & LVL STATS ===*/
/*=== ==== == = === ===== ===*/
public ShowHud(id
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    { 
        
set_hudmessage(42255420.050.2506.060.0)
        
show_hudmessage(id"[Klasa : %s]^n[Level : %i]^n[Iskustvo : %i / %i]^n[Energija : %i]"CLASSES_CT[PlayerClassCT[id]], PlayerLevel[id], PlayerXP[id], LevelExperience[PlayerLevel[id]], get_user_health(id))
    }
    
    if (
cs_get_user_team(id)  == CS_TEAM_T)
    {
        
set_hudmessage(42255420.050.2506.060.0)
        
show_hudmessage(id"[Klasa : %s]^n[Level : %i]^n[Iskustvo : %i / %i]^n[Energija : %i]"CLASSES_T[PlayerClassT[id]], PlayerLevel[id], PlayerXP[id], LevelExperience[PlayerLevel[id]],  get_user_health(id))
    }
}
/*===========================*/


/*=== ==== ===*/
/*=== SHOP ===*/
/*=== ==== ===*/
public Shop(id
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        new 
menu menu_create ("Shop:""Shop_Handle")
        
menu_additem(menu"Eywin Blagoslov \r[ Dodaje \y300 \rHealth Points \r] \yCena: \r1000$")
        
menu_additem(menu"Iskustvo \r[ Dodaje \y100 \rExperience Poena \r] \yCena: \r5000$")
        
menu_additem(menu"Super Iskustvo \r[ Dodaje \y300 \rExperience Poena ] \yCena: \r10000$")
        
        
menu_display(idmenu)
    }
    
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        
        new 
menu menu_create ("Shop:""Shop_Handle")
        
menu_additem(menu"Aspirin \r[ Dodaje \y30 \rHelti ] \yCena: \r1000$")
        
menu_additem(menu"Iskustvo \r[ Dodaje \y100 \rExperience Poena ] \yCena: \r5000$")
        
menu_additem(menu"Super Iskustvo \r[ Dodaje \y300 \rExperience Poena ] \yCena: \r10000$")
        
        
menu_display(idmenu)
    }
}

public 
Shop_Handle(idmenuitem
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        if(
item == MENU_EXIT
        {
            
menu_destroy(menu)
            
ColorChat(idGREEN"[Avatar Mod Shop] ^1Zatvaram menu...")
        }
        
menu_display(idmenu)
        switch(
item
        {
            case 
0
            {
                if(
cs_get_user_money(id) < 1000
                {
                    
ColorChat(idGREEN"[Avatar Mod Shop] ^1Nemas dovoljno novca za ^3Eywin Blagoslov")
                    return 
PLUGIN_CONTINUE
                
}
                
cs_set_user_money(idcs_get_user_money(id) - 1000)
                
set_user_health(idget_user_health(id) + 300)
                
ColorChat(idGREEN"[Avatar Mod Shop] ^1Kupio si ^3Eywin Blagoslov")
            }
            
            case 
1
            {
                if(
cs_get_user_money(id) < 4000
                {
                    
ColorChat(idGREEN"[Avatar Mod Shop] ^1Nemas doboljno novca za ^3Iskustvo")
                    return 
PLUGIN_CONTINUE
                
}
                
cs_set_user_money(idcs_get_user_money id ) - 4000)
                
PlayerXP[id] += 100
                ColorChat
(idGREEN"[Avatar Mod Shop] ^1Kupio si ^3Iskustvo")
                
eDeath()
            }
            case 
2
            {
                if(
cs_get_user_moneyid ) < 10000
                {
                    
ColorChat(idGREEN"[Avatar Mod Shop] ^1Nemas dovoljno novca za ^3Super Iskustvo")
                    return 
PLUGIN_CONTINUE
                
}
                
cs_set_user_money(idcs_get_user_money(id) - 10000)
                
PlayerXP[id] += 300
                ColorChat
(idGREEN"[Avatar Mod Shop] ^1Kupio si ^3Super Iskustvo")
                
eDeath()
            }
        }
    }
    
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        if(
item == MENU_EXIT
        {
            
menu_destroy(menu)
            
ColorChat(idGREEN"[Avatar Mod Shop] ^1Zatvaram menu...")
        }
        
menu_display(idmenu)
        switch(
item
        {
            case 
0
            {
                if(
cs_get_user_money(id) < 1000
                {
                    
ColorChat(idGREEN"[Avatar Mod Shop] ^1Nemas dovoljno novca za ^3Aspirin" )
                    return 
PLUGIN_CONTINUE
                
}
                
cs_set_user_money(idcs_get_user_money(id) - 1000)
                
set_user_health(idget_user_health(id) + 30)
                
ColorChat(idGREEN"[Avatar Mod Shop] ^1Kupio si ^3Aspirin")
            }
            
            case 
1
            {
                if(
cs_get_user_money(id) < 4000
                {
                    
ColorChat(idGREEN"[Avatar Mod Shop] ^1Nemas dovoljno novca za ^3Iskustvo" )
                    return 
PLUGIN_CONTINUE
                
}
                
cs_set_user_money(idcs_get_user_money(id) - 4000)
                
PlayerXP[id] += 300
                ColorChat
(idGREEN"[Avatar Mod Shop] ^1Kupio si ^3Iskustvo")
                
eDeath()
            }
            case 
2
            {
                if(
cs_get_user_money(id) < 10000
                {
                    
ColorChat(idGREEN"[Avatar Mod Shop] ^1Nemas dovoljno novca za ^3Super Iskustvo" )
                    return 
PLUGIN_CONTINUE
                
}
                
cs_set_user_money(idcs_get_user_money(id) - 10000)
                
PlayerXP[id] += 300
                ColorChat
(idGREEN"[Avatar Mod Shop] ^1Kupio si ^3Super Iskustvo" )
                
eDeath()
            }
        }
    }
    return 
PLUGIN_CONTINUE
}
/*============*/


public ChangeClass(id
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        new 
menu menu_create("Izaberi svog Avatara:""ChangeClass_Handle")
        
menu_additem(menu"Normal Avatar \r[ HEALTH+ ]""1"0)
        
menu_additem(menu"Invisible Avatar \r[ INVISIBLE+, HEALTH--- ]""2"0)
        
menu_additem(menu"Low-Gravity Avatar \r[ GRAVITY-, HEALTH- ]""3"0)
        
        
menu_setprop(menu MPROP_EXIT MEXIT_ALL)
        
menu_display(id menu 0)
    }
    
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        new 
menu menu_create("Izaberi svog Vojnika:""ChangeClass_Handle")
        
menu_additem(menu"Marinac \r[ \yDeagle \r]""1"0)
        
menu_additem(menu"Komandant \r[ \yM4A1 \r+ \yAK47 \r]""2"0)
        
menu_additem(menu"Snajperista \r[ \yAWP \r]""3"0)
        
        
menu_setprop(menu MPROP_EXIT MEXIT_ALL)
        
menu_display(id menu 0)
    }
}


public 
ChangeClass_Handle(idmenuitem/*Sta se desava kad igrac izabere klasu*/
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        if(
item == MENU_EXIT)
        {
            
menu_destroy(menu)
            
ColorChat(idGREEN"[Avatar Mod] ^1Zavaram menu...")
        }
        
        new 
szCommand[6]
        new 
szName[64]
        new 
access
        
new callback
        
        menu_item_getinfo 
(menuitemaccessszCommand5szName63callback)
        
        new 
str_to_num(szCommand)
        if(
PlayerClassCT[id] != i
        {
            
PlayerClassCT[id] = i
            ColorChat 
idGREEN"[Avatar Mod] ^1Sada si ^3%s"CLASSES_CT[i])
        } 
        else
        {
            
ColorChat idGREEN"[Avatar Mod] ^1Vec si ^3%s"CLASSES_CT[i])
        }
        
        
menu_destroy(menu)
        
ColorChat idGREEN"[Avatar Mod] ^1Zatvaram menu..." )
    }
    
    if ( 
cs_get_user_team(id) == CS_TEAM_T)
    {
        if ( 
item == MENU_EXIT )
        {
            
menu_destroy(menu)
            
ColorChat(idGREEN"[Avatar Mod] ^1Zavaram menu")
        }
        
        new 
szCommand[6]
        new 
szName[64]
        new 
access
        
new callback
        
        menu_item_getinfo
(menuitemaccessszCommand5szName63callback)
        
        new 
str_to_num(szCommand)
        
        if(
PlayerClassT[id] != i
        {
            
PlayerClassT[id] = i;
            
ColorChat(idGREEN"[Avatar Mod] ^1Sada si ^3%s"CLASSES_T[i])
        }
        
        else
        {
            
ColorChat(idGREEN"[Avatar Mod] ^1Vec si ^3%s"CLASSES_T[i])
        }
        
        
menu_destroy(menu)
        
ColorChat(idGREEN"[Avatar Mod] ^1Zatvaram menu...")
    }
    return 
PLUGIN_CONTINUE
}


/*=== ====== ===== ===*/
/*=== PLAYER SPAWN ===*/
/*=== ====== ===== ===*/
public Beginning(id)
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        
        if(!
is_user_alive(id) || !is_user_connected(id))
        {
            return 
PLUGIN_CONTINUE
        
}
        
        if(!
PlayerClassCT[id])
        {
            
ChangeClass(id)
        }
        
        if(
PlayerClassCT[id] == 0)
        {
            
strip_user_weapons(id)
            
cs_set_user_model(id"avatar")
        }
        
        if(
PlayerClassCT[id] == 1)
        {
            
strip_user_weapons(id)
            
set_user_health(id2400)
            
give_item(id"weapon_knife")
            
cs_set_user_model(id"avatar")
            
set_user_gravity(id0.75)
            
set_user_rendering(id)
        }
        
        if(
PlayerClassCT[id] == 2
        {
            
strip_user_weapons(id)
            
set_user_health(id50)
            
give_item(id"weapon_knife")
            
cs_set_user_model(id"avatar")
            
set_user_gravity(id0.75)
            
set_user_rendering(idkRenderFxGlowShell000kRenderTransColor20)
        }
        
        if(
PlayerClassCT[id] == 3)
        {
            
strip_user_weapons(id)
            
set_user_health(id1800)
            
give_item(id"weapon_knife")
            
cs_set_user_model(id"avatar")
            
set_user_gravity(id0.5)
            
set_user_rendering(id)
        }
    }
    
    if (
cs_get_user_team(id) == CS_TEAM_T)
    {
        if(!
is_user_alive(id) || !is_user_connected(id))
        {
            return 
PLUGIN_CONTINUE
        
}
        
        if(!
PlayerClassT[id])
        {
            
ChangeClass(id)
        }
        
        if(
PlayerClassT[id] == 0)
        {
            
strip_user_weapons(id)
            
cs_set_user_model(id"marine")
        }
        if(
PlayerClassT[id] == 1
        {
            
strip_user_weapons(id)
            
give_item(id"weapon_deagle")
            
cs_set_user_bpammo(idCSW_DEAGLE93)
            
cs_set_user_model(id"marine")
            
set_user_rendering(id)
        }
        
        if(
PlayerClassT[id] == 2
        {
            
strip_user_weapons(id)
            
give_item(id"weapon_m4a1")
            
give_item(id"weapon_ak47")
            
cs_set_user_bpammo(idCSW_M4A1120)
            
cs_set_user_bpammo(idCSW_AK47120)
            
cs_set_user_model(id"commander")
            
set_user_rendering(id)
        }
        
        if(
PlayerClassT[id] == 3)
        {
            
strip_user_weapons(id)
            
give_item(id"weapon_awp")
            
cs_set_user_bpammo(idCSW_AWP40)
            
cs_set_user_model(id"marine")
            
set_user_rendering(id)
        }
    }
    return 
PLUGIN_CONTINUE
}
/*====================*/


/*=== ========== ==== ====== ======= ===*/
/*=== HAPPENINGS WHEN CLIENT CONNECT ===*/
/*=== ========== ==== ====== ======= ===*/
public client_connect(id)
{
    if(
get_pcvar_num(SaveExpirience) == 1)
    {
        
LoadData(id)
    }
}
/*======================================*/


/*=== ========== ==== ====== ========== ===*/
/*=== HAPPENINGS WHEN CLIENT DISCONNECT ===*/
/*=== ========== ==== ====== ========== ===*/
public client_disconnect(id
{
    if(
get_pcvar_num(SaveExpirience) == 1)
    {
        
SaveData(id)
    }
    
    
PlayerXP[id] = 0
    PlayerLevel
[id] = 0
    PlayerClassCT
[id] = 0
    PlayerClassT
[id] = 0
}
/*=========================================*/


/*=== ==== == = === = ===*/
/*=== SAVE XP & LVL'S ===*/
/*=== ==== == = === = ===*/
public SaveData id )  
{
    new 
AuthID[35]
    
get_user_authid(idAuthID34)
    
    new 
vaultkey[64]
    new 
vaultdata[256]
    
    
format(vaultkey63"%s-Mod"AuthID)
    
format(vaultdata255"%i#%i#"PlayerXP[id], PlayerLevel[id])
    
nvault_set(g_Vaultvaultkeyvaultdata)
    
    return 
PLUGIN_CONTINUE
}
/*=======================*/


/*=== ==== == = === = ===*/
/*=== LOAD XP & LVL'S ===*/
/*=== ==== == = === = ===*/
public LoadData(id
{
    new 
AuthID[35]
    
get_user_authid(idAuthID34)
    
    new 
vaultkey[64]
    new 
vaultdata[256]
    
    
format(vaultkey63"%s-Mod"AuthID)
    
format(vaultdata255"%i#%i#"PlayerXP[id], PlayerLevel[id])
    
nvault_get(g_Vaultvaultkeyvaultdata,255)
    
replace_all(vaultdata255"#"" ")
    
    new 
playerxp[32]
    new 
playerlevel[32]
    
    
parse(vaultdataplayerxp31playerlevel31)
    
    
PlayerXP[id] = str_to_num(playerxp)
    
PlayerLevel[id] = str_to_num(playerlevel)
    
    return 
PLUGIN_CONTINUE
}
/*=======================*/


public CurWeapon(id)
{
    if(
PlayerClassCT[id] == 1)
    {
        if (
get_user_weapon(id) == CSW_KNIFE)
        {
            
entity_set_string(idEV_SZ_viewmodel"models/avatar_mod/v_avatar_knife.mdl")
        }
    }
    
    if(
PlayerClassCT[id] == 2)
    {
        if(
get_user_weapon(id) == CSW_KNIFE)
        {
            
entity_set_string(idEV_SZ_viewmodel"models/avatar_mod/v_avatar_knife.mdl")
        }
    }
    
    if(
PlayerClassCT[id] == 3)
    {
        if(
get_user_weapon(id) == CSW_KNIFE)
        {
            
entity_set_string(idEV_SZ_viewmodel"models/avatar_mod/v_avatar_knife.mdl")
        }
    }
    
    if(
PlayerClassT[id] == 1)
    {
        if(
get_user_weapon(id) == CSW_DEAGLE)
        {
            
entity_set_string(idEV_SZ_viewmodel"models/avatar_mod/v_soldier_deagle.mdl")
            
entity_set_string(idEV_SZ_weaponmodel"models/avatar_mod/p_soldier_deagle.mdl")
        }
    }
    
    if(
PlayerClassT[id] == 2)
    {
        if(
get_user_weapon(id) == CSW_M4A1)
        {
            
entity_set_string(idEV_SZ_viewmodel"models/avatar_mod/v_soldier_m4a1.mdl")
            
entity_set_string(idEV_SZ_weaponmodel"models/avatar_mod/p_soldier_m4a1.mdl")
        }
        if(
get_user_weapon(id) == CSW_AK47)
        {
            
entity_set_string(idEV_SZ_viewmodel"models/avatar_mod/v_soldier_ak47.mdl")
            
entity_set_string(idEV_SZ_weaponmodel"models/avatar_mod/p_soldier_ak47.mdl")
        }
    }
    
    if(
PlayerClassT[id] == 3)
    {
        if(
get_user_weapon(id) == CSW_AWP)
        {
            
entity_set_string(idEV_SZ_viewmodel"models/avatar_mod/v_soldier_awp.mdl")
            
entity_set_string(idEV_SZ_weaponmodel"models/avatar_mod/p_soldier_awp.mdl")
        }
    }
}

/*=== === ======= ===*/
/*=== WIN MESSAGE ===*/
/*=== === ======= ===*/
public message_TextMsg(const MsgId, const MsgDest, const MsgEntity)
{
    static 
message[32]
    
get_msg_arg_string(2messagecharsmax(message))
    
    if(
equal(message"#Terrorists_Win"))
    {
        
set_hudmessage(25500, -1.00.3006.012.0)
        
show_hudmessage(0"Vijnici su dobili bitku !")
    }
    else if(
equal(message"#CTs_Win"))
    {
        
set_hudmessage(0170255, -1.00.3006.012.0)
        
show_hudmessage(0"Avatari su dobili bitku !")
    }
}
/*===================*/


/*=== === ==== ======= ===*/
/*=== BUY ZONE REMOVER ===*/
/*=== === ==== ======= ===*/
public msgStatusIcon(msgidmsgdestid)
{
    static 
szIcon[8]
    
get_msg_arg_string(2szIcon7)
    
    if(
equal(szIcon"buyzone") && get_msg_arg_int(1))
    {
        
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0))
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}
/*========================*/


/*=== ===== ====== ==== ===*/
/*=== THIRD PERSON VIEW ===*/
/*=== ===== ====== ==== ===*/
public ThirdPersonView(id)
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        
set_view(idCAMERA_3RDPERSON)
    }
}

public 
FirstPersonView(id)
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        
set_view(id,CAMERA_NONE)
    }
}
/*=========================*/


/*=== == ====== ==== ===*/
/*=== NO WEAPON DROP ===*/
/*=== == ====== ==== ===*/
public round_start()
{
    
drop_locked true
}

public 
drop(id)
{
    if (
drop_locked)
    { 
        
client_print(idprint_center"Nemozes da bacas oruzija !")
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}
/*======================*/


/*=== == ====== ==== == ===== ===*/
/*=== NO WEAPON DROP ON DEATH ===*/
/*=== == ====== ==== == ===== ===*/
public forward_set_model(entidmodel[])
{
    if (!
is_valid_ent(entid) || !equal(modelWBOX9))
    {
        return 
FMRES_IGNORED
    
}
    
    new 
id entity_get_edict(entidEV_ENT_owner)
    if (!
id || !is_user_connected(id) || is_user_alive(id))
    {
        return 
FMRES_IGNORED
    
}
    
    if (
equal(modelWBOX))
    {
        
g_entid[id] = entid
        
return FMRES_IGNORED
    
}
    
    if (
entid != g_entid[id])
    {
        return 
FMRES_IGNORED
    
}
    
    
g_entid[id] = 0
    
    
for (new 1<= g_maxents; ++i
    {
        if (
is_valid_ent(i) && entid == entity_get_edict(iEV_ENT_owner)) 
        {
            
kill_entity(entid)
            
kill_entity(i)
        }
    }
    return 
FMRES_IGNORED
}

stock kill_entity(id)
{
    
entity_set_int(idEV_INT_flagsentity_get_int(idEV_INT_flags)|FL_KILLME)
}
/*===============================*/


/*=== ==== ==== ======== ===*/
/*=== HELP CHAT MESSAGES ===*/
/*=== ==== ==== ======== ===*/
public Help()
{
    switch(
random(3))
    {
        case 
0ColorChat(0GREEN"[Avatar Mod] ^1Da vidis stats, ^3say: /xp")
            case 
1ColorChat(0GREEN"[Avatar Mod] ^1Da promenis klasu ^3say: /class")
            case 
2ColorChat(0GREEN"[Avatar Mod] ^1Da otvorite Avatar Shop ^3say: /shop")
            case 
3ColorChat(0GREEN"[Avatar Mod] ^1Ako si Avatar, ^3say: /tp ^1da prebacis pogled u trece lice")
        }
    
set_task(36.0"Help")
}
/*==========================*/ 

Thanks
This is not only my code :nono:, lots of people helped

Hunter-Digital 07-30-2011 08:17

Re: HUD msg..
 
You must send it constantly, each second or something, depends on how frequent you wait it to update.
I'd also suggest you use sync hud message for that because it's more reliable.
http://www.amxmodx.org/funcwiki.php?go=func&id=1064

Krle 07-30-2011 09:12

Re: HUD msg..
 
I knew it had something to do with sync HUD... However, thanks for the advice :)


All times are GMT -4. The time now is 03:20.

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