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".
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.