somone understands enum? just a question
#1

so heres basicly my code
pawn Код:
enum TICKET_INFO{
    Sender[MAX_PLAYER_NAME],
    Amout
}
new Ticket[TICKET_INFO][MAX_PLAYERS];
now I want to write something in
pawn Код:
Ticket[Sender][playerid]
so I use the command "format" I usualy use "sizeof(" to get the size of the string, but now its gives an erorr message, I tried alot, and searched for examples, but found nothing, I know I can use just "MAX_PLAYER_NAME" as the size, but there are other problems that need the same solution, so is there anyway to get the size of "Sender"? I will happy to get an answer...

PS
I did serched, I read PAWN PDF and WIKI, but they didn't showed me how to solve this.
Reply
#2

new Ticket[playerid][Sender];
You had it the other way around.
Reply
#3

EDIT:

Have you tried:
pawn Код:
sizeof(Ticket[Sender][]);

or

sizeof(Ticket[Sender][playerid]);
If that doesnt work, turn the array around to
pawn Код:
new Ticket[MAX_PLAYERS][TICKET_INFO];
And try:
pawn Код:
sizeof(Ticket[playerid][Sender]);

or

sizeof(Ticket[][Sender]);
If those doesnt work, I believe you should just use MAX_PLAYER_NAME as the size.
Reply
#4

pawn Код:
enum TICKET_INFO
{
    Sender[MAX_PLAYER_NAME],
    Amount
}
new Ticket[MAX_PLAYERS][TICKET_INFO];
We've given you more then enough info to fix this.
Reply
#5

pawn Код:
new cool=sizeof(Ticket[playerid][Sender]);
and the erorrs:
Код:
E:\Prison Break\SA-MP 0.3\Prison.PWN(582) : error 001: expected token: "]", but found "-identifier-"
E:\Prison Break\SA-MP 0.3\Prison.PWN(582) : warning 215: expression has no effect
E:\Prison Break\SA-MP 0.3\Prison.PWN(582) : error 001: expected token: ";", but found "]"
E:\Prison Break\SA-MP 0.3\Prison.PWN(582) : error 029: invalid expression, assumed zero
E:\Prison Break\SA-MP 0.3\Prison.PWN(582) : fatal error 107: too many error messages on one line
same for:
pawn Код:
new cool=sizeof(Ticket[][Sender]);
its like I have to get the size somehow using "TICKET_INFO" and not "Ticket"
like now I use another variable
pawn Код:
new TicketTemp[TICKET_INFO];
and thats how it works[for now]:
pawn Код:
format(Ticket[playerid][Sender],sizeof(TicketTemp[Sender]),"NULL");
and from some strange reason
pawn Код:
format(Ticket[playerid][Sender],sizeof(Ticket[][]),"NULL");
compiles without erorr, but as soo as I add something bettwen any [][] its gives an erorr like its should stay empty... I don't understand what size does he gets from this, but I don't think its the size I need

and when I try
pawn Код:
format(Ticket[playerid][Sender],sizeof(Sender),"NULL");
the erorr is:
Код:
E:\Prison Break\SA-MP 0.3\Prison.PWN(584) : error 039: constant symbol has no size
its very strange
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)