Raised This Month: $47 Target: $400
 11% 

Solved Messages/Tries/ArrayPush/Screenshake/Ent Exists/nVault Multiple Info/HAM_ | FMRES_


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 12-31-2016 , 13:27   Messages/Tries/ArrayPush/Screenshake/Ent Exists/nVault Multiple Info/HAM_ | FMRES_
Reply With Quote #1

Hey, I need some help with these..

1. Messages , I checked in 2 different ZP weapons for the fire color and the methods of the two weapons were different like, in MP5 Gold it's this code
PHP Code:
public make_tracer(id)
{
    if (
get_pcvar_num(cvar_goldbullets))
    {
        new 
clip,ammo
        
new wpnid get_user_weapon(id,clip,ammo)
        new 
pteam[16]
        
        
get_user_team(idpteam15)
        
        if ((
bullets[id] > clip) && (wpnid == CSW_MP5NAVY) && g_Hasmp5navy[id]) 
        {
            new 
vec1[3], vec2[3]
            
get_user_origin(idvec11// origin; your camera point.
            
get_user_origin(idvec24// termina; where your bullet goes (4 is cs-only)
            
            
            //BEAMENTPOINTS
            
message_beginMSG_BROADCAST,SVC_TEMPENTITY)
            
write_byte (0)     //TE_BEAMENTPOINTS 0
            
write_coord(vec1[0])
            
write_coord(vec1[1])
            
write_coord(vec1[2])
            
write_coord(vec2[0])
            
write_coord(vec2[1])
            
write_coord(vec2[2])
            
write_shortm_spriteTexture )
            
write_byte(1// framestart
            
write_byte(5// framerate
            
write_byte(2// life
            
write_byte(10// width
            
write_byte(0// noise
            
write_byte255 )     // r, g, b
            
write_byte215 )       // r, g, b
            
write_byte)       // r, g, b
            
write_byte(200// brightness
            
write_byte(150// speed
            
message_end()
        }
    
        
bullets[id] = clip
    
}
    

And in plasma gun,
PHP Code:
public fw_TraceAttack(iEntiAttackerFloat:flDamageFloat:fDir[3], ptriDamageType)
{
    if(!
is_user_alive(iAttacker))
        return

    new 
g_currentweapon get_user_weapon(iAttacker)

    if(
g_currentweapon != CSW_MAC10) return
    
    if(!
g_has_plasmagun[iAttacker]) return

    static 
Float:flEnd[3]
    
get_tr2(ptrTR_vecEndPosflEnd)
    
    if(
iEnt)
    {
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_DECAL)
        
engfunc(EngFunc_WriteCoordflEnd[0])
        
engfunc(EngFunc_WriteCoordflEnd[1])
        
engfunc(EngFunc_WriteCoordflEnd[2])
        
write_byte(GUNSHOT_DECALS[random_num (0sizeof GUNSHOT_DECALS -1)])
        
write_short(iEnt)
        
message_end()
    }
    else
    {
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_SPRITE)
        
engfunc(EngFunc_WriteCoordflEnd[0])
        
engfunc(EngFunc_WriteCoordflEnd[1])
        
engfunc(EngFunc_WriteCoordflEnd[2])
        
write_short(sprexp)
        
write_byte(10)
        
write_byte(200)
        
message_end()    
    }
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY )
    
write_byte(TE_BEAMENTPOINT)
    
write_short(iAttacker 0x1000)
    
engfunc(EngFunc_WriteCoordflEnd[0])
    
engfunc(EngFunc_WriteCoordflEnd[1])
    
engfunc(EngFunc_WriteCoordflEnd[2])
    
write_short(g_beamSpr)
    
write_byte(0// framerate
    
write_byte(0// framerate
    
write_byte(1// life
    
write_byte(20)  // width
    
write_byte(0)// noise
    
write_byte(110)// r, g, b
    
write_byte(251)// r, g, b
    
write_byte(110)// r, g, b
    
write_byte(200)    // brightness
    
write_byte(5)    // speed
    
message_end()

Can somebody explain how can I change the fire color, put a tracer line (like thunderbolt) and change bullet colors?

2. How would I check if an entity exists?


3. Can somebody explain the FMRES_ and HAM_ returns?


4. I wanna know about these but I just can't learn anything
PHP Code:
TrieSetCell(Trie:handle, const key[], any:value); 
PHP Code:
native TrieSetString(Trie:handle, const key[], const value[]);
native TrieSetArray(Trie:handle, const key[], const any:buffer[], size);

native ArrayPushCell(Array:whichany:input);
native ArrayPushArray(Array:which, const any:input[]);
native ArraySetString(Array:whichitem, const input[]); 
5. What can Arrays be used for ? Like I saw in the zp_register_extra_item native, there was ArrayPushCell and some other natives, why has Mercylezz used them?

6. What's the best way of finding Spawn origin? Just an idea : Hooking ham_spawn and using get_user_origin?

7. How would I save in nVault multiple infos like,
name steamID points level


8. Can somebody explain the message part, what does each of write_short's do?
PHP Code:
#include <amxmodx> 
#include <cstrike>

public plugin_init()
{
    
register_plugin("xx""1.0""xx")
    
register_clcmd("say /shake""shakescreen");
}

public 
shakescreen(id)
{
    
    if(
is_user_alive(id)) {
        
EarthQuake(id
    }
    
}  

public 
EarthQuake(id)
{
    new 
iPlayers[32], iPlayerCountiplayer
    
new Screen get_user_msgid("ScreenShake")
    
    
get_players(iPlayersiPlayerCount"a"
    for(
0iPlayerCounti++)
    {
        
player iPlayers[i]
        
        
        
message_begin(MSG_ONEScreen,{0,0,0}, player)
        
write_short(255<< 14 )
        
write_short(10 << 14)
        
write_short(255<< 14)
        
message_end()
    }

Thanks.. !
__________________

Last edited by edon1337; 01-23-2017 at 15:23.
edon1337 is offline
Send a message via Skype™ to edon1337
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-31-2016 , 14:17   Re: Messages/Tries/ArrayPush/Screenshake/Ent Exists/nVault Multiple Info/HAM_ | FMRES
Reply With Quote #2

If you search, you will find the answers.
8.https://wiki.alliedmods.net/Half-Life_1_Game_Events
7.Format a string so it contains all the data you need, then use steamid as key.
6.What do you mean? Finding the origin of the place where player spawn?
4,5.https://forums.alliedmods.net/showthread.php?t=249602
https://forums.alliedmods.net/showthread.php?t=201872
3.http://amxmodx.org/api/fakemeta_const
http://amxmodx.org/api/ham_const
2.Search for that specific entity(https://wiki.alliedmods.net/Finding_entities_(amx_mod_x)) and check if the returned index is for a valid entity(pev_valid)
__________________
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-01-2017 , 09:18   Re: Messages/Tries/ArrayPush/Screenshake/Ent Exists/nVault Multiple Info/HAM_ | FMRES
Reply With Quote #3

8. Damn thank you! I never knew about this site.. What's amplitude and frequency btw?
7. An example please?
6. I meant, how to find the spawn origin, in any map.. I just gave you an idea, like to hook the Ham_Spawn and use get_user_origin, but I need to hear more ideas..
4|5. So the point of Arrays is to use them to insert/retrieve data?
3. Can you explain with your words? So what is PLUGIN_CONTINUE in HAM and FM and what is PLUGIN_HANDLED and what PLUGIN_HANDLED_MAIN ?
2. how do I "check the returned index" ?

Thank you for explaining
__________________
edon1337 is offline
Send a message via Skype™ to edon1337
klippy
AlliedModders Donor
Previously known as:
KliPPy
Join Date: May 2013
Location: Serbia
Old 01-01-2017 , 12:14   Re: Messages/Tries/ArrayPush/Screenshake/Ent Exists/nVault Multiple Info/HAM_ | FMRES
Reply With Quote #4

8. Search, frequency and amplitude are properties of a wave. ScreenShake can be seen as a wave.
6. If it works, use it. Think of and experiment with other ideas. If you release a plugin and there is a better way someone will tell you.
4, 5. In other programming languages these are usually known as vector containers. They are just like regular arrays but they can grow at any time (when pushing elements to them). Tries are what is known as hashtables, dictionaries or associative arrays in other languages. Search about these, they are well known data structures.

Last edited by klippy; 01-01-2017 at 12:16.
klippy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-02-2017 , 12:04   Re: Messages/Tries/ArrayPush/Screenshake/Ent Exists/nVault Multiple Info/HAM_ | FMRES
Reply With Quote #5

8. But, what is 255 << 14 and 10 << 14 in Natural numbers (1,2,3,4..) ?

According to
Quote:
1 second is equal to (1<<12)
__________________

Last edited by edon1337; 01-02-2017 at 12:07.
edon1337 is offline
Send a message via Skype™ to edon1337
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-02-2017 , 12:11   Re: Messages/Tries/ArrayPush/Screenshake/Ent Exists/nVault Multiple Info/HAM_ | FMRES
Reply With Quote #6

Quote:
Originally Posted by edon1337 View Post
8. But, what is 255 << 14 and 10 << 14 in Natural numbers (1,2,3,4..) ?
Why do you want to know that? What is important to know is this:
Quote:
Note: All arguments is in special units. 1 second is equal to (1<<12) i.e. 4096 units.
About amplitude, it's the difference from the lowest to the biggest point of a wave(how hard it will shake). The frequency is the number of repetitions per time unit(how many times it will shake in one second)
__________________
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-02-2017 , 13:07   Re: Messages/Tries/ArrayPush/Screenshake/Ent Exists/nVault Multiple Info/HAM_ | FMRES
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
Why do you want to know that?
More likely, "Why wouldn't you want to know that". What if I want to make it's duration longer? Idk how to do that
__________________
edon1337 is offline
Send a message via Skype™ to edon1337
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-02-2017 , 14:27   Re: Messages/Tries/ArrayPush/Screenshake/Ent Exists/nVault Multiple Info/HAM_ | FMRES
Reply With Quote #8

Quote:
Originally Posted by edon1337 View Post
More likely, "Why wouldn't you want to know that". What if I want to make it's duration longer? Idk how to do that
He said that because you asked for something that is random and illogical.

If you want 2 seconds, then you use 2 * 4096 = 8192.
__________________
fysiks is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-02-2017 , 17:12   Re: Messages/Tries/ArrayPush/Screenshake/Ent Exists/nVault Multiple Info/HAM_ | FMRES
Reply With Quote #9

I'm just confused a little bit. I know that I have to multiple it but 8192 would be ( 2 << 24 ) or what? Idk how to transform it ..
__________________

Last edited by edon1337; 01-02-2017 at 17:14.
edon1337 is offline
Send a message via Skype™ to edon1337
klippy
AlliedModders Donor
Previously known as:
KliPPy
Join Date: May 2013
Location: Serbia
Old 01-02-2017 , 17:29   Re: Messages/Tries/ArrayPush/Screenshake/Ent Exists/nVault Multiple Info/HAM_ | FMRES
Reply With Quote #10

4096 = 1 << 12
8192 = 1 << 13
16384 = 1 << 14
etc
klippy is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:59.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode