[pomoc]ucitavanje objekta

Započeo nenad_zugec1, April 08, 2013, 20:57:46 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim:Edit jedan
Detaljan opis problema:Nezeli mi ucitati spremljene objete
Dio skripte:
public FUNCTION_LoadObjects()
{
	new DBResult:EDITOR_RESULT,IDX;
	EDITOR_RESULT = db_query(EDITOR_DATABASE,  "SELECT * FROM `OBJECTS`");
	if(db_num_rows(EDITOR_RESULT) > 0) // Logged In
	{
	    new EDITOR_VALEU[26][11],id;
        for (new x=0; x<db_num_rows(EDITOR_RESULT); x++)
		{
			IDX = 0;
		    db_get_field_assoc(EDITOR_RESULT, "ID", EDITOR_VALEU[IDX], 26),IDX++;
		    db_get_field_assoc(EDITOR_RESULT, "MODEL", EDITOR_VALEU[IDX], 26),IDX++;
		    db_get_field_assoc(EDITOR_RESULT, "X", EDITOR_VALEU[IDX],26),IDX++;
		    db_get_field_assoc(EDITOR_RESULT, "Y", EDITOR_VALEU[IDX],26),IDX++;
		    db_get_field_assoc(EDITOR_RESULT, "Z", EDITOR_VALEU[IDX],26),IDX++;
		    db_get_field_assoc(EDITOR_RESULT, "RX", EDITOR_VALEU[IDX],26),IDX++;
		    db_get_field_assoc(EDITOR_RESULT, "RY", EDITOR_VALEU[IDX],26),IDX++;
		    db_get_field_assoc(EDITOR_RESULT, "RZ", EDITOR_VALEU[IDX],26),IDX++;
		    db_get_field_assoc(EDITOR_RESULT, "VW", EDITOR_VALEU[IDX],26),IDX++;
		    db_get_field_assoc(EDITOR_RESULT, "INT", EDITOR_VALEU[IDX],26),IDX++;
		    db_get_field_assoc(EDITOR_RESULT, "DISTANCE", EDITOR_VALEU[IDX],26);

		    id = CreateDynamicObject(strval(EDITOR_VALEU[1]), floatstr( EDITOR_VALEU[2]),floatstr(EDITOR_VALEU[3]),floatstr(EDITOR_VALEU[4]), floatstr( EDITOR_VALEU[5]),floatstr(EDITOR_VALEU[6]),floatstr(EDITOR_VALEU[7]), strval(EDITOR_VALEU[8]), strval(EDITOR_VALEU[9]),-1, floatstr(EDITOR_VALEU[10]));

			if(id > DEF_MAX_OBJECTS) return SendClientMessageToAll(DEF_COL_WHITE,"Neuspjelo ucitavanje objekata pogledajte MAX_OBJEKATA.");

			EDITOR_OBJECT[id][OBJ_DB_ID] = strval(EDITOR_VALEU[0]);
            EDITOR_OBJECT[id][OBJ_MODEL] = strval(EDITOR_VALEU[1]);
            EDITOR_OBJECT[id][OBJ_X] = floatstr(EDITOR_VALEU[2]);
            EDITOR_OBJECT[id][OBJ_Y] = floatstr(EDITOR_VALEU[3]);
            EDITOR_OBJECT[id][OBJ_Z] = floatstr(EDITOR_VALEU[4]);
            EDITOR_OBJECT[id][OBJ_RX] = floatstr(EDITOR_VALEU[5]);
            EDITOR_OBJECT[id][OBJ_RY] = floatstr(EDITOR_VALEU[6]);
            EDITOR_OBJECT[id][OBJ_RZ] = floatstr(EDITOR_VALEU[7]);
            EDITOR_OBJECT[id][OBJ_VW] = strval(EDITOR_VALEU[8]);
            EDITOR_OBJECT[id][OBJ_INTERIOR] = strval(EDITOR_VALEU[9]);
            EDITOR_OBJECT[id][OBJ_STREAM_DISTANCE] = floatstr(EDITOR_VALEU[10]);
			db_next_row(EDITOR_RESULT);
	    }
	}
	new string[128];
	format(string,sizeof(string),"%d Objekta je uspjesno ucitano.",db_num_rows(EDITOR_RESULT));
	SendClientMessageToAll(DEF_COL_WHITE,string);
	db_free_result(EDITOR_RESULT);
	return 1;
}

Neke slike/video za lakse dobivanje pomoci(neobavezno)://



Citat: Lenon poslato April 11, 2013, 18:51:30 POSLE PODNE
pod koji public si stavio FUNCTION_LoadObjects?
Stavio sam pos OnGamemodeInit

Plugini su najnoviji stavljeni

Ili nozda nezeli spremiti pa nemoze niti nista ucitati
if(dialogid == DIALOG_NAPRAVI)
	{
	    if(!Numbers(inputtext)) return SendClientMessage(playerid,DEF_COL_RED,"Možete koristiti samo brojeve!"),ShowPlayerDialog(playerid,10000,DIALOG_STYLE_INPUT,"{A80000}Unesite ID objekta","Umetnite ID objekta koji želite stvoriti.","Napravi","Izlaz");
	    new Float:editor[3],id;
	    GetPlayerPos(playerid,editor[0],editor[1],editor[2]);
	    id = CreateDynamicObject(strval(inputtext), editor[0]+1, editor[1]+1, editor[2], 0.0,0.0,0.0, -1, -1, -1, 100.0);

		if(id > DEF_MAX_OBJECTS) return SendClientMessageToAll(DEF_COL_WHITE,"Neuspjelo spremanje objekata pogledajte MAX_OBJEKATA.");

     	EDITOR_OBJECT[id][OBJ_MODEL] = strval(inputtext);
        EDITOR_OBJECT[id][OBJ_X] = editor[0]+1;
        EDITOR_OBJECT[id][OBJ_Y] = editor[1]+1;
        EDITOR_OBJECT[id][OBJ_Z] = editor[2];
        EDITOR_OBJECT[id][OBJ_RX] = 0.0;
        EDITOR_OBJECT[id][OBJ_RY] = 0.0;
        EDITOR_OBJECT[id][OBJ_RZ] = 0.0;
        EDITOR_OBJECT[id][OBJ_VW] = -1;
        EDITOR_OBJECT[id][OBJ_INTERIOR] = -1;
        EDITOR_OBJECT[id][OBJ_STREAM_DISTANCE] = 100.0;
        EDIT_OBJECT_ID[playerid] = id;
        EditDynamicObject(playerid, id);

        new EDITOR_QUERY[256];
        format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "INSERT INTO `OBJECTS` (`MODEL`, `X`, `Y`, `Z`, `INT`) VALUES (%d,'%f','%f','%f',%d)",
		EDITOR_OBJECT[id][OBJ_MODEL],
		EDITOR_OBJECT[id][OBJ_X],
		EDITOR_OBJECT[id][OBJ_Y],
		EDITOR_OBJECT[id][OBJ_Z],
		id+1000);
		db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
	 	new DBResult:EDITOR_RESULT;
        format(EDITOR_QUERY,sizeof(EDITOR_QUERY),"SELECT `ID` FROM `OBJECTS` WHERE `INT`=%d",id+1000);
        EDITOR_RESULT = db_query(EDITOR_DATABASE,EDITOR_QUERY);
        if(db_num_rows(EDITOR_RESULT) == 1)
        {
            new temp[16];
            db_get_field(EDITOR_RESULT,0,temp,16);
		 	EDITOR_OBJECT[id][OBJ_DB_ID] = strval(temp);
		 	SendClientMessage(playerid,DEF_COL_WHITE,"Objekt ID primjenjen.");
        }
        db_free_result(EDITOR_RESULT);
		format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=-1 WHERE `ID`=%d",EDITOR_OBJECT[id][OBJ_DB_ID]);
		db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
        SendClientMessage(playerid,DEF_COL_WHITE,"Objekt spremljen u bazi, Koristite /urediobjekt ili /odaberiobjektza promjene na tom objektu.");
	}
Poslednja Izmena: April 13, 2013, 15:42:49 POSLE PODNE od nenad_zugec1