04.08.2012, 03:23
ta ai у:
PHP код:
if(strcmp(cmd, "/comprarcasa", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 0)
{
if(PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
{
format(string, sizeof(string), " Vocк precisa ter nivel %d Para comprar! !", HouseInfo[h][hLevel]);
MSGPLAYER(playerid, COLOR_GRAD5, string);
return 1;
}
if(PlayerInfo[playerid][pPHousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPHousekey]][hOwner], true) == 0)
{
MSGPLAYER(playerid, COLOR_WHITE, " Vocк tem uma casa para vender digite /vendercasa, vocк receberб o mesmo valor que foi pago!");
return 1;
}
if(GetPlayerMoney(playerid) > HouseInfo[h][hValue])
{
PlayerInfo[playerid][pPHousekey] = h;
PlayerInfo[playerid][pPHouseCarkey] = PlayerInfo[playerid][pPHousekey]+totalveiculosh;
HouseInfo[h][hOwned] = 1;
HouseInfo[h][hExitx] = 234.0843;
HouseInfo[h][hExity] = 1064.6896;
HouseInfo[h][hExitz] = 1084.2108;
HouseInfo[h][hInt] = 6;
HouseInfo[h][hRentabil] = 1;
HouseInfo[h][hRent] = 200;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
GivePlayerMoney(playerid,-HouseInfo[h][hValue]);
PlayerPlayMusic(playerid);
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~w~Parabens pela compra ~n~~b~Para entrar digite /entrar", 5000, 3);
MSGPLAYER(playerid, COLOR_WHITE, "Parabйns pela sua nova casa!");
MSGPLAYER(playerid, COLOR_WHITE, "Digite /ajudacasa Em caso de duvidas!");
PlayerInfo[playerid][pSpawn] = 1;
DateProp(playerid);
Atualizar3Dtexts();
OnPropUpdate();
return 1;
}
else
{
MSGPLAYER(playerid, COLOR_WHITE, " Vocк nгo tem dinheiro o suficiente. !");
return 1;
}
}
}
}
return 1;
}
if(strcmp(cmd, "/alugarquarto", true) == 0 || strcmp(cmd, "/alugar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 1 && HouseInfo[h][hRentabil] == 1)
{
if(PlayerInfo[playerid][pPHousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPHousekey]][hOwner], true) == 0)
{
MSGPLAYER(playerid, COLOR_WHITE, " Vocк tem uma casa, para vender digite /vendercasa, vocк receberб o mesmo valor que foi pago!");
return 1;
}
if(GetPlayerMoney(playerid) > HouseInfo[h][hRent])
{
PlayerInfo[playerid][pPHousekey] = h;
PlayerInfo[playerid][pPHouseCarkey] = PlayerInfo[playerid][pPHousekey]+totalveiculosh;
GivePlayerMoney(playerid,-HouseInfo[h][hRent]);
HouseInfo[h][hTakings] = HouseInfo[h][hTakings]+HouseInfo[h][hRent];
PlayerPlayMusic(playerid);
GameTextForPlayer(playerid, "~w~Parabens pela compra ~n~~b~Para entrar digite /entrar", 5000, 3);
MSGPLAYER(playerid, COLOR_WHITE, "Parabйns pela sua nova casa!");
MSGPLAYER(playerid, COLOR_WHITE, "Digite /ajudaaluguel Em caso de duvidas!");
return 1;
}
else
{
MSGPLAYER(playerid, COLOR_WHITE, "Vocк nгo tem dinheiro o suficiente.");
return 1;
}
}
}
}
return 1;
}