Enum to help me use Floats and Strings in Array
#1

Hi,

I am trying to make an array with details of a teleport point and their co-ordinates, since I have to use Strings and Floats, I thought I should use an Enumerator, I've done so but I'm getting the most bizarre error. I've tried searching but I can't seem to find any body with a similar error to me.

pawn Code:
enum e_Teles {
    TeleName[15],
    TeleCmd[15],
    Float:TeleX,
    Float:TeleY,
    Float:TeleZ
};

new Tele[][e_Teles] = {
    {"Dirty Drifting", "/D1", -294.9562, 1538.0388, 75.8341},
};
There error I'm getting is:
Code:
warning 228: length of initialler exceeds size of the enum field
Thanks
Reply
#2

Change TeleName[15] to TeleName[16]. String arrays need to include the closing character '\0', which requires an extra slot.
Reply
#3

Quote:
Originally Posted by Basssiiie
View Post
Change TeleName[15] to TeleName[16]. String arrays need to include the closing character '\0', which requires an extra slot.
I changed it to 16, it didn't work, I changed it to 20 to be safe, still didn't work.

EDIT: It is working now, the error was unrelated.. Sorry about my stupidity.
Reply
#4

Code:
    {"Dirty Drifting", "/D1", -294.9562, 1538.0388, 75.8341} //remove comma?
other than that it looks fine.
Reply
#5

It is working now, the error was unrelated.. Sorry about my stupidity.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)