Raised This Month: $ Target: $400
 0% 

Hud Message Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
enjoi.
Veteran Member
Join Date: Mar 2011
Old 10-06-2011 , 07:46   Hud Message Help
Reply With Quote #1

I'm trying to make a plugin with mp_roundtime 145 but I can't figure this out. I want it to announce the last bullet kill.


PHP Code:
#include <amxmodx>

#pragma semicolon 1

#define VERSION        "1.1"

public plugin_init()
{
    
register_plugin("Hud Advertising"VERSION"enjoi.");
    
    
set_task(145.0"ShowAdvert"___"b");
}

public 
ShowAdvert(id)
{
    new 
szName[32]; get_user_name(idszNamecharsmax(szName))
    
set_hudmessage(00255, -1.00.8500.012.00.10.2);  
    
show_hudmessage(0"Last Bullet By: %s"szName);

Can anybody help?

Edit: Just do the hudmessage in the code please. Thanks
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]

Last edited by enjoi.; 10-06-2011 at 15:12.
enjoi. is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 10-06-2011 , 09:04   Re: Hud Message Help
Reply With Quote #2

PHP Code:
public ShowAdvert()
{
    new 
szName[32]; get_user_name(idszNamecharsmax(szName))
    
set_hudmessage(00255, -1.00.8500.012.00.10.2);  
    
show_hudmessage(0"Last Bullet By: %s"szName);

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 10-06-2011 , 12:20   Re: Hud Message Help
Reply With Quote #3

Quote:
Originally Posted by enjoi. View Post
I'm trying to make a plugin with mp_roundtime 145 but I can't figure this out. I want it to announce the last bullet kill.
Well ofcourse it wont work. You did'nt catch the last kill nor who did it.
Catch it in DeathMsg or ham_killed whatever you prefer and assign the name to a string wich you can print in the "round end" event instead of hardcoding 145,
plus then you don't need any set_task wich also means less lag

Quote:
Originally Posted by Napoleon_be View Post
PHP Code:
public ShowAdvert()
{
    new 
szName[32]; get_user_name(idszNamecharsmax(szName))
    
set_hudmessage(00255, -1.00.8500.012.00.10.2);  
    
show_hudmessage(0"Last Bullet By: %s"szName);

I don't think this will help him either...
Since there is no "id" specified you can't get users name.
Wich equals you cannot print the users name.
Erox902 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 10-06-2011 , 13:48   Re: Hud Message Help
Reply With Quote #4

Quote:
Originally Posted by Erox902 View Post
Well ofcourse it wont work. You did'nt catch the last kill nor who did it.
Catch it in DeathMsg or ham_killed whatever you prefer and assign the name to a string wich you can print in the "round end" event instead of hardcoding 145,
plus then you don't need any set_task wich also means less lag

I don't think this will help him either...
Since there is no "id" specified you can't get users name.
Wich equals you cannot print the users name.
my bad, sorry.

PHP Code:
public ShowAdvert(id)
{
    new 
szName[32]; get_user_name(idszNamecharsmax(szName))
    
set_hudmessage(00255, -1.00.8500.012.00.10.2);  
    
show_hudmessage(0"Last Bullet By: %s"szName);

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
enjoi.
Veteran Member
Join Date: Mar 2011
Old 10-06-2011 , 15:11   Re: Hud Message Help
Reply With Quote #5

Thanks for helping guys. Ill see if this works. I'm just new to coding.

So its this?

#include <amxmodx>

#pragma semicolon 1

#define VERSION "1.1"

public plugin_init()
{
register_plugin("Hud Advertising", VERSION, "enjoi.");

set_task(145.0, "ShowAdvert", _, _, _, "b");
}

public ShowAdvert(id)
{
new szName[32]; get_user_name(id, szName, charsmax(szName))
set_hudmessage(0, 0, 255, -1.0, 0.85, 0, 0.0, 12.0, 0.1, 0.2);
show_hudmessage(0, "Last Bullet By: %s", szName);
}
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]
enjoi. is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 10-06-2011 , 16:19   Re: Hud Message Help
Reply With Quote #6

Quote:
Originally Posted by Napoleon_be View Post
my bad, sorry.

PHP Code:
public ShowAdvert(id)
{
    new 
szName[32]; get_user_name(idszNamecharsmax(szName))
    
set_hudmessage(00255, -1.00.8500.012.00.10.2);  
    
show_hudmessage(0"Last Bullet By: %s"szName);

Did you read the above part?

Here is how I would've done it
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN    "GetLastKiller"
#define AUTHOR    "Rtk.Esc"
#define VERSION    "0.1"

new szName[32//Killers name will be assigned to this string

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("DeathMsg""eventDeath""a")
    
register_logevent("eventRoundend"2"1=Round_End")
    
//use round ends logevent instead of hardcoding to it!
    /*if mp_roundtime is more than 9 it will just go down to 9 again,
    so you can't have mp_roundtime 145. That would be 145minutes
    and no matter what the mp_roundtime is, if you print the message
    at round end it will always be displayed then*/
}

public 
eventDeath()
{
    new 
killer read_data(1//get the killer
    
    
if (killer != read_data(2) ) //check so the killer was'nt killing himself
    
{
        
get_user_name(killerszNamesizeof(szName) - 1//get the name, then asign it to szName
    
}
}

public 
eventRoundend()
{
    
set_hudmessage(00255, -1.00.8500.010.0)
    
show_hudmessage(0"Last Kill By: %s"szName);/*changed to "killer"
    cuz' if you want the last one shooting someone you'll have to hook ham_takedamage
    or if you mean the last one firing a bullet you should probably hook primary attack*/

Erox902 is offline
enjoi.
Veteran Member
Join Date: Mar 2011
Old 10-06-2011 , 16:45   Re: Hud Message Help
Reply With Quote #7

thx.
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]
enjoi. is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 10-06-2011 , 16:46   Re: Hud Message Help
Reply With Quote #8

no problem
Erox902 is offline
Reply



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 13:55.


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