Raised This Month: $ Target: $400
 0% 

Working with string alteration and control...


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
-Demonsthenes-
Junior Member
Join Date: Mar 2006
Old 03-20-2006 , 20:59   Working with string alteration and control...
Reply With Quote #1

I've been working with pawn on and off for about a year, but something I never quite understood was how to use the returned array from some sort of string function such as "clamp" or "max".
Code:
clamp(gaben,10,20)
That will return gaben with a value that is, or is in between 10 and 20. But it returns it (to my understanding), like this (let gaben = 10): gaben[0] = 1; gaben[1] = 0;. So, I have a peice of ugly code like this:

Code:
public function_setitcolor(id) {
	// This function was a bit awkward for me, I'm not sure of a better way to do it..
	read_argv(1,hs_glowcolor_r_r,3)
	read_argv(2,hs_glowcolor_g_r,3)
	read_argv(3,hs_glowcolor_b_r,3)
	if(read_argc() != 3 
	|| !is_str_num(hs_glowcolor_r_r)  
	|| !is_str_num(hs_glowcolor_g_r) 
	|| !is_str_num(hs_glowcolor_b_r)) { 
		console_print(id,"You need exactly three, numerical values for this command to work properly")
	}
	hs_glowcolor_r = hs_glowcolor_r_r[0]&hs_glowcolor_r_r[1]&hs_glowcolor_r_r[2]
	hs_glowcolor_g = hs_glowcolor_g_r[0]&hs_glowcolor_g_r[1]&hs_glowcolor_g_r[2]
	hs_glowcolor_b = hs_glowcolor_b_r[0]&hs_glowcolor_b_r[1]&hs_glowcolor_b_r[2]
}
How can I clean this up or (unfortunatly) is this the best way, or is this just wrong.
-Demonsthenes- is offline
 



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:42.


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