Line(4248) : error 032: array index out of bounds
#1

Hello Guys!! I'm kinda making a command to promote players to a specific thing and i decided to make the PromoteName which is one of the cmd parameters "sscanf" as a text instead of an integer. But an error appears.
Somebody please tell me how should the index work?!

pawn Код:
new promotename[10]; //it's one of the sscanf parameters
if(promotename[10] == "admin") // (Line 4248) instead of "promotename == integer" if the promotename is not indexed with [10]
{
    //rest of code
    return 1;
}
Reply
#2

Use strcmp to compare strings
Reply
#3

I don't get what is the usage of strcmp in this case !
Reply
#4

pawn Код:
new promotename[10]; //it's one of the sscanf parameters
if(!strcmp(promotename, "admin")) // (Line 4248) instead of "promotename == integer" if the promotename is not indexed with [10]
{
    //rest of code
    return 1;
}
Reply
#5

Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)