pawn Код:
COMMAND:criarcasa(playerid, params[])
{
new HPrice, MaxLevel, HouseID;
SendAdminText(playerid, "/criarcasa", params);
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerLevel] >= 6)
{
if (GetPlayerVehicleSeat(playerid) == -1)
{
if (sscanf(params, "ii", HPrice, MaxLevel)) SendClientMessage(playerid, 0xFF0000AA, "Use: /criarcasa [preзo] [level]");
else
{
if ((MaxLevel >= 1) && (MaxLevel <= 10))
{
if ((HPrice >= 100000) && (MaxLevel <= 5000000))
{
for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
if (AHouseData[HouseID][PickupID] == 0)
break;
if (HouseID < MAX_HOUSES)
{
new Float:x, Float:y, Float:z, Msg[128];
GetPlayerPos(playerid, x, y, z);
AHouseData[HouseID][HouseX] = x;
AHouseData[HouseID][HouseY] = y;
AHouseData[HouseID][HouseZ] = z;
AHouseData[HouseID][HouseLevel] = 1;
AHouseData[HouseID][HouseMaxLevel] = MaxLevel;
AHouseData[HouseID][HousePrice] = HPrice;
AHouseData[HouseID][Owned] = false;
House_CreateEntrance(HouseID);
HouseFile_Save(HouseID);
format(Msg, 128, "{00FF00}[BTC] Vocк criou a casa de ID {FF00FF}%i{00FF00} com sucesso!", HouseID);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
else
SendClientMessage(playerid, 0xFF0000FF, "[BTC] A quantidade mбxima de casas criadas, foi atingida!");
}
else
SendClientMessage(playerid, 0xFF0000FF, "[BTC] Valor nгo permitido!");
}
else
SendClientMessage(playerid, 0xFF0000FF, "[BTC] Vocк deve escolher o Level entre 0 e 10.");
}
}
else
SendClientMessage(playerid, 0xFF0000FF, "[BTC] Vocк nгo pode estar dentro de um veнculo para criar uma casa!");
}
}
else
return 0;
return 1;
}