Raised This Month: $ Target: $400
 0% 

Why dun this work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-10-2005 , 00:44   Why dun this work?
Reply With Quote #1

(it's very rare that I ask for help in here :p)
Code:
#include <amxmodx> public plugin_init()     register_plugin("HUD Score","0.1","v3x") #define TASK_ID 2934 public client_connect(id) set_task(1.0,"show_message",TASK_ID+id) public client_disconnect(id) remove_task(TASK_ID+id) public show_message(id) {     new frags = get_user_frags(id)     new deaths = get_user_deaths(id)     new msgstr[64]     format(msgstr,63,"Kills: %i / Deaths: %i",frags,deaths)     set_hudmessage(255,255,255,-1.0,0.35,2,0.1,1.0,0.02,0.02,10)     show_hudmessage(id,msgstr)     return PLUGIN_HANDLED }

It's so simple.. :p

Maybe I just have the coords off of the screen, haha.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
WaZZeR++
Veteran Member
Join Date: Mar 2005
Location: Sweden
Old 06-10-2005 , 07:35  
Reply With Quote #2

dont you need to creat a loop that display it, the scor isupdating al the time.

can there be anything wrong with:
Code:
set_hudmessage(255,255,255,-1.0,0.35,2,0.1,1.0,0.02,0.02,10)
but I dont, everything look, cant find the problem ether...
WaZZeR++ is offline
Send a message via MSN to WaZZeR++
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 06-10-2005 , 13:20   Re: Why dun this work?
Reply With Quote #3

As far as I know, the ID being passed to your "show_message" function will be the same as the Task ID, which you put as: TASK_ID+id, but then you try to use that ID in the show_message function as if it were a player ID.. I think you should minus TASK_ID from the player ID first..

Code:
#include <amxmodx> public plugin_init()     register_plugin("HUD Score","0.1","v3x") #define TASK_ID 2934 public client_connect(id) set_task(1.0,"show_message",TASK_ID+id) public client_disconnect(id) remove_task(TASK_ID+id) public show_message(id) {     new playerID = id - TASK_ID     new frags = get_user_frags(playerID)     new deaths = get_user_deaths(playerID)     new msgstr[64]     format(msgstr,63,"Kills: %i / Deaths: %i",frags,deaths)     set_hudmessage(255,255,255,-1.0,0.35,2,0.1,1.0,0.02,0.02,10)     show_hudmessage(playerID,msgstr)     return PLUGIN_HANDLED }

I hope that helps, or even works!
xeroblood is offline
Send a message via MSN to xeroblood
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-10-2005 , 16:34  
Reply With Quote #4

Still dun work.. :\

I tried to make it show in the StatusText thinger, but I got an error and teh server went boom.

Code:
#include <amxmodx> public plugin_init()     register_plugin("HUD Score","0.1","v3x") #define TASK_ID 2934 public client_connect(id) set_task(3.0,"show_message",TASK_ID+id) public client_disconnect(id) remove_task(TASK_ID+id) public show_message(id) {     new playerID = id - TASK_ID     new frags = get_user_frags(playerID)     new deaths = get_user_deaths(playerID)     new msgstr[64]     format(msgstr,63,"Kills: %i / Deaths: %i",frags,deaths)     message_begin(MSG_ONE,get_user_msgid("StatusText"),{0,0,0},id)     write_byte(0)     write_string(msgstr)     message_end()     return PLUGIN_HANDLED }

Quote:
FATAL ERROR (shutting down): MSG_ONE or MSG_ONE_UNRELIABLE with no target entity
---
HUD CODE (changed a couple things):
Code:
#include <amxmodx> public plugin_init()     register_plugin("HUD Score","0.1","v3x") #define TASK_ID 2934 public client_putinserver(id) set_task(1.0,"show_message",TASK_ID+id,_,_,"b") public client_disconnect(id) remove_task(TASK_ID+id) public show_message(id) {     new playerID = id - TASK_ID     new frags = get_user_frags(playerID)     new deaths = get_user_deaths(playerID)     new msgstr[64]     format(msgstr,63,"Kills: %i / Deaths: %i",frags,deaths)     set_hudmessage(255,255,255,-1.0,0.35,2,0.1,1.0,0.02,0.02,10)     show_hudmessage(playerID,msgstr)     return PLUGIN_HANDLED }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-11-2005 , 10:52  
Reply With Quote #5

Bah, I got it workin..
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 06-11-2005 , 16:49  
Reply With Quote #6

I know this is kinda off-topic, but you should always use MSG_ONE_UNRELIABLE instead of MSG_ONE.

By using MSG_ONE you are telling the HL Engine that the message is to be put into the reliable stream for sending and if for some reason the message can't be sent then the HL Engine produces a Fatal Error and your server crashes..

If you use MSG_ONE_UNRELIABLE you are telling the HL Engine to send the message unreliably, meaning that if the message can't be sent it is okay.. This way the server continues on and doesn't crash..

Either way, using MSG_ONE_UNRELIABLE or MSG_ONE will still cause the message to be sent, and in both cases the message may fail, the notable difference is what to do if it does fail (crash or continue)..

Overall, use MSG_ONE if you want the server to crash if the message can't be sent, or use MSG_ONE_UNRELIABLE if you don't want it to crash..
xeroblood is offline
Send a message via MSN to xeroblood
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 06-11-2005 , 16:53  
Reply With Quote #7

Oh, i noticed why it crashed on you too, you put 'id' in the message_begin function, when you shoulda put 'playerID'...

Quote:
Originally Posted by v3x
Code:
#include <amxmodx> // [...] public show_message(id) {     new playerID = id - TASK_ID     // [...]     message_begin(MSG_ONE,get_user_msgid("StatusText"),{0,0,0},id)     write_byte(0)     write_string(msgstr)     message_end()     return PLUGIN_HANDLED }
^^^ Notice it?
xeroblood is offline
Send a message via MSN to xeroblood
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 16:47.


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