Raised This Month: $ Target: $400
 0% 

variable in hudmessage?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 03-29-2005 , 16:38   variable in hudmessage?
Reply With Quote #1

how to show a variable in a hudmessage?

i know how to show hp and stuff but not variables

hp example:
Code:
 public hpmessage(id)  {     new health[33]     get_user_health(id,health,32)     set_hudmessage(200, 200, 0, -1.0, 0.45, 2, 6.0, 3.0, 0.01, 0.1, 86)     show_hudmessage(id, "You have %i HP", health)     return PLUGIN_HANDLED  }

variabel?:
Code:
 public message(id)  {     new something[33]     ?????(id,something,32)     set_hudmessage(200, 200, 0, -1.0, 0.45, 2, 6.0, 3.0, 0.01, 0.1, 86)     show_hudmessage(id, "You have %i something", something)     return PLUGIN_HANDLED  }
Belsebub is offline
FeuerSturm
AlliedModders Donor
Join Date: Apr 2004
Old 03-29-2005 , 17:19  
Reply With Quote #2

i'm not sure what you actually want, give an example for what
you want to display and i'm sure i can help you.
FeuerSturm is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 03-29-2005 , 18:40  
Reply With Quote #3

%d for integers
%f for floats
%s for strings

Is that what you wanted?
__________________
twistedeuphoria is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-29-2005 , 18:42  
Reply With Quote #4

%i for integers, actually
%d stands for data... not sure quite exactly what it was meant for, but it can be used for integers.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 03-29-2005 , 18:49  
Reply With Quote #5

Oh really, you learn something new every day, or week, or w/e. %d always worked for me
__________________
twistedeuphoria is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-29-2005 , 18:53  
Reply With Quote #6

%d can be used in place of %i, %f, and %s. it figures out what your trying to display and displays it. There is some sort of downside, but I forget what it is.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 03-30-2005 , 04:45  
Reply With Quote #7

example: so if i want to show the variable something in the hudmessage i do like this?

Code:
new something = 1 public message(id) {     set_hudmessage(200, 200, 0, -1.0, 0.45, 2, 6.0, 3.0, 0.01, 0.1, 86)     show_hudmessage(id, "something is %d", something)     return PLUGIN_HANDLED }
Belsebub is offline
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 03-30-2005 , 05:08  
Reply With Quote #8

and i also saw this in another topic and i cant get it to work so can anyone explain how to use it or give me a code example?

Code:
new Float:maxspeed = 319.0 + float(level); set_user_maxspeed(id,maxspeed);
Belsebub is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 03-30-2005 , 07:11  
Reply With Quote #9

http://www.cppreference.com/stdio/printf.html
Johnny got his gun is offline
Belsebub
Senior Member
Join Date: Feb 2005
Location: Sweden
Old 03-30-2005 , 08:18  
Reply With Quote #10

ok i need some help, i am working on a stats plugin that allows you to choose 5 stats, i have only done the constitution stat now, but i need someone to fix the code cause i get theese errors when i compile:

Code:
(8) : error 017: undefined symbol "constitution"
(8 -- 9) : error 008: must be a constant expression; assumed zero
the plugin:

Code:
 //----------------------------------------------------------------------------------------------  #include <amxmodx>  #include <amxmisc>  #include <engine>  #include <fun>  //----------------------------------------------------------------------------------------------  // VARIABLES  new hp[33] = 10 * (constitution[id])  new constitution[33] = 0 new pointsleft[33] = 5  //----------------------------------------------------------------------------------------------  public plugin_init()  {     register_plugin("Stats", "1.0", "Belsebub")     register_menucmd(register_menuid("Stats Menu"), 1023, "ActionMenu")     register_event("ResetHUD", "Event_Resethud", "a")  }  //----------------------------------------------------------------------------------------------  ShowMenu(id)  {     new szMenuBody[256]     new keys     new len = format( szMenuBody, 255, "Stats Menu:^n" )     len += format( szMenuBody[len], 255-len, "^n\w1. Constitution" )     len += format( szMenuBody[len], 255-len, "^n\w2. Nothing" )     len += format( szMenuBody[len], 255-len, "^n\w3. Nothing" )     len += format( szMenuBody[len], 255-len, "^n\w4. Nothing" )     len += format( szMenuBody[len], 255-len, "^n\w0. Exit )     keys = (1<<0|1<<1|1<<2|1<<3|1<<9)     show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public ActionMenu(id, key)  {     switch(key)     {         case 0:         {             constitution[id] += 1             pointsleft[id] -= 1         }         case 1:         {         }         case 2:         {         }         case 3:         {         }         case 4:         {         }     }  }  //----------------------------------------------------------------------------------------------  public Event_Resethud(id)  {     new health = get_user_health ( id )     set_user_health(id, health + hp[id])  }  //----------------------------------------------------------------------------------------------

and i also want to show the current constitution the player has in the menu after the option Constitution, like this if the person has 5 constitution the option will be :

Constitution (5)
Belsebub 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 09:52.


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