AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Shows weapons from every player when it shouldnt (https://forums.alliedmods.net/showthread.php?t=82255)

RULEEwasdsa 12-19-2008 21:04

Shows weapons from every player when it shouldnt
 
when you are carryin a weapon, it says the name correctly, but when any other player reloads, i see in my screen the msg Reloading[the other guy weapon] when that shouldnt be there.


Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>

#define PLUGIN "Simple Weapon Info"
#define VERSION "1.0"
#define AUTHOR "[L]ambert."

new HUDSYNC
new wpname[32]
new bool:reload[33] = false



public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    HUDSYNC = CreateHudSyncObj();
    register_event("CurWeapon", "RegisWeapon", "be", "1=1")
   
}

public RegisWeapon(id){
   
    new weapon = get_user_weapon(id)
   
   
    switch(weapon)
    {
        case CSW_P228:
        wpname = "p228"
        case CSW_SCOUT:
        wpname = "pinche"
        case CSW_XM1014:
        wpname = "XM1014"
        case CSW_MAC10:
        wpname = "mac10"
        case CSW_AUG:
        wpname = "AUG"
        case CSW_ELITE:
        wpname = "Dual"
        case CSW_FIVESEVEN:
        wpname = "Fiveseven"
        case CSW_UMP45:
        wpname = "ump45"
        case CSW_SG550:
        wpname = "sg550"
        case CSW_GALIL:
        wpname = "Galil"
        case CSW_FAMAS:
        wpname = "Famas"
        case CSW_USP:
        wpname = "Usp"
        case CSW_MP5NAVY:
        wpname = "mp5"
        case CSW_M249:
        wpname = "m249"
        case CSW_M3:
        wpname = "m3"
        case CSW_M4A1:
        wpname = "Colt"
        case CSW_TMP:
        wpname = "Tmp"
        case CSW_G3SG1:
        wpname = "Repe"
        case CSW_DEAGLE:
        wpname = "Desert"
        case CSW_SG552:
        wpname = "sg552"
        case CSW_AK47:
        wpname = "ak47"
        case CSW_KNIFE:
        wpname = "Cuchi"
        case CSW_P90:
        wpname = "p90"
        case CSW_GLOCK18:
        wpname = "Glock"
        case CSW_AWP:
        wpname = "Awp"
        default:
        return
    }
   
    show_msg(id)
   
    return
   
   
}

public client_PreThink(id){
   
    new ammo
    new clip
    new weapon = get_user_weapon(id,clip,ammo)
   
    if(weapon != CSW_KNIFE){
       
        if(clip == 0 && ammo > 0){
            show_remsg(id)
        }
        else if(clip == 0 && ammo == 0){
            show_empty(id)
        }
        if(get_user_button(id) & IN_RELOAD && reload[id] == false){
           
            reload[id] = true
            show_remsg(id)
           
        }
    }
   
}

public show_msg(id){
    set_hudmessage(0, 255, 0, 0.95, 0.0, 0, 6.0, 12.0)
    ShowSyncHudMsg(id, HUDSYNC, "%s", wpname)
   
}

public show_remsg(id){
    set_hudmessage(0, 255, 0, 0.95, 0.0, 0, 6.0, 12.0)
    ShowSyncHudMsg(id, HUDSYNC, "[Reloading] %s", wpname)
    reload[id] = false
}

public show_empty(id){
    set_hudmessage(0, 255, 0, 0.95, 0.0, 0, 6.0, 12.0)
    ShowSyncHudMsg(id, HUDSYNC, "[Empty] %s", wpname)
}


Starsailor 12-19-2008 21:35

Re: Shows weapons from every player when it shouldnt
 
who is lambert?

Exolent[jNr] 12-19-2008 21:41

Re: Shows weapons from every player when it shouldnt
 
Use the clear hud function that goes with the hud sync you are using before you show the message.

RULEEwasdsa 12-19-2008 22:31

Re: Shows weapons from every player when it shouldnt
 
Quote:

Originally Posted by Starsailor (Post 730137)
who is lambert?

i am ¬¬ martin , ya sabes que soi yo (you know that)

Starsailor 12-19-2008 22:39

Re: Shows weapons from every player when it shouldnt
 
Quote:

Originally Posted by Exolent[jNr] (Post 730139)
Use the clear hud function that goes with the hud sync you are using before you show the message.


can you give an example code? :)

RULEEwasdsa 12-19-2008 22:55

Re: Shows weapons from every player when it shouldnt
 
like this ?
Code:

public show_msg(id){
    ClearSyncHud(id, HUDSYNC)
    set_hudmessage(0, 255, 0, 0.95, 0.0, 0, 6.0, 12.0)
    ShowSyncHudMsg(id, HUDSYNC, "%s", wpname)
   
}

if this is the correct code, it doesnt work :S


All times are GMT -4. The time now is 16:12.

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