if(strcmp(cmd, "/createhouse", true) == 0) { if(!strcmp(PlayerName(playerid), "Ayyash")) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_ERROR, "Syntax: /createhouse (price) (interior[1-10]) (slots)"); return 1; } new price; //stock AddHouse(playerid, price, interior, slots) price = strvalEx(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_ERROR, "Syntax: /createhouse (price) (interior[1-10]) (slots)"); return 1; } new interior; interior = strvalEx(tmp); if(interior < 0 || interior > 10) { SendClientMessage(playerid, COLOR_ERROR, "Interior ID's are 1-10."); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_ERROR, "Syntax: /createhouse (price) (interior[1-10]) (slots)"); return 1; } new slots; slots = strvalEx(tmp); if(slots > 50) { SendClientMessage(playerid, COLOR_ERROR, "Maximum slots for a house is 50."); return 1; } AddHouse(playerid, price, interior, slots); return 1; } }
stock AddHouse(playerid, price, interior, slots) { new Float:X, Float:Y, Float:Z, Float:IntX, Float:IntY, Float:IntZ, IntID; GetPlayerPos(playerid, X, Y, Z); new houseLocation[50]; new string[64]; format(string,sizeof(string),"%s",GetPlayerArea(playerid)); mysql_real_escape_string(string,string); strmid(houseLocation, string, 0, strlen(string), 128); new query[400]; if(price < 1000) { SendClientMessage(playerid, COLOR_ERROR, "Minimum house price: $1000"); return 1; } if(slots > 50) { SendClientMessage(playerid, COLOR_ERROR, "Maximum house slots: 50"); return 1; } if(interior == 1) // rubbish interior { IntID = 5; IntX = 2233.6438; IntY = -1115.2596; IntZ = 1050.8828; format(query,sizeof(query),"INSERT INTO `houses` (OwnedBy, Location, Interior, iX, iY, iZ, eX, eY, eZ, DefaultPrice, Slots) VALUES ('None', '%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",houseLocation,IntID,IntX,IntY,IntZ,X,Y,Z,price,slots); } else if(interior == 2) // meh shit. { IntID = 10; IntX = 2259.3855; IntY = -1135.9241; IntZ = 1050.6403; format(query,sizeof(query),"INSERT INTO `houses` (OwnedBy, Location, Interior, iX, iY, iZ, eX, eY, eZ, DefaultPrice, Slots) VALUES ('None', '%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",houseLocation,IntID,IntX,IntY,IntZ,X,Y,Z,price,slots); } else if(interior == 3) // meh shit. { IntID = 2; IntX = 226.7864; IntY = 1239.9783; IntZ = 1082.1406; format(query,sizeof(query),"INSERT INTO `houses` (OwnedBy, Location, Interior, iX, iY, iZ, eX, eY, eZ, DefaultPrice, Slots) VALUES ('None', '%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",houseLocation,IntID,IntX,IntY,IntZ,X,Y,Z,price,slots); } else if(interior == 4) // meh shit. { IntID = 15; IntX = 295.0522; IntY = 1472.2555; IntZ = 1080.2578; format(query,sizeof(query),"INSERT INTO `houses` (OwnedBy, Location, Interior, iX, iY, iZ, eX, eY, eZ, DefaultPrice, Slots) VALUES ('None', '%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",houseLocation,IntID,IntX,IntY,IntZ,X,Y,Z,price,slots); } else if(interior == 5) // meh shit. { IntID = 5; IntX = 226.2965; IntY = 1114.2430; IntZ = 1080.9929; format(query,sizeof(query),"INSERT INTO `houses` (OwnedBy, Location, Interior, iX, iY, iZ, eX, eY, eZ, DefaultPrice, Slots) VALUES ('None', '%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",houseLocation,IntID,IntX,IntY,IntZ,X,Y,Z,price,slots); } else if(interior == 6) // meh shit. { IntID = 9; IntX = 83.0425; IntY = 1322.2850; IntZ = 1083.8662; format(query,sizeof(query),"INSERT INTO `houses` (OwnedBy, Location, Interior, iX, iY, iZ, eX, eY, eZ, DefaultPrice, Slots) VALUES ('None', '%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",houseLocation,IntID,IntX,IntY,IntZ,X,Y,Z,price,slots); } else if(interior == 7) // meh shit. { IntID = 5; IntX = 140.2526; IntY = 1365.9304; IntZ = 1083.8594; format(query,sizeof(query),"INSERT INTO `houses` (OwnedBy, Location, Interior, iX, iY, iZ, eX, eY, eZ, DefaultPrice, Slots) VALUES ('None', '%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",houseLocation,IntID,IntX,IntY,IntZ,X,Y,Z,price,slots); } else if(interior == 8) // meh shit. { IntID = 6; IntX = 234.0677; IntY = 1063.7198; IntZ = 1084.2123; format(query,sizeof(query),"INSERT INTO `houses` (OwnedBy, Location, Interior, iX, iY, iZ, eX, eY, eZ, DefaultPrice, Slots) VALUES ('None', '%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",houseLocation,IntID,IntX,IntY,IntZ,X,Y,Z,price,slots); } else if(interior == 9) // meh shit. { if(price < 10000000) { SendClientMessage(playerid, COLOR_ERROR, "Price must be $10m or over for this interior!"); return 1; } IntID = 3; IntX = -2636.7124; IntY = 1402.9630; IntZ = 906.4609; format(query,sizeof(query),"INSERT INTO `houses` (OwnedBy, Location, Interior, iX, iY, iZ, eX, eY, eZ, DefaultPrice, Slots) VALUES ('None', '%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",houseLocation,IntID,IntX,IntY,IntZ,X,Y,Z,price,slots); } else if(interior == 10) // meh shit. { if(price < 25000000) { SendClientMessage(playerid, COLOR_ERROR, "Price must be $25m or over for this interior!"); return 1; } IntID = 5; IntX = 1298.8842; IntY = -797.0106; IntZ = 1084.0078; format(query,sizeof(query),"INSERT INTO `houses` (OwnedBy, Location, Interior, iX, iY, iZ, eX, eY, eZ, DefaultPrice, Slots) VALUES ('None', '%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')",houseLocation,IntID,IntX,IntY,IntZ,X,Y,Z,price,slots); } SendClientMessage(playerid, COLOR_WHITE, "Created house! /reloadhouses to spawn it."); mysql_reconnect(); mysql_query(query); return 1; }
if(strcmp(cmd, "/reloadhouses", true) == 0) { if(PInfo[playerid][AdminLevel] == 5) { for(new i=0;i<MAX_HOUSES;i++) { ReloadHouse(i); } SendClientMessage(playerid, COLOR_WHITE, "You have reloaded all houses."); AdminLog(playerid, "/reloadhouses", "Reloaded Houses", "Houses"); return 1; } else { SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !"); return 1; } }
ReloadHouse(i);
ReloadHouse
No. I mean this:
PHP код:
|
if(strcmp(cmd, "/reloadhouses", true) == 0) { if(PInfo[playerid][AdminLevel] == 5) { for(new i=0;i<MAX_HOUSES;i++) {} SendClientMessage(playerid, COLOR_WHITE, "You have reloaded all houses."); AdminLog(playerid, "/reloadhouses", "Reloaded Houses", "Houses"); return 1; } else { SendClientMessage(playerid, COLOR_ERROR, "Invalid Command, Type /help For command list !"); return 1; } }PHP код:
ReloadHouse(i);