Raised This Month: $ Target: $400
 0% 

Dude with cvar + set_task


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dasha
Senior Member
Join Date: Apr 2012
Location: \%STEAM -> $_SESSION
Old 07-08-2012 , 16:27   Dude with cvar + set_task
Reply With Quote #1

hi x_x
How to use text in cvar and print it?

~example;
Quote:
new text

text = register_cvar("cvar_name", "some text here")

ColorChat(id, GREEN, "your text in cvar: %s", get_pcvar_num(text) )
It won't print the text in cvar, i tried with %s, %d, %f and nothing :\
Can someone also tell me the difference betwen the %d, %f and all those symbs? thanks

---edit

How I can set_task with cvar?
like:

new task_time

task_time = register_cvar("cvar_name", "10")

set_task(here the cvar, "etc", id)

Last edited by dasha; 07-08-2012 at 16:34.
dasha is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-08-2012 , 16:37   Re: Dude with cvar + set_task
Reply With Quote #2

PHP Code:
new szText50 ];
get_pcvar_stringtext szText charsmaxszText ) );
ColorChat(idGREEN"your text in cvar: %s"szText 
..
set_taskget_pcvar_floattask_time ) , "etc"id
__________________

Last edited by Bugsy; 07-08-2012 at 16:37.
Bugsy is offline
dasha
Senior Member
Join Date: Apr 2012
Location: \%STEAM -> $_SESSION
Old 07-08-2012 , 16:45   Re: Dude with cvar + set_task
Reply With Quote #3

And how should I register the cvar? coz this way isn't working

szText = register_cvar("szText", "some text")
Error: Array must be indexed (variable "szText") on line 86

or

szText[50] = register_cvar("bla", "some text")
Error: Array index out of bounds (variable "szText") on line 86
dasha is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-08-2012 , 16:48   Re: Dude with cvar + set_task
Reply With Quote #4

PHP Code:
text register_cvar("szText""some text")
...
new 
szText50 ];
get_pcvar_stringtext szText charsmaxszText ) );
ColorChat(idGREEN"your text in cvar: %s"szText 
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
dasha
Senior Member
Join Date: Apr 2012
Location: \%STEAM -> $_SESSION
Old 07-08-2012 , 16:59   Re: Dude with cvar + set_task
Reply With Quote #5

Thanks, working well
dasha is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 07-08-2012 , 17:32   Re: Dude with cvar + set_task
Reply With Quote #6

just as a note, to avoid this kind of confusion later....when coders prefix variable names with "sz" it means its a string. Check out the tut section for threads about hungarian notation. You'll see it A LOT around here.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz 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 15:09.


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