#define FILTERSCRIPT #include #include #include #include #include //=======CUSTOM SETTINGS=======// #undef MAX_OBJECTS #define MAX_OBJECTS 5 #define MINX 0.25 #define MINY 0.25 #define MINZ 0.25 #define MAXX 3.00 #define MAXY 3.00 #define MAXZ 3.00 //=============================// //===========CHANGES===========// #define MYSQL_USERS_TABLE "rp_accounts" #define MYSQL_ID_FIELDNAME "ID" #define MYSQL_NAME_FIELDNAME "Username" #define MYSQL_ID_INDEX 0 //=============================// new objectlist = mS_INVALID_LISTID; enum oData { bool:used1, index1, modelid1, bone1, Float:fOffsetX1, Float:fOffsetY1, Float:fOffsetZ1, Float:fRotX1, Float:fRotY1, Float:fRotZ1, Float:fScaleX1, Float:fScaleY1, Float:fScaleZ1 } new oInfo[MAX_PLAYERS][MAX_OBJECTS][oData]; new inindex[MAX_PLAYERS], inmodel[MAX_PLAYERS], pID[MAX_PLAYERS]; public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Advanced Objects System Loaded v2.3"); print(" Editor: Shinja"); print("--------------------------------------\n"); mysql_tquery(1, "CREATE TABLE IF NOT EXISTS `Objects` (`ID` int(5) NOT NULL,`Index` int(2) NOT NULL,`Model` int(7) NOT NULL,`Bone` int(2) NOT NULL,`OffsetX` float NOT NULL,`OffsetY` float NOT NULL,`OffsetZ` float NOT NULL,`RotX` float NOT NULL,`RotY` float NOT NULL,`RotZ` float NOT NULL,`ScaleX` float NOT NULL,`ScaleY` float NOT NULL,`ScaleZ` float NOT NULL)"); objectlist = LoadModelSelectionMenu("objects.txt"); return 1; } public OnFilterScriptExit() { mysql_close(); return 1; } public OnPlayerConnect(playerid) { new name[24]; GetPlayerName(playerid, name, 24); for(new i, j=MAX_OBJECTS; i MAXX) ? (MAXX) : (fScaleX)); fScaleY = (fScaleY < MINY) ? (MINY) : ((fScaleY > MAXY) ? (MAXY) : (fScaleY)); fScaleZ = (fScaleZ < MINZ) ? (MINZ) : ((fScaleZ > MAXZ) ? (MAXZ) : (fScaleZ)); oInfo[playerid][index][fOffsetX1] = fOffsetX; oInfo[playerid][index][fOffsetY1] = fOffsetY; oInfo[playerid][index][fOffsetZ1] = fOffsetZ; oInfo[playerid][index][fRotX1] = fRotX; oInfo[playerid][index][fRotY1] = fRotY; oInfo[playerid][index][fRotZ1] = fRotZ; oInfo[playerid][index][fScaleX1] = fScaleX; oInfo[playerid][index][fScaleY1] = fScaleY; oInfo[playerid][index][fScaleZ1] = fScaleZ; } new query[60]; SendClientMessage(playerid, -1, "Object {0DFF00}Saved!"); SetPlayerAttachedObject(playerid, index, modelid, boneid, oInfo[playerid][index][fOffsetX1], oInfo[playerid][index][fOffsetY1], oInfo[playerid][index][fOffsetZ1], oInfo[playerid][index][fRotX1], oInfo[playerid][index][fRotY1], oInfo[playerid][index][fRotZ1], oInfo[playerid][index][fScaleX1], oInfo[playerid][index][fScaleY1], oInfo[playerid][index][fScaleZ1]); mysql_format(1, query, sizeof(query), "SELECT * FROM `Objects` WHERE `Index` = %d AND `ID` = %d", index, pID[playerid]); mysql_tquery(1, query, "OnObjectSave", "iiii", playerid, index, modelid, boneid); return 1; } forward OnObjectSave(playerid, index, modelid, boneid); public OnObjectSave(playerid, index, modelid, boneid) { new query[150]; if(!cache_num_rows()){ mysql_format(1, query, sizeof(query), "INSERT INTO `Objects` (`ID`,`Index`,`Model`,`Bone`,`OffsetX`,`OffsetY`,`OffsetZ`) VALUES (%d,%d,%d,%d,%f,%f,%f)",pID[playerid], index, modelid, boneid, oInfo[playerid][index][fOffsetX1], oInfo[playerid][index][fOffsetY1], oInfo[playerid][index][fOffsetZ1]); mysql_tquery(1, query); mysql_format(1, query, sizeof(query), "UPDATE `Objects` SET `RotX` = %f, `RotY` = %f, `RotZ` = %f, `ScaleX` = %f, `ScaleY` = %f, `ScaleZ` = %f WHERE `ID` = %d AND `Index` = %d",oInfo[playerid][index][fRotX1], oInfo[playerid][index][fRotY1], oInfo[playerid][index][fRotZ1], oInfo[playerid][index][fScaleX1], oInfo[playerid][index][fScaleY1], oInfo[playerid][index][fScaleZ1], pID[playerid], oInfo[playerid][index][index1]); mysql_tquery(1, query);} mysql_format(1, query, sizeof(query), "UPDATE `Objects` SET `Model` = %d,`Bone` = %d,`OffsetX` = %f,`OffsetY` = %f,`OffsetZ` = %f WHERE `ID` = %d AND `Index` = %d",modelid, boneid, oInfo[playerid][index][fOffsetX1], oInfo[playerid][index][fOffsetY1], oInfo[playerid][index][fOffsetZ1], pID[playerid], oInfo[playerid][index][index1]); mysql_tquery(1, query); mysql_format(1, query, sizeof(query), "UPDATE `Objects` SET `RotX` = %f, `RotY` = %f, `RotZ` = %f, `ScaleX` = %f, `ScaleY` = %f, `ScaleZ` = %f WHERE `ID` = %d AND `Index` = %d",oInfo[playerid][index][fRotX1], oInfo[playerid][index][fRotY1], oInfo[playerid][index][fRotZ1], oInfo[playerid][index][fScaleX1], oInfo[playerid][index][fScaleY1], oInfo[playerid][index][fScaleZ1], pID[playerid], oInfo[playerid][index][index1]); mysql_tquery(1, query); }