The one issue i have is that i cant make an admin part, like the one you would get so u can have all cars or assign people money or refund people etc. Any help would be much apriceated.
Thanks Rob, you might want to check the if statement because i had errors on that. the button code works but when your not an admin it displays Admin 0. But when you are an admin it shows Admin 1.
No! That is not a bug in the "if" statement. The so called bug is not a bug, its doing what it is intented. The reason you think its a bug is because you dont understand it.
Connections[GetConnIDX(UCID)].IsAdmin
That code returns a byte and its upto you to work out if they are an admin or not. if that returns 1 then they are. If it returns 0 then they are not. You cant just send that in a button and expect it to show everyone who is admin. The code that robbo posted will only show a button to a NewConnection if they are admin, Even then it will only report there admin status on the server. So please learn before calling this a bug.
A byte is a method for storing a unit of information, which nowadays is most commonly a value made up of eight bits (binary digits) that can store an integer between 0 and 255. This can vary of course between different platforms, although it's pretty standardised these days.
Edit:
Useless Fact:
In bygone days the size of a byte on a specific platform was however large it needed to be to store all the characters on that platforms character sheet, meaning the size could vary from computer to computer. With the advent of the IBM's 8-bit microprocessor and popularisation of 8-bit ANSI characters, it become more or less fixed at 8 bits to a byte. As a byte was sized for storing characters, the size of the next value-type above it became known as a 'word', as a word could store multiple characters.
Are you sure about that? Have you checked to see if that's true? I don't know, but I'm pretty sure memory on a 32 bit microprocessor is designed for 32 bit values, or Int32's in C#. Whether you are storing a byte or an int, it will still take up the same space in memory. I could very well be wrong, but something at the back of my mind tells me I'm not.
Queue someone who knows way more about this than I do correcting me.
Edit: In fact, thinking about it more, I'm pretty sure this is the reason for the loss of precision when using float values.
EDit2: Also whether a value is signed or unsigned, it still uses the same amount of bytes...
That pic mentions nothing about how a specific computer platform allocates memory, only how many bytes are used to describe each of the values. Anyway, I may be wrong, I never studied computer science, I just hack code together.
In most modern computer systems, the memory addressing is single-byte addressing, meaning that each byte (8 bits) is addressed, rather than any bigger chunk - so there's no cost to storing something of a single byte in length. Additionally, storing a 4-byte (32-bit) integer, for example, is no real cost, as it's only the first memory address that's of much use to you anyway. If you know it's a 32-bit data type, you just read 4 bytes from the memory address. The only problem with addressing comes when using things like packed booleans, (or other packed data types), as the addressing unit encompasses multiple data items.
As for the signed/unsigned, there is no difference in size between a data type's signed and unsigned permutations - and they do exactly what they say, one allows for signs (i.e. allows for negative numbers) by 'putting' zero in the middle of the range and the other doesn't (with zero at the lower end).
With 32-bit systems, the 32-bit aspect of it basically means (considering memory usage only, in this case) that 32-bit memory addresses are used, rather than can only assign 32-bit blocks. What this means is that a 64-bit machine can address that many more memory locations than a 32-bit system - because the address bus is larger The addressed unit is still relatively standardised at 1 byte. (However, it must be said that just because something is 32-bit, doesn't mean it's memory addressing is 32-bit, it can be higher or lower - but the above is a general rule.)
32-bit addressing allows 2^32 addresses (4GiB), whilst 64-bit allows 2^64 (16EiB). One of the primary reasons the change to 64-bit was made was to increase the memory addressing space. And if we reach 16 Exbibytes any time in the next several hundred years, I'll be surprised.
i understand how to get it to come up on certain player's screens (record the admins), but i dont know how to get the actual info, i tried doing e.g a button for a username [0] one for [1] [2] [3] [4] etc, but what would you do when you reach 8?
also, is there a bit that is like an integer(int) except it sends text instead of numbers, is this a string?
what i mean is if you wantri a whole number you put an 'int' infront of it and 'decimal' infront if you want a decimal but do you need to put anything if it is for text?
Not really, the things you put before a piece of data in a programming language is called the data type. For a whole number, you tend to use 'int' (or 'double'/'long' for much larger numbers), for a decimal you tend to use 'float', and for text you use String
Best thing to do is to go and read up on Data Types in <your language here> and see what it has to say
is there a piece of data in the MCI.Info bit about which set of 8 it is so you can do more than 8? so if there is more than 8 players/connections
EDIT: i have found this in the insim .txt
"#define CCI_FIRST 64 // this is the first compcar in this set of MCI packets
#define CCI_LAST 128 // this is the last compcar in this set of MCI packets
// NOTE 2) Heading : 0 = world y axis direction, 32768 = 180 degrees, anticlockwise from above
// NOTE 3) AngVel : 0 = no change in heading, 8192 = 180 degrees per second anticlockwise
struct IS_MCI // Multi Car Info - if more than 8 in race then more than one of these is sent
{
byte Size; // 4 + NumP * 28
byte Type; // ISP_MCI
byte ReqI; // 0 unless this is a reply to an TINY_MCI request
byte NumC; // number of valid CompCar structs in this packet
CompCar Info[8]; // car info for each player, 1 to 8 of these (NumC)"
could someone try their best to explain how you would get all their info up past 8
AFAIK, it will do it itself. Example: You are using MCI.Info[0].Speed. This is the speed of connection 1. But if there are more than 8 people, more than one packet is sent. So MCI.Info[0].Speed it would work for Connection 9, 17, 25, etc.
That's what I think happens anyways...
It was said to me many times, but it's only now I actually see how it happens
Vane, don't be confused by my post. My post was not referring to how InSim handles things, it was referring to the general principle of memory addressing and data types as brought up by DarkTimes You need not worry about the number 8, as it will have little or no effect on you in the scope of InSim development. As dougie says, you MCI.Info[] works for any number