Anything wrong?
#1

Hi

I don't got errors/warrnings, but once i try it in game, it works, but the "unknown command" msg show up too, only in this command, if i type another command, it works perfectly..
Код:
CMD:createobject(playerid, params[])
{
	if(!(PlayerInfo[playerid][pAdmin] >= 4)) return SCM(playerid, COLOR_GREY,  "You can't use this command.");
	new oid,omodel,string[128],Float:Pos[3];
	GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]);
	if(sscanf(params, "dd",oid,omodel)) return SCM(playerid, COLOR_WHITE, "USAGE: /createobject [id] [modelid]");
	if(oid >= MAX_GATES) return SCM(playerid, COLOR_WHITE, "Invalid ID.");
	if(oinfo[oid][oactive] == 0)
	{
	    oinfo[oid][ox] = Pos[0];
	    oinfo[oid][oy] = Pos[1];
	    oinfo[oid][oz] = Pos[2];
	    oinfo[oid][oactive] = 1;
	    oinfo[oid][objectid] = omodel;
	    oinfo[oid][modelid] = CreateDynamicObject(oinfo[oid][objectid],oinfo[oid][ox],oinfo[oid][oy],oinfo[oid][oz],180,180,90,-1,-1,-1,200.0);
	    format(string,sizeof(string), "You have created an object with ID %d and model %d",oid,omodel);
	    SCM(playerid, COLOR_YELLOW, string);
	    SaveAllObjects();
	}
	else
	{
	    SCM(playerid, COLOR_WHITE, "This object is already used.");
	}
	return 1;
}
Reply
#2

Install crashdetect and compile with debug info.
Then post the server log it creates here.
Reply
#3

Done and always no errors/warnings
Reply
#4

Edit
I got this
Код:
[18:16:08] [debug] Run time error 4: "Array index out of bounds"
[18:16:08] [debug] AMX backtrace:
[18:16:08] [debug] #0 00048618 in SaveAllObjects ()
[18:16:08] [debug] #1 00069ab4 in public cmd_createobject (playerid=0, params[]=@01651fd0 "20 795") 
[18:16:08] [debug] #2 native CallLocalFunction () from samp-server.exe
[18:16:08] [debug] #3 0003bfa0 in public OnPlayerCommandText (playerid=0, cmdtext[]=@01651f7c "/createobject 20 795")
a problem in SaveAllObjects()?
Reply
#5

Yes, please post that function.
Reply
#6

SOLVED.
Reply
#7

Post the full reports from crashdetect because you did not post about what index it tries to access element. You did not compile with debug info as Stinged suggested as well.

EDIT: Okay, you got it fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)