Hi all,
For my multiplayer game, I want to send a string and var (array) from the server to the client to show hit indicator numbers on the client. The var array is sent correctly, but for some reason I cannot send the string properly
.
var sendindicator_colors[3] = { 0, 0, 0 };
STRING* sendindicator_str = "";
STRING* hitindicator_line1_str = "";
....
function calculate_hitindicator()
{
....
//send string and array to client
send_string (sendindicator_str);
send_var (sendindicator_colors);
}
function on_client_event(void* buffer)
{
if (event_type == EVENT_STRING)
{
...
//hit indicators
if (buffer == sendindicator_str)
{
hitindicator_showlines();
str_cpy(hitindicator_line1_str, sendindicator_str);
vec_set(hitindicator_line1_txt.blue, vector(sendindicator_colors[0], sendindicator_colors[1], sendindicator_colors[2]));
}
}
}
I have debug_vars on both the server and client so I can precisely see what goes well and what goes wrong. The debug_vars show e.g. sendindicator_colors[0] correctly, but e.g. draw_text(sendindicator_str,50,460,vector(100,100,255)); is only shown correctly on the server, and empty on the client. So something goes wrong with sending of the string?
I have checked my code with find text (ctrl+f) and nothing else messes with sendindicator_str.