if(!strcmp(cmdtext,"/blabla", true, 8))
{
new teststring[11] = "somestring";
print(teststring);
return 1;
}
if(!strcmp(cmdtext,"/oblabla", true, 8))
{
new teststring[11] = "somestring";
print(teststring);
return 1;
}
if(!strcmp(cmdtext,"/read", true, 5))
{
new file[14] = "ScoreList.ini";
if(!xini_exist(file))
{
xini_create(file);
}
new Kills[10][256], KillsName[10][256], KillsValue[10], tmpp[256], vstring[2];
for(new v=0; v<10; v++)
{
valstr(vstring, v);
Kills[v] = xini_get(file,"Kills",vstring,true); //full string
KillsName[v] = extract(Kills[v], 0); //name (1st part)
tmpp = extract(Kills[v], 1); KillsValue[v] = strval(tmpp); //value (2nd part)
format(String, sizeof String, "%s %i", KillsName[v], KillsValue[v]);
SendClientMessage(20, COLOR_BASIC, String);
}
return 1;
}
if(!strcmp(cmdtext,"/oread", true, 6))
{
new file[14] = "ScoreList.ini";
if(xini_exist(file))
{
new Kills[10][256], KillsName[10][256], KillsValue[10], tmpp[256], vstring[2];
for(new v=0; v<10; v++)
{
valstr(vstring, v);
Kills[v] = xini_get(file,"Kills",vstring,true); //full string
KillsName[v] = extract(Kills[v], 0); //name (1st part)
tmpp = extract(Kills[v], 1); KillsValue[v] = strval(tmpp); //value (2nd part)
format(String, sizeof String, "%s %i", KillsName[v], KillsValue[v]);
SendClientMessage(20, COLOR_BASIC, String);
}
format(String, sizeof String, "~b~ScoreList Kills:~n~~n~~w~1: %24s %i~n~2: %24s %i~n~3: %24s %i~n~4: %24s %i~n~5: %24s %i~n~6: %24s %i~n~7: %24s %i~n~8: %24s %i~n~9: %24s %i~n~10: %24s %i~n~",
KillsName[0], KillsValue[0], KillsName[1], KillsValue[1], KillsName[2], KillsValue[2], KillsName[3], KillsValue[3], KillsName[4], KillsValue[4], KillsName[5],
KillsValue[5], KillsName[6], KillsValue[6], KillsName[7], KillsValue[7], KillsName[8], KillsValue[8], KillsName[9], KillsValue[9]);
SendInfoText(playerid, 0, 200, String);
PlayerPlaySound(playerid, CheckSound, 0.0, 0.0, 0.0);
}
else
{
PlayerPlaySound(playerid, ErrorSound, 0.0, 0.0, 0.0);
SendInfoText(playerid, 1200, 103, "~r~Error_o.O");
}
return 1;
}
|
Originally Posted by 0rb
What was wrong with your old topic where i pointed your mistake?
|
|
Originally Posted by dice7
Just put
new file[14] = "ScoreList.ini"; on top of the callback |
|
Originally Posted by 0rb
First you have to know that the compiler can't be perfect and will never show you the exact problem of your script. In your case the compiler give this warning because something went wrong probably when allocating the memory for your variables in that function.
By default, only (but that is more than enough) around 4000 cells can be allocated in a function. You function exceed this limit by almost 3 times. I bet if you change those [10][256] by for exemple [10][25], that warning will disappear. As i said in your previous topic, if you need big variables that will use more than 4000 cells, place them at the top of your script. I personally place most of variables, big or not, at the top of my scripts. |
|
I personally place most of variables, big or not, at the top of my scripts. |