Привет не спит.
Решил задать вопрос на тему системы мебели.
Писал систему сам,а криво только сохраняет корды объекта.И загружаю уже Z выше и криво получается,потом по X,Y криво.
Вот код:
PHP код:
publics LoadFurniture()
{
new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
for(new i; i < rows; i++)
{
FInfo[i][f_ID] = cache_get_field_content_int(i, "fID", MysqlConnect_ID);
FInfo[i][f_model] = cache_get_field_content_int(i, "fmodel", MysqlConnect_ID);
FInfo[i][f_x] = cache_get_field_content_float(i, "fx", MysqlConnect_ID);
FInfo[i][f_y] = cache_get_field_content_float(i, "fy", MysqlConnect_ID);
FInfo[i][f_z] = cache_get_field_content_float(i, "fz", MysqlConnect_ID);
FInfo[i][f_rootx] = cache_get_field_content_float(i, "frootx", MysqlConnect_ID);
FInfo[i][f_rooty] = cache_get_field_content_float(i, "frooty", MysqlConnect_ID);
FInfo[i][f_rootz] = cache_get_field_content_float(i, "frootz", MysqlConnect_ID);
FInfo[i][f_virtual] = cache_get_field_content_int(i, "fvirtualWorld", MysqlConnect_ID);
FInfo[i][f_int] = cache_get_field_content_int(i, "fint", MysqlConnect_ID);
FInfo[i][f_ID] = CreateDynamicObject(FInfo[i][f_model], FInfo[i][f_x], FInfo[i][f_y], FInfo[i][f_z], FInfo[i][f_rootx], FInfo[i][f_rooty], FInfo[i][f_rootz], FInfo[i][f_virtual], FInfo[i][f_int]);
FInfo[i][f_ID] = furniture_object;
}
}
return 1;
}
Сохранение:
PHP код:
stock Furniture_Mysql(i)
{
new str[1054];
format(str, sizeof(str), "INSERT INTO `furniture` (`fID`, `fmodel`, `fx`, `fy`, `fz`, `frootx`, `frooty`, `frootz`, `fvirtualWorld`, `fint`) VALUES ('%i', '%i', '%f', '%f', '%f', '%f', '%f', '%f', '%i', '%i')",
i, FInfo[i][f_model], FInfo[i][f_x], FInfo[i][f_y], FInfo[i][f_z], FInfo[i][f_rootx], FInfo[i][f_rooty], FInfo[i][f_rootz], FInfo[i][f_virtual], FInfo[i][f_int]);
mysql_function_query(MysqlConnect_ID, str, false, "", "");
printf("\n\n\%s\n\n",str);
return 1;
}
PHP код:
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
if(!playerobject)
{
if(!IsValidObject(objectid))
return 1;
MoveObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
}
if(response == EDIT_RESPONSE_FINAL)
{
FInfo[furniture_object][f_x] = fX;
FInfo[furniture_object][f_y] = fY;
FInfo[furniture_object][f_z] = fZ;
FInfo[furniture_object][f_rootx] = fRotX;
FInfo[furniture_object][f_rooty] = fRotY;
FInfo[furniture_object][f_rootz] = fRotZ;
FInfo[furniture_object][f_virtual] = GetPlayerVirtualWorld(playerid);
FInfo[furniture_object][f_int] = GetPlayerInterior(playerid);
FInfo[furniture_object][f_model] = GetObjectModel(furniture_object);
Furniture_Mysql(furniture_object);
CancelEdit(playerid);
SendClientMessage(playerid,COLOR_WHITE, "Мебель установлена");
return 1;
}
if(response == EDIT_RESPONSE_CANCEL)
{
SendClientMessage(playerid, -1, "Установка мебели отменена");
DestroyObject(furniture_object);
furniture_object -= 1;
CancelEdit(playerid);
return 1;
}
return 1;
}
Сам диалог:
PHP код:
case 26:
{
if(response)
{
new model = strval(inputtext);
if(PlayerInfo[playerid][pWarehouse] < 30)
return SendClientMessage(playerid, COLOR_Copy, " Для создания мебели надо 30 материалов! ");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
furniture_object = CreateObject(model, x, y, z, 0, 0, 0);
EditObject(playerid, furniture_object);
printf("Объект с id %i создан", furniture_object);
return 1;
}
}
Скажите почему криво сохраняет?
Ожидаю ответ)
______________________________________
Всё решено))))