SA-MP Forums Archive
Variable in Enum request - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Variable in Enum request (/showthread.php?tid=276626)



Variable in Enum request - baske007 - 14.08.2011

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


AW: Variable in Enum request - samtey - 14.08.2011

Line?


Re: Variable in Enum request - baske007 - 14.08.2011

The format line ofcourse.


AW: Variable in Enum request - samtey - 14.08.2011

Why two times param?

Remove [param], or is it an array?


Re: Variable in Enum request - baske007 - 14.08.2011

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


Re: Variable in Enum request - Michael@Belgium - 14.08.2011

show your "new enum" part


Re: Variable in Enum request - baske007 - 14.08.2011

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



Re: Variable in Enum request - Michael@Belgium - 14.08.2011

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



Re: Variable in Enum request - baske007 - 14.08.2011

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?


Re: Variable in Enum request - Michael@Belgium - 14.08.2011

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