Jump to content
  • 0

Keep spamming in RPT with undefined variable


se7en

Question

Wrote simple Menu option to show but i keep getting errors (but it is working)

 

I pasted in fn_selfActions.sqf

if ((speed player <= 1) && _canDo) then {
if (s_player_walk < 0) then {
    s_player_walk = player addaction [("<t color=""#ffa500"">" + ("Auto") + "<t color=""#ffffff"">" + (" Walk") + "</t>"),"custom\tools\automove.sqf","",5,false,true,"",""];
                };
        } else {
        player removeAction s_player_walk;
        s_player_walk = -1;
    };

IT works, but keep spamming in client's RPT:

Error in expression <peed player <= 1) && _canDo) then {
if (s_player_walk < 0) then {
s_player_w>
  Error position: <s_player_walk < 0) then {
s_player_w>
  Error Undefined variable (in sentence i guess): s_player_walk
File mpmissions\__CUR_MP.Chernarus\custom\fn_selfActions.sqf, line 19
 
Why these errors are kinda bugged and why they are even there?
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Where do you set the inital value for s_player_walk ?.

 

A variable needs to be initialised by setting a initial value for it before it can be checked with 'if' statements.  My guess on the limited info provided is that it is not set when the server starts.
 

Link to comment
Share on other sites

  • 0

Oh, i will use the same topic, because my next problem is very similar.

 

I got atm in my variables.sqf something like: vips = [12345,12345,12345];

and its working great, but i would like to make it in another file.

 

For example lets say i got file named viplist.sqf with this line above

Tried using #include custom\viplist.sqf in variables.sqf but its not working (more likely none variables in variables.sqf are working when i put this #include)

 

How can i make some variables in another files?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...