Hi, i try to make house commands, such as /makehouse (makes the house when all the othre commands has been done, makes Icon and able to go inside the house), /houseexit (makes the house exit Point), /housename (set the house name) and /housentrance (marks the house entrance). But i got a few problems, it won't work for me. here's the code:
Код:
YCMD:housentrance(playerid, params[], help) {
if(help) {
SendClientMessage(playerid, X11_WHITE, "Marks an house entrance");
return 1;
}
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPVarFloat(playerid, "HouseX", X);
SetPVarFloat(playerid, "HouseY", Y);
SetPVarFloat(playerid, "HouseZ", Z);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "[NOTICE]: House entrance marked");
return 1;
}
YCMD:makehouse(playerid, params[], help) {
if(help) {
SendClientMessage(playerid, X11_WHITE, "Creates and loads an house");
return 1;
}
new name[((32*2)+1)];
new price[64];
if(!sscanf(params, "ddds[64]", price)) {
SendClientMessage(playerid, COLOR_LIGHTGREEN, "Attempting to create Business.");
} else {
SendClientMessage(playerid, X11_WHITE,"USAGE: /makehouse [price]");
query[0] = 0;
GetPVarString(playerid, "HouseName", name, 32);
mysql_real_escape_string(name, name);
format(query, sizeof(query), "INSERT INTO `houses` (`X`,`Y`,`Z`,`EX`,`EY`,`EZ`,`interior`,`name`,`price`,`owner`,`locked`,`rent`) VALUES (\"%s\",%f,%f,%f,%f,%f,%f,,%d%d,%d,%d,%d,%d)");
name,GetPVarFloat(playerid, "HouseX"),GetPVarFloat(playerid, "HouseY"),GetPVarFloat(playerid, "HouseZ"),GetPVarFloat(playerid, "HouseExitX"),GetPVarFloat(playerid, "HouseExitY"),GetPVarFloat(playerid, "HouseExitZ"),GetPVarInt(playerid, "HouseInterior"),GetPVarInt(playerid, "HouseName"),GetPVarInt(playerid, "HouseOwnerName"),GetPVarInt(playerid, "HouseLocked"),GetPVarInt(playerid, "HouseRentPrice");
mysql_function_query(g_mysql_handle, query, true, "OnloadHouses", "");
SendClientMessage(playerid, COLOR_LIGHTGREEN, "Your house is created!");
}
return 1;
}
YCMD:housename(playerid, params[], help) {
if(help) {
SendClientMessage(playerid, X11_WHITE, "Set an house name before creating it");
return 1;
}
if(strlen(params) < 1) {
SendClientMessage(playerid, X11_WHITE, "USAGE: /housename [name]");
return 1;
}
SetPVarString(playerid, "HouseName", params);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "[NOTICE] House name is set!");
return 1;
}
YCMD:housexit(playerid, params[], help) {
if(help) {
SendClientMessage(playerid, X11_WHITE, "Marks an house exit");
return 1;
}
new Float:X, Float:Y, Float:Z, house;
GetPlayerPos(playerid, X, Y, Z);
house = GetPlayerInterior(playerid);
SetPVarFloat(playerid, "HouseExitX",X);
SetPVarFloat(playerid, "HouseExitY",Y);
SetPVarFloat(playerid, "HouseExitZ",Z);
SetPVarInt(playerid, "HouseInterior", house);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "[NOTICE]: House exit marked");
return 1;
}