13.07.2013, 18:42
Utilize uma break;
pawn Код:
#define MCasa 150
enum cInfo
{
cDono[200],
cPreco,
cVenda
}
new cCasa[MCasa][cInfo];
new casas;
CMD:criarcasa(playerid,params[])
{
new preco;
if(!sscanf(params,"d",preco))
{
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
for(new i; i < MCasa; i++)
{
new string[200];
format(string,sizeof(string),"Casas/casa%d.txt",i);
if(!DOF2_FileExists(string))
{
DOF2_CreateFile(string);
DOF2_SetInt(string,"Preзo",preco);
DOF2_SetFloat(string,"CompX",pPos[0]);
DOF2_SetFloat(string,"CompY",pPos[1]);
DOF2_SetFloat(string,"CompZ",pPos[2]);
DOF2_SetString(string,"Dono","");
DOF2_SaveFile();
CreatePickup(1273,1,pPos[0],pPos[1],pPos[2]);
casas ++;
cCasa[i][cPreco] = preco;
break;
}
}
}
return 1;
}
CMD:comprarcasa(playerid)
{
new string[200];
for(new i; i < casas; i ++)
{
format(string,sizeof(string),"Casas/casa%d.txt",i);
if(DOF2_FileExists(string))
{
new Float:pPos[3];
pPos[0] = DOF2_GetFloat(string,"CompX");
pPos[1] = DOF2_GetFloat(string,"CompY");
pPos[2] = DOF2_GetFloat(string,"CompZ");
cCasa[i][cPreco] = DOF2_GetInt(string,"Preзo");
if(GetPlayerMoney(playerid) >= cCasa[i][cPreco])
{
if(IsPlayerInRangeOfPoint(playerid,2.0,pPos[0],pPos[1],pPos[2]))
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
DOF2_SetString(string,"Dono",pname);
//cCasa[i][cDono] = pname;
DOF2_SaveFile();
}
}
}
}
return 1;
}