Enum to help me use Floats and Strings in Array - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Enum to help me use Floats and Strings in Array (
/showthread.php?tid=431161)
Enum to help me use Floats and Strings in Array -
Shoulen - 16.04.2013
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
Re: Enum to help me use Floats and Strings in Array -
Basssiiie - 16.04.2013
Change TeleName[15] to TeleName[16]. String arrays need to include the closing character '\0', which requires an extra slot.
Re: Enum to help me use Floats and Strings in Array -
Shoulen - 16.04.2013
Quote:
Originally Posted by Basssiiie
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.
Re: Enum to help me use Floats and Strings in Array -
Gh05t_ - 16.04.2013
Code:
{"Dirty Drifting", "/D1", -294.9562, 1538.0388, 75.8341} //remove comma?
other than that it looks fine.
Re: Enum to help me use Floats and Strings in Array -
Shoulen - 16.04.2013
It is working now, the error was unrelated.. Sorry about my stupidity.