Raised This Month: $ Target: $400
 0% 

Unsure of how


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Pablo
BANNED
Join Date: May 2006
Location: Mexico City, Mexico
Old 05-26-2006 , 01:51  
Reply With Quote #4

go here -> http://wiki.amxmodx.org/index.php/Ad...28AMX_Mod_X%29

look about a third of the way down the page for these two code sample blocks... they *may* be germaine to what you are coding:
(I'm thinking you want hook_death...)

Quote:
Code:
public plugin_init()
{
    register_plugin("Message Demo", "1.0", "BAILOPAN")
    //this message informs everyone of a death, so we use
    // flag "a" - global event
    register_event("DeathMsg", "hook_death", "a")
}
 
public hook_death()
{
    new Killer = read_data(1) //get the first message parameter
    new Victim = read_data(2) //get the second message parameter
    new headshot = read_data(3) //was this a headshot?
    new weapon[32]
    read_data(4, weapon, 31)  //get the weapon name
}
Or, let's say we want to make a simple function for generating a death message:

Code:
stock make_deathMsg(Killer, Victim, const weapon[])
{
    //message_begin starts a message.  NEVER start two messages at once.
    //MSG_ALL means send the message to everyone
    //get_user_msgid returns the id of a message name
    //{0,0,0} is the origin vector - not used here
    //0 is the target - no specific target here
    message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0) 
    write_byte(Killer)
    write_byte(Victim)
    write_string(weapon)
    message_end()
}
Pablo is offline
 



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 16:34.


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