Variable in Enum request
#1

Hello everyone,

Got a little problem. I created a command so I can read player variables:

pawn Код:
CMD:debug(playerid, params[])
{
    new user, param[10];
    sscanf(params, "us[10]", user, param);
    new message[100];
    format(message, sizeof(message), "Userid: %i   Param: %s   Value: %s", user, param, playerinfo[user][param]);
    SendClientMessage(playerid, COLOR_GREY, message);
    return 1;
}
Sad enough I get the error: error 033: array must be indexed (variable "param"). Any ideas?

Thanks!

Bas
Reply
#2

Line?
Reply
#3

The format line ofcourse.
Reply
#4

Why two times param?

Remove [param], or is it an array?
Reply
#5

playerinfo is an enum. I want to be able to do it like this: \debug Bas job.
Reply
#6

show your "new enum" part
Reply
#7

pawn Код:
enum pvars{did, loggedin, playername[MAX_PLAYER_NAME], .............20 more};
new playerinfo[MAX_PLAYERS][pvars];
Reply
#8

Quote:
Originally Posted by baske007
Посмотреть сообщение
pawn Код:
enum pvars{did, loggedin, playername[MAX_PLAYER_NAME], .............20 more};
new playerinfo[MAX_PLAYERS][pvars];
Well i think you've to add "[x]" in your enum after param

pawn Код:
enum param[10]//or something xp
Reply
#9

How u mean? param is just a variable that is declared in the sscanf at the command.
..

This is how it should work:
\debug bas alevel

This should give me my name, "alevel" and 100 (this is my admin level).
Just a universal command to get player variables.

Bas

EDIT: It looks that you don't exactly know what you are talking about?
Reply
#10

Quote:
Originally Posted by baske007
Посмотреть сообщение
How u mean? param is just a variable that is declared in the sscanf at the command.
..

This is how it should work:
\debug bas alevel

This should give me my name, "alevel" and 100 (this is my admin level).
Just a universal command to get player variables.

Bas

EDIT: It looks that you don't exactly know what you are talking about?
Lol, i know what im talking about xD It's the error you know At what line did he gave that error ? And show me the line xp
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)