[HELP] Code creates me 500 house files
#1

Hey guys. I have a problem here. So i am making another house system. So when i create house in game it doesn't create 1 house as it has to be,it create max_houses (500-as I set).

This is my /napravikucu - /makehouse command:

PHP код:
CMD:napravikucu(playerid,params[])
{
    new 
Cijena,Type,INInterijer,Svijet,Interijer,Float:X,Float:Y,Float:Z// Cijena = price,INInterijer = INInterior,Svijet = World, Interijer = Interijer
    
new Float:PlayerX,Float:PlayerY,Float:PlayerZ,Float:PlayerA// Some floats...
    
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Niste ulogirani na server");
    if(
sscanf(params,"dddfff",Cijena,Type,INInterijer,X,Y,Z)) return SendClientMessage(playerid,-1,""COLOR_CRVENA"[INFO]:{FFFFFF} /napravikucu [Cijena] [Tip] [Interijer] [X] [Y] [Z]");
    if(
Cijena 10000 || Cijena 1000000) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Odaberite cijenu izmedu: 10.000$ i 1.000.000$");
    if(
Type || Type 3) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Odaberite TIP izmedu: 0-3");
    for(new 
ID 1ID sizeof(HouseInfo); ID++) // I think this is causing problem..
    
{
        
GetPlayerPos(playerid,PlayerX,PlayerY,PlayerZ);
        
GetPlayerFacingAngle(playerid,PlayerA);
        
Interijer GetPlayerInterior(playerid);
        
Svijet GetPlayerVirtualWorld(playerid);
        
HouseInfo[ID][hOwned] = 0// New house is not owned!
        
HouseInfo[ID][hCijena] = Cijena// price
        
HouseInfo[ID][hVlasnik] = 0// owner
        
HouseInfo[ID][hZakljucan] = 1// locked
        
HouseInfo[ID][hTip] = Type// type
        
HouseInfo[ID][hUlazX] = X// coords x
        
HouseInfo[ID][hUlazY] = Y// y
        
HouseInfo[ID][hUlazZ] = Z// z
        
HouseInfo[ID][hIzlazX] = PlayerX// coords x
        
HouseInfo[ID][hIzlazY] = PlayerY// y
        
HouseInfo[ID][hIzlazZ] = PlayerZ// z
        
HouseInfo[ID][hIzlazA] = PlayerA// angle
        
HouseInfo[ID][hInt] = Interijer// interior
        
HouseInfo[ID][hINInt] = INInterijer// INinterior
        
HouseInfo[ID][hSvijet] = Svijet// world
        
HouseInfo[ID][hINSvijet] = ID// INWorld
        
new poruka[256];
        {
// Some 3ds,pickups,and icons on the map...
            
format(poruka,sizeof(poruka),""COLOR_ZELENA"[Kuca na prodaju]{FFFFFF}\n\n- Cijena:"COLOR_WG" $%d\n{FFFFFF}- Tip: %s\nPotreban Level: 3\n\nZa kupnju kuce upisite: "COLOR_SIVA"/kupikucu.",HouseInfo[ID][hCijena],HouseType(Type));
            
HouseInfo[ID][hVanjski3D] = Create3DTextLabel(poruka,-1,PlayerX,PlayerY,PlayerZ,30.0,0,0);
            
HouseInfo[ID][hVanjskiPickup] = CreatePickup(1273,1,PlayerX,PlayerY,PlayerZ,-1);
            
HouseInfo[ID][hIkona] = CreateDynamicMapIcon(PlayerX,PlayerY,PlayerZ,31,-1,-1,-1,-1,100);
        }
        
/* Spremanje Kuca */ // SAVING...
        
new INI:File INI_Open(HousePath(ID));
        
INI_SetTag(File,"Info");
        
INI_WriteInt(File,"Owned",HouseInfo[ID][hOwned]);
        
INI_WriteInt(File,"Cijena",HouseInfo[ID][hCijena]);
          
INI_WriteInt(File,"Vlasnik",HouseInfo[ID][hVlasnik]);
        
INI_WriteInt(File,"Zakljucan",HouseInfo[ID][hZakljucan]);
        
INI_WriteInt(File,"Tip",HouseInfo[ID][hTip]);
        
INI_WriteFloat(File,"UlazX",HouseInfo[ID][hUlazX]);
        
INI_WriteFloat(File,"UlazY",HouseInfo[ID][hUlazY]);
        
INI_WriteFloat(File,"UlazZ",HouseInfo[ID][hUlazZ]);
        
INI_WriteFloat(File,"UlazA",HouseInfo[ID][hUlazA]);
        
INI_WriteFloat(File,"IzlazX",HouseInfo[ID][hIzlazX]);
        
INI_WriteFloat(File,"IzlazY",HouseInfo[ID][hIzlazY]);
        
INI_WriteFloat(File,"IzlazZ",HouseInfo[ID][hIzlazZ]);
        
INI_WriteFloat(File,"IzlazA",HouseInfo[ID][hIzlazA]);
        
INI_WriteInt(File,"OutInterijer",HouseInfo[ID][hInt]);
        
INI_WriteInt(File,"Interijer",HouseInfo[ID][hINInt]);
        
INI_WriteInt(File,"Svijet",HouseInfo[ID][hSvijet]);
        
INI_WriteInt(File,"INSvijet",HouseInfo[ID][hINSvijet]);
        
INI_WriteInt(File,"Ikona",HouseInfo[ID][hIkona]);
        
INI_WriteInt(File,"Vanjski3D",HouseInfo[ID][hVanjski3D]);
        
INI_WriteInt(File,"VanjskiPickup",HouseInfo[ID][hVanjskiPickup]);
        
INI_Close(File);
    }
    return 
1;

If you need my saving or loading just say but i think you won't need it. Thanks for support!

And yes i will rep+ for the code which helps me.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)