AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hud message help (https://forums.alliedmods.net/showthread.php?t=241120)

Legendp 05-28-2014 08:30

Hud message help
 
delete

aron9forever 05-28-2014 09:07

Re: Hud message help
 
Quote:

Originally Posted by Legendp (Post 2143472)
PHP Code:

#include <amxmodx> 
#include <hamsandwich> 
#include <engine> 

#define VERSION "1.0" 

new Float:MinsMaxs[2][3][3

new 
iTotalZones 

public plugin_init() { 
    
register_plugin("NoKillZones",VERSION,"Firippu"
     
    new 
file[40],configsdir[24
    
get_localinfo("amxx_configsdir",configsdir,23
    
format(file,39,"%s/NoKillZones.ini",configsdir
     
    new 
fh fopen(file,"rt"
    if(!
fh) { 
        return 
PLUGIN_CONTINUE 
    

     
    new 
szMap[32
    
get_mapname(szMap,31
     
    new 
i,szMapName[32],szTotalZones[3
    while(!
feof(fh)) { 
        static 
szBuffer[49
         
        
fgets(fh,szBuffer,charsmax(szBuffer)) 
         
        if(!
equali(szMap,szMapName)) { 
            
parse(szBuffer,szMapName,charsmax(szMap)) 
             
            if(
equali(szMap,szMapName)) { 
                
szMap szMapName 
            

        } else if(
str_to_num(szTotalZones) == 0) { 
            
parse(szBuffer,szTotalZones,charsmax(szTotalZones)) 
             
            
iTotalZones str_to_num(szTotalZones
        } else if(
iTotalZones>i) { 
            static 
szMins0[8],szMins1[8],szMins2[8],szMaxs0[8],szMaxs1[8],szMaxs2[8
             
            
parse(szBuffer,szMins0,charsmax(szMins0),szMins1,charsmax(szMins1),szMins2,charsmax(szMins2),szMaxs0,charsmax(szMaxs0),szMaxs1,charsmax(szMaxs1),szMaxs2,charsmax(szMaxs2)) 
             
            
MinsMaxs[0][i][0] = str_to_float(szMins0); MinsMaxs[0][i][1] = str_to_float(szMins1); MinsMaxs[0][i][2] = str_to_float(szMins2
            
MinsMaxs[1][i][0] = str_to_float(szMaxs0); MinsMaxs[1][i][1] = str_to_float(szMaxs1); MinsMaxs[1][i][2] = str_to_float(szMaxs2
             
            
i++ 
        } 
    } 
     
    
fclose(fh
     
    if(
iTotalZones != 0) { 
        
RegisterHam(Ham_TakeDamage,"player","fwdTakeDmg"
    } 
     
    return 
PLUGIN_CONTINUE 


public 
fwdTakeDmg(iVictim,iInflictor,iAttacker) { 
    static 
Float:vVictimOrigin[3],Float:vAttackerOrigin[3
     
    
entity_get_vector(iVictim,EV_VEC_origin,vVictimOrigin
    
entity_get_vector(iAttacker,EV_VEC_origin,vAttackerOrigin
     
    for(new 
i=0i<iTotalZonesi++) { 
        if(
CheckZone(i,iVictim,iAttacker,vVictimOrigin,vAttackerOrigin) != 0) { 
            
entity_set_vector(iVictim,EV_VEC_punchangle,Float:{0.0,0.0,0.0}) 
             
            return 
HAM_SUPERCEDE 
        

    } 
     
    return 
HAM_IGNORED 


public 
CheckZone(iZone,iVictim,iAttacker,Float:vVictimOrigin[3],Float:vAttackerOrigin[3]) { 
    if(
vVictimOrigin[0]>MinsMaxs[0][iZone][0] && vVictimOrigin[0]<MinsMaxs[1][iZone][0
    && 
vVictimOrigin[1]>MinsMaxs[0][iZone][1] && vVictimOrigin[1]<MinsMaxs[1][iZone][1
    && 
vVictimOrigin[2]>MinsMaxs[0][iZone][2] && vVictimOrigin[2]<MinsMaxs[1][iZone][2
    || 
vAttackerOrigin[0]>MinsMaxs[0][iZone][0] && vAttackerOrigin[0]<MinsMaxs[1][iZone][0
    && 
vAttackerOrigin[1]>MinsMaxs[0][iZone][1] && vAttackerOrigin[1]<MinsMaxs[1][iZone][1
    && 
vAttackerOrigin[2]>MinsMaxs[0][iZone][2] && vAttackerOrigin[2]<MinsMaxs[1][iZone][2]) { 
        
engclient_print(iAttacker,engprint_center,"You can not do damage here"
        
engclient_print(iVictim,engprint_center,"You are protected here"
         
        return 

    

     
    return 



Hi;
I want to change the on-screen messages hud message (I'm sorry for bad english)
These:
engclient_print(iAttacker,engprint_center,"You can not do damage here")
engclient_print(iVictim,engprint_center,"You are protected here")



okay? change the message between the " " and you're done?
what exactly do you want?

aron9forever 05-28-2014 09:33

Re: Hud message help
 
Quote:

Originally Posted by Legendp (Post 2143503)
PHP Code:

engclient_print(iAttacker,engprint_center,"You can not do damage here"
        
engclient_print(iVictim,engprint_center,"You are protected here"

I want to do Hud message. Red or another color

easiest method is this

set_hudmessage(RED#, GREEN#, BLUE#, x#, y#);
show_hudmessage(id, "I am a hud message");

but I would advise you to use hudsync so channels don't overlap

you can easily create code using amxx studio with instant preview so you don't have to mess around with coordinates and colors


All times are GMT -4. The time now is 09:37.

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