25.10.2011, 20:19
pawn Код:
if(!strcmp(cmdtext, "/comprarcasa", true))
{
for(new c = 0; c < MAX_CASAS; c++)
{
format(string, sizeof(string), "/Casas/casa%d.ini", c);
if(dini_Exists(string))
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ")))
{
if(dini_Int(string, "TDono") == 0)
{
if(GetPlayerGrana(playerid) >= dini_Int(string, "Preco"))
{
if(GetCasas(playerid) < 1)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
dini_IntSet(string, "TDono", 1);
dini_Set(string, "Dono", pname);
GivePlayerGrana(playerid, -dini_Int(string, "Preco"));
new pickupid;
DestroyPickup(dini_Int(string, "Id"));
pickupid = CreatePickup(1272, 1, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"), -1);
dini_IntSet(string, "Id", pickupid);
format(string2, sizeof(string2), "Casa N° %d\n Dono %s\n Ultimo Login do dono: %s\n Aperte 'F'", c, dini_Get(string, "Dono"), dini_Get(slg,"Lg"));
Casa[c] = Create3DTextLabel(string2,0xFFFFFFAA, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ")+0.75,20.0,0,1);
OnPlayerCommandText(playerid, "/nascercasa");
}
else
{
SendClientMessage(playerid, Vermelho, "{778899}[ERROR]{00FF00} Vocк sу pode ter uma casa!");
}
}
else
{
SendClientMessage(playerid, Vermelho, "{778899}[ERROR]{00FF00} Vocк nгo tem dinheiro!");
}
}
else
{
SendClientMessage(playerid, Vermelho, "{778899}[ERROR]{00FF00} Esta casa nгo estб a venda!");
}
}
else
{}
}
}
return 1;
}