Код:
CMD:newhouse(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 6)
{
new type,level,price,str[128];
new Float:x, Float:y, Float:z;
if(sscanf(params, "iii", type,level,price))
{
SendClientMessage(playerid, -1, "/newhouse <type> <level> <price>");
SendClientMessage(playerid, -1, "Types: | 1 - Apartament | 2 - Casa Medie");
SendClientMessage(playerid, -1, "Types: | 3 - Palat | 4 - Cabana");
}
else
{
GetPlayerPos(playerid, x, y, z);
new hid;
mysql_query(SQL,"SELECT * FROM `houses`");
mysql_store_result();
hid = mysql_num_rows();
mysql_free_result();
hid = hid+1; // house
HouseInfo[hid][hEntrancex] = x; HouseInfo[hid][hEntrancey] = y; HouseInfo[hid][hEntrancez] = z;
strmid(HouseInfo[hid][hOwner], "The State", 0, strlen("The State"), 255);
HouseInfo[hid][hValue] = price;
HouseInfo[hid][hHel] = 0; HouseInfo[hid][hArm] = 0; HouseInfo[hid][hLock] = 1;
HouseInfo[hid][hOwned] = 0; HouseInfo[hid][hRent] = 10; HouseInfo[hid][hRentabil] = 0;
HouseInfo[hid][hTakings] = 0;
HouseInfo[hid][hLevel] = level;
format(str,128,"INSERT INTO houses (ID, Owned) VALUES (%d, %d)",hid,HouseInfo[hid][hOwned]);
mysql_query(SQL,str);
format(str,128,"UPDATE houses SET Entrancex='%f' , Entrancey='%f' , Entrancez='%f' WHERE ID='%d'",HouseInfo[hid][hEntrancex], HouseInfo[hid][hEntrancey], HouseInfo[hid][hEntrancez], hid);
mysql_query(SQL,str);
format(str,128,"UPDATE houses SET Hel='0' , Arm='0' , Lock='0' WHERE ID='%d'",hid);
mysql_query(SQL,str);
format(str,128,"UPDATE houses SET Takings='0'",hid);
mysql_query(SQL,str);
format(str,128,"UPDATE houses SET Rent='0' , Rentabil='0' , Date='0' WHERE ID='%d'",hid);
mysql_query(SQL,str);
format(str,128,"UPDATE houses SET Owner='%s' , Value='%d' , Level='%d' WHERE ID='%d'",HouseInfo[hid][hOwner],HouseInfo[hid][hValue],HouseInfo[hid][hLevel],hid);
mysql_query(SQL,str);
OnPropTextdrawUpdate(1,hid);
if(type == 1)
{//Apartament
HouseInfo[hid][hExitx] = 386.1; HouseInfo[hid][hExity] = 1471.8; HouseInfo[hid][hExitz] = 1080.1;
HouseInfo[hid][hInterior] = 15;
}
if(type == 2)
{//Casa Medie
HouseInfo[hid][hExitx] = 2261.3; HouseInfo[hid][hExity] = -1135.9; HouseInfo[hid][hExitz] = 1050.6;
HouseInfo[hid][hInterior] = 10;
}
if(type == 3)
{//Lux
HouseInfo[hid][hExitx] = 27.1; HouseInfo[hid][hExity] = 1341.1; HouseInfo[hid][hExitz] = 1084.3;
HouseInfo[hid][hInterior] = 10;
}
if(type == 4)
{//Palat
HouseInfo[hid][hExitx] = 225.6; HouseInfo[hid][hExity] = 1023.5; HouseInfo[hid][hExitz] = 1084;
HouseInfo[hid][hInterior] = 7;
}
if(type == 5)
{//Cabana
HouseInfo[hid][hExitx] = 301.3; HouseInfo[hid][hExity] = 306.3; HouseInfo[hid][hExitz] = 1003.5;
HouseInfo[hid][hInterior] = 4;
}
format(str,128,"UPDATE houses SET Exitx='%f' , Exity='%f' , Exitz='%f' WHERE ID='%d'",HouseInfo[hid][hExitx], HouseInfo[hid][hExity], HouseInfo[hid][hExitz], hid);
mysql_query(SQL,str);
format(str,128,"UPDATE houses SET `Int`='%d' WHERE ID='%d'",HouseInfo[hid][hInterior],hid);
mysql_query(SQL,str);
}
}
else return SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
return 1;
}
and command doesn't work. When i want to make a house server says unknow command