Raised This Month: $ Target: $400
 0% 

Making str_to_num cycle in client_PostThink


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stephen
Senior Member
Join Date: Aug 2004
Old 04-25-2006 , 09:18   Making str_to_num cycle in client_PostThink
Reply With Quote #1

Code:
public client_PostThink(id) {     if (FxArray[id]==1)     {     new scale[12], brightness[12]     read_argv(1, scale, 11)     read_argv(2, brightness, 11)     new origin[3];     get_user_origin(id,origin);     message_begin(MSG_BROADCAST,SVC_TEMPENTITY);     write_byte(TE_SPRITE);     write_coord(origin[0]);     write_coord(origin[0] -= 1);     write_coord(origin[0] += 1);     write_short(sprite); // short (sprite index)     write_byte(str_to_num(scale)); // byte (scale in 0.1's)       write_byte(str_to_num(brightness)); // byte (brightness)     message_end();          }     else if (FxArray[id]==0)     {     }     return PLUGIN_CONTINUE }

When i set the scale and brightness right into the plugin it works.
But when i wanna use the code with str_to_num it only plays 1 cycle and then it dissapears again.

While this snippet works but not customaizable via the ingame console.
Code:
public client_PostThink(id) {     if (FxArray[id]==1)     {     new origin[3];     get_user_origin(id,origin);     message_begin(MSG_BROADCAST,SVC_TEMPENTITY);     write_byte(TE_SPRITE);     write_coord(origin[0]);     write_coord(origin[0] -= 1);     write_coord(origin[0] += 1);     write_short(sprite); // short (sprite index)     write_byte(6); // byte (scale in 0.1's)       write_byte(111); // byte (brightness)     message_end();          }     else if (FxArray[id]==0)     {     }     return PLUGIN_CONTINUE }

So HOW do i make it so i can use str_to_num in the snippet without vanishing after 1 cycle ?
__________________
www.corona-bytes.net (ECX = ESF Addon)
Stephen is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 04-25-2006 , 09:22  
Reply With Quote #2

Try printing the values to check if there's an error in your code.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Stephen
Senior Member
Join Date: Aug 2004
Old 04-25-2006 , 09:47  
Reply With Quote #3

Code:
set_hudmessage(200, 200, 0, 0.55, 0.03, 0, 6.0, 6.0, 0.1, 0.1, -1)     show_hudmessage(id, "scale: %d | brightness: %d",scale,brightness)      set_hudmessage(200, 200, 0, 0.55, 0.05, 0, 6.0, 6.0, 0.1, 0.1, -1)     show_hudmessage(id, "scale: %s | brightness: %s",scale,brightness)     set_hudmessage(200, 200, 0, 0.55, 0.07, 0, 6.0, 6.0, 0.1, 0.1, -1)     show_hudmessage(id, "scale: %f | brightness: %f",scale, brightness)     set_hudmessage(200, 200, 0, 0.55, 0.09, 0, 6.0, 6.0, 0.1, 0.1, -1)     show_hudmessage(id, "scale: %c | brightness: %c",scale,brightness)     }

i used this to show me Infos about it. But i got no usefull info of it. Its not even show the values i used.
i command scale brightness( command 5 111) but i got some number of 243 and 5 etc. displayed nothing where could help me somehow. but the MSG is still playing otherwise it would show 0 the whole time.

could it be that i have use DispatchSpawn( );
somehow ? or what ?
__________________
www.corona-bytes.net (ECX = ESF Addon)
Stephen is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 04-25-2006 , 09:53  
Reply With Quote #4

If the values aren't showing, then there must be an error in your code.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Stephen
Senior Member
Join Date: Aug 2004
Old 04-25-2006 , 09:55  
Reply With Quote #5

But where ?
cause when i set the values right away in the plugin (without str_to_num) then there is no problem with the Sprite beeing displayed and it cycles so long till i stop it.

But the str_to_num only plays 1 cycle.
__________________
www.corona-bytes.net (ECX = ESF Addon)
Stephen is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-25-2006 , 10:43  
Reply With Quote #6

umm.. theres no arguments to read with read_argv in client_PostThink() coz its a forward
__________________
plop
p3tsin is offline
Stephen
Senior Member
Join Date: Aug 2004
Old 04-25-2006 , 10:48  
Reply With Quote #7

Is there any other way ? I know its possible cause i have seen it beeing able to custom choose the scale and brightness in the console and haveing the same effect.

I also tried it with set_task.
__________________
www.corona-bytes.net (ECX = ESF Addon)
Stephen is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-25-2006 , 10:56  
Reply With Quote #8

Code:
new cv_scale new cv_brightness public plugin_init() {     cv_scale = register_cvar("spr_scale", "6")     cv_brightness = register_cvar("spr_brightness", "111") }

Code:
    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);     write_byte(TE_SPRITE);     write_coord(origin[0]);     write_coord(origin[0] -= 1);     write_coord(origin[0] += 1);     write_short(sprite); // short (sprite index)     write_byte(get_pcvar_num(cv_scale)); // byte (scale in 0.1's)       write_byte(get_pcvar_num(cv_brightness)); // byte (brightness)     message_end();
__________________
plop
p3tsin is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 04-25-2006 , 11:15  
Reply With Quote #9

I could be wrong, but you could get an message overflow if you use this in pre/postthink
I think it would be better if you use an cmd for t his
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
Stephen
Senior Member
Join Date: Aug 2004
Old 04-25-2006 , 11:23  
Reply With Quote #10

The cvar thinggy crashes me to the desktop.

Hmms. Too bad it aint possible for me to make it how i want it.

*looks at Greenberet

its this effect where i wanna be able to choose ingame the scale and brightness
[img]http://img88.**************/img88/3690/unbenannt3dv.th.jpg[/img]

When i use str_to_num it creates the scale and brightness i choosed, but it stays at the position then and only plays 1 cycle.


But when i set the scale and the brightness in the plugin without str_to_num
It follows me like i want it too and it isnt stopping after 1 cycle.
__________________
www.corona-bytes.net (ECX = ESF Addon)
Stephen 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 05:02.


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