Set enum from string
#1

Well what I'd like to do is set an enum value from a string;

Example
pawn Код:
format(string, 8, "something");
CarSystem[i][some] = string;
But It gives me;

error 006: must be assigned to an array
Assigned to an array? What does that mean?

(Never worked with It before)
Reply
#2

You have to use format directlyon tge enum

Format(CarSystem[i][some],64,"%s",cheese);
Reply
#3

Thank you, that worked.
Reply
#4

Use strcat(), it's a much more efficient method in comparison to format() for copying strings.
Reply
#5

Quote:
Originally Posted by Calgon
Посмотреть сообщение
Use strcat(), it's a much more efficient method in comparison to format() for copying strings.
Thank you, but It's only going to be done upon starting the server.
Reply
#6

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
Thank you, but It's only going to be done upon starting the server.
strmid also does the same : ))
Reply
#7

Remember it for the future, personally I'd change the code, mainly because it's just one single line that makes a moderate difference.

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
strmid also does the same : ))
strmid is used to extract characters from a string, not to just copy single strings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)