06.09.2014, 10:53
Код:
CMD:housecreate(playerid, params[]) { new Query[500], amount, level, rows, fields, houseid = 0, str[150]; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorised to use that command."); if(sscanf(params, "id", level, amount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /housecreate [level] [price]"); new Float: x, Float: y, Float: z; new Float: ix, Float: iy, Float: iz; GetPlayerPos(playerid, x, y, z); ix = 2259.5205; iy = -1135.9044; iz = 1050.6328; if(level == 1) { strcat(Query,"INSERT INTO `houses`(`ID`, `Owner`, `Level`, `Price`,`PosX`,`PosY`,`PosZ`, `IPosX`, `IPosY`, `IPosZ`, `Interior`, `VirtualWorld`)"); strcat(Query," VALUES (NULL, '%s', '%d', '%d', '%f', '%f', '%f', '%f', '%f', '%f', 10, 0)"); mysql_format(dbHandle, Query, sizeof(Query), Query, "Server", level, amount, x, y, z, ix+1, iy, iz); mysql_query(dbHandle, Query, false); for(new i = 0; i<= MAX_HOUSES; i++) { mysql_format(dbHandle,Query, sizeof(Query), "SELECT * FROM `Houses` WHERE `ID` = '%d'", i); mysql_query(dbHandle,Query); cache_get_data(rows, fields); if(rows) { houseid = i; } } Load_House(houseid); format(str, sizeof(str), "Created house ID: %i", houseid); SendClientMessage(playerid, COLOR_GREY, str); format(str, sizeof(str), "PosX: %f | PosY: %f | PosZ: %f", x, y, z); SendClientMessage(playerid, COLOR_GREY, str); } return 1; }