AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   give variable and grab variable from set_task (https://forums.alliedmods.net/showthread.php?t=50487)

kp_uparrow 01-27-2007 14:05

give variable and grab variable from set_task
 
Code:
    set_task(1.0,"loophud",id,"g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[i][0], verpos,name[32], message[i + n]",100,"a",5)         return PLUGIN_HANDLED } public loophud(id,const msg[], {Float,Sql,Result,_}:...){     set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[i][0], verpos, 0, 2.0, 2.0, 1.0, 2.0, -1)     show_hudmessage(0, "%s :   %s", name, message[i + n])     client_print(0, print_chat, "%s :   %s", name, message[i + n]) }

im trying to make the variables from the first function go in to the second function that is called by the set_task

1 how do you give variables to the second function
2 how do grab the variables from first function after it sends

this is from adminchat.sma

[ --<-@ ] Black Rose 01-27-2007 17:52

Re: give variable and grab variable from set_task
 
It seems easier to just do global vars but w/e... hope you'll understand this
It may not be exactly what you want but you will probably edit it anyway...
And it looks like you're passing global vars... wich seems pretty stupid, but i belive it was an example...
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     new param[100]         formatex(param, 99, "%d %d %d %d %d ^"%s^" ^"%s^"", g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[i][0], verpos, name, message)         set_task(1.0, "loophud", id, param, 99, "a", 5) } public loophud(param[]) {     new temp[32], temp2[100]         new g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[i][0], verpos, name[32], message[32]         strbreak(param, temp, 31, temp2, 99)     g_Values[a][0] = str_to_num(temp)         strbreak(temp2, temp, 31, temp2, 99)     g_Values[a][1] = str_to_num(temp)         strbreak(temp2, temp, 31, temp2, 99)     g_Values[a][2] = str_to_num(temp)         strbreak(temp2, temp, 31, temp2, 99)     g_Pos[i][0] = str_to_num(temp)         strbreak(temp2, temp, 31, temp2, 99)     verpos = str_to_num(temp)     strbreak(temp2, temp, 31, temp2, 99)     g_Values[a][2] = str_to_num(temp)         strbreak(temp2, name, 31, message, 31)         remove_quotes(name)     remove_quotes(message)         set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[i][0], verpos, 0, 2.0, 2.0, 1.0, 2.0, -1)     show_hudmessage(0, "%s :   %s", name, message[i + n])     client_print(0, print_chat, "%s :   %s", name, message[i + n]) }

kp_uparrow 02-16-2007 13:10

Re: give variable and grab variable from set_task
 
Code:
......{     new param[100]         formatex(param, 99, "%i %i %i ^"%s^" ^"%s^"",a,i,verpos,name, message)         set_task(1.0, "loophud", id, param, 99, "a", 5) } public loophud(param[]) {     new temp[32], temp2[100]         new a,i,verpos     new name[32],message[32]         strbreak(param, temp, 31, temp2, 99)     a = str_to_num(temp)         strbreak(param, temp, 31, temp2, 99)     i = str_to_num(temp)         strbreak(param, temp, 31, temp2, 99)     verpos = str_to_num(temp)         strbreak(temp2, name, 31, message, 31)         client_print(0, print_console, "test hudloop %s :   %s", name, message)         remove_quotes(name)     remove_quotes(message)         set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[i][0], verpos, 0, 2.0, 2.0, 1.0, 2.0, -1)     show_hudmessage(0, "%s :   %s", name, message) }
the name comes as a bunch of numbers, the message is the name, its not being grabbed out of the param

can someone help me fix this please?

[ --<-@ ] Black Rose 02-16-2007 13:51

Re: give variable and grab variable from set_task
 
Code:
......{     new param[100]         formatex(param, 99, "%i %i %0.3f ^"%s^" ^"%s^"",a,i,verpos,name, message)         set_task(1.0, "loophud", id, param, 99, "a", 5) } public loophud(param[]) {     new temp[32], temp2[100]         new a,i,Float:verpos     new name[32],message[32]         strbreak(param, temp, 31, temp2, 99)     a = str_to_num(temp)         strbreak(temp2, temp, 31, temp2, 99) // You have allready breaked down param[], whats left is in the temp2 string, we break that one down to get next value.     i = str_to_num(temp)         strbreak(temp2, temp, 31, temp2, 99)     verpos = str_to_float(temp)         strbreak(temp2, name, 31, message, 31)         client_print(0, print_console, "test hudloop %s :   %s", name, message)         remove_quotes(name)     remove_quotes(message)         set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[i][0], verpos, 0, 2.0, 2.0, 1.0, 2.0, -1)     show_hudmessage(0, "%s :   %s", name, message)     }

kp_uparrow 02-16-2007 15:48

Re: give variable and grab variable from set_task
 
sweet its working now THX!!!!!!!!!!!!!!!!!!!!!!!!!!!!


All times are GMT -4. The time now is 00:35.

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