[Ajuda] Sistema de casa...
#9

Quote:
Originally Posted by darkxdll
Посмотреть сообщение
Bom eu fiz uma base aqui , mais tive problemas , eu digitei /criarcasa 1000 , 1000 й o preзo ..
ai ele criou 150 arquivos na pasta Casas , todos os arquivos com ids diferentes , casa1 casa2 casa3 ... atй casa150
Nгo sei no que eu errei vejam :


PHP код:
#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 
iMCasai++)
        {
            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;
            }
        }
    }
    return 
1;
}
CMD:comprarcasa(playerid)
{
    new 
string[200];
    for(new 
icasas++)
    {
        
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;

Alguem poderia me ajudar ? :/
Basta encerrar a funзгo apуs criar o arquivo.

pawn Код:
criarcasa(playerid,params[])
{
    new
        preco;

    if(sscanf(params,"d",preco))
        return SendClientMessage(playerid, -1, "Use /criarcasa [preзo]");

    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;
            return 1;
        }
    }
   
    return 1;
}
Reply


Messages In This Thread
Sistema de casa... - by darkxdll - 13.07.2013, 17:27
Re: Sistema de casa... - by Cidiei - 13.07.2013, 17:28
Re: Sistema de casa... - by darkxdll - 13.07.2013, 17:29
Re: Sistema de casa... - by Cidiei - 13.07.2013, 17:33
Re: Sistema de casa... - by darkxdll - 13.07.2013, 17:35
Re: Sistema de casa... - by Cidiei - 13.07.2013, 17:37
Re: Sistema de casa... - by Lуs - 13.07.2013, 17:56
Re: Sistema de casa... - by darkxdll - 13.07.2013, 18:35
Re: Sistema de casa... - by Lуs - 13.07.2013, 18:40
Re: Sistema de casa... - by mau.tito - 13.07.2013, 18:42

Forum Jump:


Users browsing this thread: 1 Guest(s)