Hours trying, I had to ask for help..
1 Attachment(s)
well, I am trying to change one little thing in one plugin... (attached)
(this plugin is for The Specialists mod) there are these lines: (I think you have to focus only at them) Quote:
and I would like to change it for something like this: (I tried and it didn't work properly) Quote:
Well, when I put this second code, it doesn't put in the fourth "%i" the value of the angle... I just want to know how to "%i" gets the right angle value.. please help me... =) I spend all the night with it, and I didn't get it working :cry: |
try something like
Code:
|
Quote:
I know that when the cript loads the four car informations (3 origins and 1 angle) it loads correctly, I know this bexause I changed manually the fourth value (the angle one) in carsfile.ini and there was the car looking at the right direction... look what contains in the carsfile.ini Code:
; CAR SPAWNS HEREbut if I change one of these, for example to: "amx_makecar car_polambo -980 -3015 -259 90" I know that the car will be at the same place, but turned 90 degrees... (Sorry my english again, maybe its not clear for you guys understand) |
come on people... I spend hours, one day trying to make this work :cry:
and until now, nothing =( |
I, I guess that your problem is that you are using %i for the angles[0] variable while angles is an array of floating point numbers. This should give you some weird values.
Try changing the fourth %i to %f edit: also, note that angles[0] is pitch, angles[1] is yaw and angles[2] is roll. I think at least. This shows which is which I guess: http://www.dform.com/gif/dirhead.gif |
Quote:
EDIT: IT WORKED... THANKYOU THANKYOU THANKYOU =D IT WAS SO SIMPLE... ARGH... Its what happen when you star codding without studing it before, lol... THANKYOU MAN I LOVE YOU =D I gave you all karma I could, lol... |
In case you are interested in the technical details...
"Normal" integer variables can only store whole numbers. Let's start with unsigned numbers. Unsigned means that the number doesn't have a sign - it's always positive. You don't really have these in Pawn IIRC but that's a different thing. In AMX Mod X, a variable is either 32 or 64 bit, depending on the architecture you run on. Anyway, with unsigned numbers, the variable simply contains the binary representation of the number it holds. For the decimal number 9, this would be 1001 for example. 7 would be 111. And so on. If you need to be able to store negative numbers as well, you usually reserve one bit for "sign"; usually the most significant bit; if this bit is 1, the number is negative. There are more used methods of storing negative integers; the most widely used one is the "two's complement" thing, I guess google will help you on these. Anyway, you can compute the decimal value of a binary number by doing: bit0 * 1 + bit1 * 2 + bit2 * 4 + bit3 * 8 + bit4 * 16 + bit5 * 32 + ... bit0 is the LSB, least significant bit, which you usually draw on the far right. ie. the number 13 would be stored like this in a 8 bit number: 00001101 this is: 1*1 + 0*2 + 1*4 + 1*8 + 0*16 + ... = 1 + 4 + 8 = 13 If you want to store numbers with decimal points, you have to pick a different storage method. Usually people use either fixed point numbers or floating point numbers. For some reason I associate fixed point numbers with banking software and such; in the PC and graphics world they're very rare. So, fixed point numbers store the whole part and the rest. ie. 13.37 would be stored as two separate numbers: 13 and 37. Floating point numbers, on the other hand, store the "mantissa" and the exponent. ie. they store 1337 as a whole and then tell you where to place the decimal point. Usually, computers use the "IEEE 754" standard for floating point numbers; for 32 bit numbers, it specifies 1 bit for sign, 8 bits for the exponent and 23 bits for mantissa. So if you store a floating point number and then interprete it as a "normal" integer, you will get weird, usually big results (big because the exponent is stored in the highest 9 bits (following the sign), so when it is non-zero, your binary number will get some pretty big value). I hope I could clarify this :) |
Nice... I got it... at least the idea... it's very nice the way it works. Thanks for the explanation... :D it shows the logic in something I would never find alone :lol:
Thank you... you rox.. :D |
Hey what is the command in the sql for carmod as items? I have spent soo much time trying out different things and looking? Can anyone help me?
|
Quote:
try copying other codes and made yourself one... I made one myself, but it's kind mess, works, but it's little confusing.... :wink: |
| All times are GMT -4. The time now is 20:13. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.