Posted By: Reconnoiter
Error E1515: Invalid arguments - 04/13/14 12:09
Hey all,
I sometimes get the invalid arguments error in my mp game when I test it with several clients and let a client fire. The error refers to my 'missile' code (code is below). It probably has got something to do with ent_remove (at the end of the code) that makes a pointer unusable. If I remove the ent_remove(me) line, the code gives no errors. So that is probably the cause of the error, but I have no idea how to solve since the manual does not give e.g. examples of ent_remove in multiplayer (yes blame the manual ). Anyway, below is the code of missile (where the error refers too):
Thanks in advance!
I sometimes get the invalid arguments error in my mp game when I test it with several clients and let a client fire. The error refers to my 'missile' code (code is below). It probably has got something to do with ent_remove (at the end of the code) that makes a pointer unusable. If I remove the ent_remove(me) line, the code gives no errors. So that is probably the cause of the error, but I have no idea how to solve since the manual does not give e.g. examples of ent_remove in multiplayer (yes blame the manual ). Anyway, below is the code of missile (where the error refers too):
Code:
action gun_laser_missile() { if (connection & CONNECT_SERVER) my.smask |= NOSEND_FRAME | NOSEND_ALPHA | NOSEND_COLOR | NOSEND_FLAGS | NOSEND_SCALE; while(connection != 0 && my.client_id < 0) wait(1); ... ///////////////////////////// my.STATE = 1; .... wait(1); c_setminmax(me); while(1) { // state 1: flying /////////////////////////////////////////// if (my.STATE == 1) { if (connection == 2 && my.LIFETIME != 0) { ent_createlocal("MDL_MissileLaser.mdl",vector(my.x,my.y,my.z),gun_client_missile); my.LIFETIME = 0; set(my,INVISIBLE); } //on server if (connection & CONNECT_SERVER || connection == 0) { if (blabla == blabla) my.smask |= NOSEND_ORIGIN; my.LIFETIME -= time_step *4; if (my.LIFETIME <= 0) my.STATE = 2; //go to STATE 2 //move projectile c_ignore(1,2,4,0); c_move(me,vector(my.MOVEMENTSPEED*time_step,0,0),vector(0,0,my.GRAVITY_SUM),IGNORE_PASSABLE); //go to STATE 2 if (HIT_TARGET && my.STATE == 1) my.STATE = 2; } } // state 2: exploding //////////////////////////////////////// if (my.STATE == 2) { my.smask |= NOSEND; break; } wait(1); } ent_remove(me); }
Thanks in advance!