nyolc8 Posted October 7, 2014 Share Posted October 7, 2014 (edited) Hi! I have a problem with arrays, and I basically just sitting here and looking like this: And I have no idea why it happens. So the problem: I have 2 arrays with 6 floats in each one. I fill them with values, then I print the first 3 values from the first array. BUT it prints the first value from first array, first value from second array, and second value from second array. WAT. Here's the code: {$CLEO .cs}0000: NOPwait [email protected] : array 6 of float //obj [email protected] : array 6 of float //obj [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = 350.0 :Testwait 200if Player.Defined($PLAYER_CHAR)else_jump @Test0AD1: print_formatted_now "x%f y%f z%f" time 5000 [email protected]([email protected],6f) [email protected]([email protected],6f) [email protected]([email protected],6f):Whateverwait 10000jump @Whatever NOTE: the "whatever" section is just for testing, just to run the script without crash. This code gives me "x104.2664 y2023.6335 z1083.2231". WHY??!! Edited October 7, 2014 by nyolc8 Link to comment Share on other sites More sharing options...
Jack Posted October 7, 2014 Share Posted October 7, 2014 (edited) I think that you can not use variables higher then 31. 32 and 33 are timers and the higher ones don't exist in CLEO scrypt. Edited October 7, 2014 by Jack Tank Fire [SA] New Police Helicopter [VC & III] My YouTube Channel Link to comment Share on other sites More sharing options...
nyolc8 Posted October 7, 2014 Author Share Posted October 7, 2014 I already changed those variables to [email protected]@ and same... btw it works fine if I read values from the second array. It only gets messed up if I read from the first array. So now the code is this, and same thing happens: {$CLEO .cs}0000: NOPwait [email protected] : array 6 of float //obj [email protected] : array 6 of float //obj [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = [email protected]([email protected],6f) = 350.0 :Testwait 200if Player.Defined($PLAYER_CHAR)else_jump @Test0AD1: print_formatted_now "x%f y%f z%f" time 5000 [email protected]([email protected],6f) [email protected]([email protected],6f) [email protected]([email protected],6f):Whateverwait 10000jump @Whatever What the hell happening? Link to comment Share on other sites More sharing options...
Jack Posted October 7, 2014 Share Posted October 7, 2014 (edited) 10@(1@,6f) is actually 11@ which is 11@(0@,6f). And I was wrong about the timers. It appears you can use them inside the arrays. Edited October 7, 2014 by Jack Tank Fire [SA] New Police Helicopter [VC & III] My YouTube Channel Link to comment Share on other sites More sharing options...
nyolc8 Posted October 7, 2014 Author Share Posted October 7, 2014 [email protected]([email protected],6f) is actually [email protected]([email protected],6f) which is [email protected] But why? I call the second ([email protected]) element from [email protected] array, then why it gets the first ([email protected]) element from [email protected] array? Link to comment Share on other sites More sharing options...
Jack Posted October 7, 2014 Share Posted October 7, 2014 (edited) [email protected]([email protected],6f) = 104.2664 // [email protected]@([email protected],6f) = -1951.9291 // [email protected]@([email protected],6f) = 48.575 // [email protected]@([email protected],6f) = 204.2664 // [email protected]@([email protected],6f) = -1951.9291 // [email protected]@([email protected],6f) = 41.6639 // [email protected] I hope this helps. EDIT: I must ask - why are you using arrays? The lack of variables maybe? Edited October 7, 2014 by Jack Tank Fire [SA] New Police Helicopter [VC & III] My YouTube Channel Link to comment Share on other sites More sharing options...
nyolc8 Posted October 7, 2014 Author Share Posted October 7, 2014 Oh so each value of the array uses the next variable from the [email protected] available? That sucks. Yes, I would need more variables. Link to comment Share on other sites More sharing options...
HeresOtis Posted October 7, 2014 Share Posted October 7, 2014 (edited) You need to use the same variable index in each of the arrays. You're probably better off not using arrays. Post whole script. Edited October 8, 2014 by HeresOtis Link to comment Share on other sites More sharing options...
nyolc8 Posted October 8, 2014 Author Share Posted October 8, 2014 I realized that the full script I wanted to do is not working in samp (only in SP), so I made it differently(lite version) and that doesn't required that much values so I just made it without variables lol Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now