Szerző Téma: Tûz probléma  (Megtekintve 1669 alkalommal)

Tûz probléma
« Dátum: 2012. Február 27. - 20:31:15 »
0 Show voters
[pawn]    ///****************************************************************************//
    /*                           Fire-Script
                                                                    by
                                                            Sniperwolfes
    */
    //****************************************************************************//
     
     
    #include <a_samp>
    //======================================
    //#define Labels // 3D Labels above the Fires showing the Health?
    //#define LoseHealth // Should Players and Vehicles lose Health if they stand in the fire?
    //======================================
    #define Holding(%0) \\
            ((newkeys & (%0)) == (%0))
    #define MaxFire 80 // How many fires max.?
    forward OnFireKill(ID, killerid);
    forward f_OnPlayerUpdate(playerid);
    forward VehicleToPoint(Float:radi, vehicleid, Float:x, Float:y, Float:z);
    forward HealthDown();
    forward f_init();
     
     
    public f_init()
    {
            #if defined LoseHealth
                    SetTimer(\"HealthDown\", 600, 1);
            #endif
    }     
     
     
    new
        FireObj[MaxFire],
        Float:FirePos[MaxFire][3],
            TotalFires = 0,
            FireHealth[MaxFire],
            FireHealthMax[MaxFire];
     
    #if defined Labels
    new Text3D:FireText[MaxFire];
    #endif
     
    stock AddFire(Float:x, Float:y, Float:z, Health)
    {
        TotalFires++;
            new ID = TotalFires;
            FireObj[iD] = CreateObject(3461, x, y, z-2.61, 0, 0, 0.0);
            FirePos[iD][0] = x, FirePos[iD][1] = y, FirePos[iD][2] = z;
            FireHealth[iD] = Health;
            FireHealthMax[iD] = Health;
            #if defined Labels
                new string[128];
                format(string, sizeof(string), \"%d/%d\", FireHealth[iD], FireHealthMax[iD]);
                FireText[iD] = Create3DTextLabel(string, 0xFFFFFFFFF, x, y, z, 20, 0);
            #endif
    }
    stock DeleteFire(ID)
    {
            DestroyObject(FireObj[iD]);
            TotalFires--;
            FirePos[iD][0] = 0, FirePos[iD][1] = 0, FirePos[iD][2] = 0;
            #if defined Labels
                Delete3DTextLabel(FireText[iD]);
            #endif
    }
    stock DeleteAllFire()
    {
            new ID;
            for(ID = 0; ID<MaxFire; ID++)
            {
                    DestroyObject(FireObj[iD]);
                    TotalFires= 0;
                    FirePos[iD][0] = 0, FirePos[iD][1] = 0, FirePos[iD][2] = 0;
                    #if defined Labels
                    Delete3DTextLabel(FireText);

                    #endif


            }


    }


    stock IsValidFire(ID)


    {


            if( (FirePos[iD][0] != 0) && (FirePos[iD][1] != 0) && (FirePos[iD][2] != 0) ) return true;


            else return false;


    }


     


    stock GetClosestFire(playerid)


    {


            new i;


            for(i = 0; i<MaxFire; i++)


            {


                if(IsValidFire(i) && IsPlayerInRangeOfPoint(playerid, 1, FirePos
  • ,  FirePos[1],  FirePos[2]))


                {


                    return i;


                    }


            }


            return 0;


    }


     


     


    public f_OnPlayerUpdate(playerid)


    {


            new newkeys,l,u;


            GetPlayerKeys(playerid, newkeys, l, u);


            new i;


            if(Holding(KEY_FIRE))


            {


            if(GetPlayerWeapon(playerid) == 42)


            {


                for(i = 0; i<MaxFire; i++)


                    {


                            if(IsValidFire(i))


                            {


                                if(PlayerFaces(playerid, FirePos
  • ,  FirePos[1],  FirePos[2], 1) && IsPlayerInRangeOfPoint(playerid, 4, FirePos
  • ,  FirePos[1],  FirePos[2]))


                                    {


                                            FireHealth
-=2;

                                                #if defined Labels


                                                    new string[128];


                                                    format(string, sizeof(string), \"%d/%d\", FireHealth
, FireHealthMax);

                                                            Update3DTextLabelText(FireText
, 0xFFFFFFFF, string);

                                                    //Delete3DTextLabel(FireText
);

                                                    //FireText
= Create3DTextLabel(string, 0xFFFFFFFF, FirePos
  • ,  FirePos[1],  FirePos[2], 20, 0);


                                                #endif


                                                if(FireHealth
<= 0)

                                                {


                                                            DeleteFire(i);


                                                            CallRemoteFunction(\"OnFireDeath\", \"dd\", i, playerid);


                                                    }


                                            }


                                    }


                            }


                    }


            }


            return 1;


    }


     


     


    Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ,   Float:ObjX, Float:ObjY, Float:ObjZ,   Float:FrX, Float:FrY, Float:FrZ) {


     


            new Float:TGTDistance;


            TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));


            new Float:tmpX, Float:tmpY, Float:tmpZ;


            tmpX = FrX * TGTDistance + CamX;


            tmpY = FrY * TGTDistance + CamY;


            tmpZ = FrZ * TGTDistance + CamZ;


            return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));


    }


     


    stock PlayerFaces(playerid, Float:x, Float:y, Float:z, Float:radius)


    {


            new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;


            GetPlayerCameraPos(playerid, cx, cy, cz);


            GetPlayerCameraFrontVector(playerid, fx, fy, fz);


            return (radius >= DistanceCameraTargetToLocation(cx, cy, cz, x, y, z, fx, fy, fz));


    }


     


    public VehicleToPoint(Float:radi, vehicleid, Float:x, Float:y, Float:z)


    {


                    new Float:oldposx, Float:oldposy, Float:oldposz;


                    new Float:tempposx, Float:tempposy, Float:tempposz;


                    GetVehiclePos(vehicleid, oldposx, oldposy, oldposz);


                    tempposx = (oldposx -x);


                    tempposy = (oldposy -y);


                    tempposz = (oldposz -z);


                    //printf(\"DEBUG: X:%f Y:%f Z:%f\",posx,posy,posz);


                    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))


                    {


                            return 1;


                    }


                    return 0;


    }


     


    public HealthDown()


    {


            new i,v,p;


            for(i = 0; i<MaxFire; i++)


            {


                    if(IsValidFire(i))


                    {


                            for(p = 0; p<MAX_PLAYERS; p++)


                            {


                                    if(IsPlayerInRangeOfPoint(p, 1, FirePos
  • , FirePos[1], FirePos[2]) && !IsPlayerInAnyVehicle(p))


                                    {


                                            new Float:HP;


                                    GetPlayerHealth(p, HP);


                                            SetPlayerHealth(p, HP-4);


                                    }     


                            }


                            for(v = 0; v<MAX_VEHICLES; v++)


                            {


                                    if(VehicleToPoint(2, v, FirePos
  • , FirePos[1], FirePos[2]))


                                    {


                                            new Float:HP;


                                    GetVehicleHealth(v, HP);


                                            SetVehicleHealth(v, HP-30);


                                    }


                            }


                    }


            }


    }


[/pawn]


Ezt a tûz inc-et próbáltam meg használni, beírtam az include-t a GM tetejére, és még amiket kellett, de nem akarja az igazat (csináltam egy parancsot, amivel leteszi a tüzet, de sem a tûz HP nincs ott és mag  tûz is elolthatatlan, tehát csak objectet rak le :S


Valaki tudna segíteni?


Következõ warokat adja, amikor a GM-et compilezem:


[pawn]C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(43) : warning 219: local variable \"Health\" shadows a variable at a preceding level


C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(46) : warning 217: loose indentation


C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(183) : warning 217: loose indentation


C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(184) : warning 217: loose indentation


C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(192) : warning 217: loose indentation


C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(193) : warning 217: loose indentation[/pawn]

Tûz probléma
« Válasz #1 Dátum: 2012. Február 27. - 20:35:48 »
0 Show voters
    ///****************************************************************************//
    /*                           Fire-Script
                                                                    by
                                                            Sniperwolfes
    */
    //****************************************************************************//
 
    #include <a_samp>
    //======================================
    //#define Labels // 3D Labels above the Fires showing the Health?
    //#define LoseHealth // Should Players and Vehicles lose Health if they stand in the fire?
    //======================================
    #define Holding(%0) \\
            ((newkeys & (%0)) == (%0))
    #define MaxFire 80 // How many fires max.?
    forward OnFireKill(ID, killerid);
    forward f_OnPlayerUpdate(playerid);
    forward VehicleToPoint(Float:radi, vehicleid, Float:x, Float:y, Float:z);
    forward HealthDown();
    forward f_init();
 
    public f_init()
    {
            #if defined LoseHealth
                    SetTimer(\"HealthDown\", 600, 1);
            #endif
    }
 
    new
        FireObj[MaxFire],
        Float:FirePos[MaxFire][3],
            TotalFires = 0,
            FireHealth[MaxFire],
            FireHealthMax[MaxFire];
    #if defined Labels
    new Text3D:FireText[MaxFire];
    #endif
    stock AddFire(Float:x, Float:y, Float:z, Float:Health)
    {
        TotalFires++;
            new ID = TotalFires;
            FireObj[iD] = CreateObject(3461, x, y, z-2.61, 0, 0, 0.0);
            FirePos[iD][0] = x, FirePos[iD][1] = y, FirePos[iD][2] = z;
            FireHealth[iD] = Health;
            FireHealthMax[iD] = Health;
            #if defined Labels
                new string[128];
                format(string, sizeof(string), \"%d/%d\", FireHealth[iD], FireHealthMax[iD]);
                FireText[iD] = Create3DTextLabel(string, 0xFFFFFFFFF, x, y, z, 20, 0);
            #endif
    }
    stock DeleteFire(ID)
    {
            DestroyObject(FireObj[iD]);
            TotalFires--;
            FirePos[iD][0] = 0, FirePos[iD][1] = 0, FirePos[iD][2] = 0;
            #if defined Labels
                Delete3DTextLabel(FireText[iD]);
            #endif
    }
    stock DeleteAllFire()
    {
            new ID;
            for(ID = 0; ID<MaxFire; ID++)
            {
                    DestroyObject(FireObj[iD]);
                    TotalFires= 0;
                    FirePos[iD][0] = 0, FirePos[iD][1] = 0, FirePos[iD][2] = 0;
                    #if defined Labels
                    Delete3DTextLabel(FireText);
                    #endif
            }
    }
    stock IsValidFire(ID)
    {
            if( (FirePos[iD][0] != 0) && (FirePos[iD][1] != 0) && (FirePos[iD][2] != 0) ) return true;
            else return false;
    }
    stock GetClosestFire(playerid)
    {
            new i;
            for(i = 0; i<MaxFire; i++)
            {
                if(IsValidFire(i) && IsPlayerInRangeOfPoint(playerid, 1, FirePos[0],  FirePos[1],  FirePos[2]))
                {
                    return i;
                    }
            }
            return 0;
    }
 
    public f_OnPlayerUpdate(playerid)
    {
            new newkeys,l,u;
            GetPlayerKeys(playerid, newkeys, l, u);
            new i;
            if(Holding(KEY_FIRE))
            {
            if(GetPlayerWeapon(playerid) == 42)
            {
                for(i = 0; i<MaxFire; i++)
                    {
                            if(IsValidFire(i))
                            {
                                if(PlayerFaces(playerid, FirePos[0],  FirePos[1],  FirePos[2], 1) && IsPlayerInRangeOfPoint(playerid, 4, FirePos[0],  FirePos[1],  FirePos[2]))
                                    {
                                            FireHealth-=2;
                                                #if defined Labels
                                                    new string[128];
                                                    format(string, sizeof(string), \"%d/%d\", FireHealth, FireHealthMax);
                                                            Update3DTextLabelText(FireText, 0xFFFFFFFF, string);
                                                    //Delete3DTextLabel(FireText);
                                                    //FireText = Create3DTextLabel(string, 0xFFFFFFFF, FirePos[0],  FirePos[1],  FirePos[2], 20, 0);
                                                #endif
                                                if(FireHealth <= 0)
                                                {
                                                            DeleteFire(i);
                                                            CallRemoteFunction(\"OnFireDeath\", \"dd\", i, playerid);
                                                    }
                                            }
                                    }
                            }
                    }
            }
            return 1;
    }
 
    Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ,   Float:ObjX, Float:ObjY, Float:ObjZ,   Float:FrX, Float:FrY, Float:FrZ) {
            new Float:TGTDistance;
            TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));
            new Float:tmpX, Float:tmpY, Float:tmpZ;
            tmpX = FrX * TGTDistance + CamX;
            tmpY = FrY * TGTDistance + CamY;
            tmpZ = FrZ * TGTDistance + CamZ;
            return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
    }
    stock PlayerFaces(playerid, Float:x, Float:y, Float:z, Float:radius)
    {
            new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
            GetPlayerCameraPos(playerid, cx, cy, cz);
            GetPlayerCameraFrontVector(playerid, fx, fy, fz);
            return (radius >= DistanceCameraTargetToLocation(cx, cy, cz, x, y, z, fx, fy, fz));
    }
    public VehicleToPoint(Float:radi, vehicleid, Float:x, Float:y, Float:z)
    {
                    new Float:oldposx, Float:oldposy, Float:oldposz;
                    new Float:tempposx, Float:tempposy, Float:tempposz;
                    GetVehiclePos(vehicleid, oldposx, oldposy, oldposz);
                    tempposx = (oldposx -x);
                    tempposy = (oldposy -y);
                    tempposz = (oldposz -z);
                    //printf(\"DEBUG: X:%f Y:%f Z:%f\",posx,posy,posz);
                    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                    {
                            return 1;
                    }
                    return 0;
    }
    public HealthDown()
    {
            new i,v,p;
            for(i = 0; i<MaxFire; i++)
            {
                    if(IsValidFire(i))
                    {
                            for(p = 0; p<MAX_PLAYERS; p++)
                            {
                                    if(IsPlayerInRangeOfPoint(p, 1, FirePos[0], FirePos[1], FirePos[2]) && !IsPlayerInAnyVehicle(p))
                                    {
                                            new Float:HP;
                                            GetPlayerHealth(p, HP);
                                            SetPlayerHealth(p, HP-4);
                                    }
                            }
                            for(v = 0; v<MAX_VEHICLES; v++)
                            {
                                    if(VehicleToPoint(2, v, FirePos[0], FirePos[1], FirePos[2]))
                                    {
                                            new Float:HP;
                                            GetVehicleHealth(v, HP);
                                            SetVehicleHealth(v, HP-30);
                                    }
                            }
                    }
            }
    }

 
Kijavítottam  :smokin:

Tûz probléma
« Válasz #2 Dátum: 2012. Február 27. - 20:46:46 »
0 Show voters
A sok LOOSE IDENTATION eltûnt, de még vannak dolgok:
 
C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(43) : warning 219: local variable \"Health\" shadows a variable at a preceding level
C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(46) : warning 217: loose indentation
C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(49) : warning 213: tag mismatch
C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(50) : warning 213: tag mismatch
« Utoljára szerkesztve: 2012. Február 27. - 20:58:13 írta Vital Metal »

Rammstein

  • Vendég
Tûz probléma
« Válasz #3 Dátum: 2012. Február 27. - 21:27:50 »
0 Show voters
loose, akkor tabot nyomni

Nem elérhető Norby

  • 1575
    • Profil megtekintése
Tûz probléma
« Válasz #4 Dátum: 2012. Február 28. - 11:33:14 »
0 Show voters
Sor eltolódás és a Health ot kétszer van létrehozva töröld a GM bõl!

Nem elérhető Flash

  • 5726
  • (っ◕‿◕)っ
    • Profil megtekintése
Tûz probléma
« Válasz #5 Dátum: 2012. Február 28. - 13:12:40 »
0 Show voters
#pragma tabsize 0[/quote]
ha ez a mód elején van már nem lesz gond a sor eltolódás miatt. :)
 
C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(49) : warning 213: tag mismatch
C:\\Users\\Bart Simpson\\Desktop\\DT RPG\\pawno\\include\\fire2.inc(50) : warning 213: tag mismatch
[/quote]
Ezek a hibák meg a fire2.inc-ben találhatóak.

Nem elérhető CANNONN

  • 2139
    • Profil megtekintése
Tûz probléma
« Válasz #6 Dátum: 2012. Február 28. - 13:20:17 »
0 Show voters
#pragma tabsize 0[/quote]
Szerintem ne verd át a pawno-t!
Javítsd ki a sor eltolódásokat.

Nem elérhető Norby

  • 1575
    • Profil megtekintése
Tûz probléma
« Válasz #7 Dátum: 2012. Február 28. - 13:40:13 »
0 Show voters
Idézetet írta: Cannonn date=1330431617\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"17662\" data-ipsquote-contentclass=\"forums_Topic

#pragma tabsize 0
Szerintem ne verd át a pawno-t!
Javítsd ki a sor eltolódásokat.
 
[/quote]
Pontosan ezt felejtsd el :
#pragma tabsize 0
Másold be a sorokat amelyikre írja!

Tûz probléma
« Válasz #8 Dátum: 2012. Február 28. - 16:47:52 »
0 Show voters
Lol én eleve ugfy adtam oda hogy egy db warning sem volt benne a health-ot iskijavitottam nekem nem volt benne warn amit most odaatdam kijavitva

Nem elérhető CANNONN

  • 2139
    • Profil megtekintése
Tûz probléma
« Válasz #9 Dátum: 2012. Február 28. - 16:54:02 »
0 Show voters
Nem is láttam, hogy a kód a téma elején le van írva.
Itt van, kijavítottam a sor eltolódásokat.
 

  ///****************************************************************************//
    /*                           Fire-Script
                                                                    by
                                                            Sniperwolfes
    */
    //****************************************************************************//
 
    #include <a_samp>
    //======================================
    //#define Labels // 3D Labels above the Fires showing the Health?
    //#define LoseHealth // Should Players and Vehicles lose Health if they stand in the fire?
    //======================================
    #define Holding(%0) \\
            ((newkeys & (%0)) == (%0))
    #define MaxFire 80 // How many fires max.?
    forward OnFireKill(ID, killerid);
    forward f_OnPlayerUpdate(playerid);
    forward VehicleToPoint(Float:radi, vehicleid, Float:x, Float:y, Float:z);
    forward HealthDown();
    forward f_init();
 
    public f_init()
    {
            #if defined LoseHealth
                    SetTimer(\"HealthDown\", 600, 1);
            #endif
    }
 
    new
        FireObj[MaxFire],
        Float:FirePos[MaxFire][3],
            TotalFires = 0,
            FireHealth[MaxFire],
            FireHealthMax[MaxFire];
    #if defined Labels
    new Text3D:FireText[MaxFire];
    #endif
    stock AddFire(Float:x, Float:y, Float:z, Health)
    {
        TotalFires++;
            new ID = TotalFires;
            FireObj[iD] = CreateObject(3461, x, y, z-2.61, 0, 0, 0.0);
            FirePos[iD][0] = x, FirePos[iD][1] = y, FirePos[iD][2] = z;
            FireHealth[iD] = Health;
            FireHealthMax[iD] = Health;
            #if defined Labels
                new string[128];
                format(string, sizeof(string), \"%d/%d\", FireHealth[iD], FireHealthMax[iD]);
                FireText[iD] = Create3DTextLabel(string, 0xFFFFFFFFF, x, y, z, 20, 0);
            #endif
    }
    stock DeleteFire(ID)
    {
            DestroyObject(FireObj[iD]);
            TotalFires--;
            FirePos[iD][0] = 0, FirePos[iD][1] = 0, FirePos[iD][2] = 0;
            #if defined Labels
                Delete3DTextLabel(FireText[iD]);
            #endif
    }
    stock DeleteAllFire()
    {
            new ID;
            for(ID = 0; ID<MaxFire; ID++)
            {
                    DestroyObject(FireObj[iD]);
                    TotalFires= 0;
                    FirePos[iD][0] = 0, FirePos[iD][1] = 0, FirePos[iD][2] = 0;
                    #if defined Labels
                    Delete3DTextLabel(FireText);
                    #endif
            }
    }
    stock IsValidFire(ID)
    {
            if( (FirePos[iD][0] != 0) && (FirePos[iD][1] != 0) && (FirePos[iD][2] != 0) ) return true;
            else return false;
    }
    stock GetClosestFire(playerid)
    {
            new i;
            for(i = 0; i<MaxFire; i++)
            {
                if(IsValidFire(i) && IsPlayerInRangeOfPoint(playerid, 1, FirePos[0],  FirePos[1],  FirePos[2]))
                {
                    return i;
                    }
            }
            return 0;
    }
 
    public f_OnPlayerUpdate(playerid)
    {
            new newkeys,l,u;
            GetPlayerKeys(playerid, newkeys, l, u);
            new i;
            if(Holding(KEY_FIRE))
            {
            if(GetPlayerWeapon(playerid) == 42)
            {
                for(i = 0; i<MaxFire; i++)
                    {
                            if(IsValidFire(i))
                            {
                                if(PlayerFaces(playerid, FirePos[0],  FirePos[1],  FirePos[2], 1) && IsPlayerInRangeOfPoint(playerid, 4, FirePos[0],  FirePos[1],  FirePos[2]))
                                    {
                                            FireHealth-=2;
                                                #if defined Labels
                                                    new string[128];
                                                    format(string, sizeof(string), \"%d/%d\", FireHealth, FireHealthMax);
                                                            Update3DTextLabelText(FireText, 0xFFFFFFFF, string);
                                                    //Delete3DTextLabel(FireText);
                                                    //FireText = Create3DTextLabel(string, 0xFFFFFFFF, FirePos[0],  FirePos[1],  FirePos[2], 20, 0);
                                                #endif
                                                if(FireHealth <= 0)
                                                {
                                                            DeleteFire(i);
                                                            CallRemoteFunction(\"OnFireDeath\", \"dd\", i, playerid);
                                                    }
                                            }
                                    }
                            }
                    }
            }
            return 1;
    }
 
    Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ,   Float:ObjX, Float:ObjY, Float:ObjZ,   Float:FrX, Float:FrY, Float:FrZ) {
            new Float:TGTDistance;
            TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));
            new Float:tmpX, Float:tmpY, Float:tmpZ;
            tmpX = FrX * TGTDistance + CamX;
            tmpY = FrY * TGTDistance + CamY;
            tmpZ = FrZ * TGTDistance + CamZ;
            return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
    }
    stock PlayerFaces(playerid, Float:x, Float:y, Float:z, Float:radius)
    {
            new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
            GetPlayerCameraPos(playerid, cx, cy, cz);
            GetPlayerCameraFrontVector(playerid, fx, fy, fz);
            return (radius >= DistanceCameraTargetToLocation(cx, cy, cz, x, y, z, fx, fy, fz));
    }
    public VehicleToPoint(Float:radi, vehicleid, Float:x, Float:y, Float:z)
    {
                    new Float:oldposx, Float:oldposy, Float:oldposz;
                    new Float:tempposx, Float:tempposy, Float:tempposz;
                    GetVehiclePos(vehicleid, oldposx, oldposy, oldposz);
                    tempposx = (oldposx -x);
                    tempposy = (oldposy -y);
                    tempposz = (oldposz -z);
                    //printf(\"DEBUG: X:%f Y:%f Z:%f\",posx,posy,posz);
                    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                    {
                            return 1;
                    }
                    return 0;
    }
    public HealthDown()
    {
            new i,v,p;
            for(i = 0; i<MaxFire; i++)
            {
                    if(IsValidFire(i))
                    {
                            for(p = 0; p<MAX_PLAYERS; p++)
                            {
                                    if(IsPlayerInRangeOfPoint(p, 1, FirePos[0], FirePos[1], FirePos[2]) && !IsPlayerInAnyVehicle(p))
                                    {
                                   new Float:HP;
                                   GetPlayerHealth(p, HP);
                                  SetPlayerHealth(p, HP-4);
                                    }
                            }
                            for(v = 0; v<MAX_VEHICLES; v++)
                            {
                                    if(VehicleToPoint(2, v, FirePos[0], FirePos[1], FirePos[2]))
                                    {
                                    new Float:HP;
                                      GetVehicleHealth(v, HP);
                                      SetVehicleHealth(v, HP-30);
                                    }
                            }
                    }
            }
    }

 
Edit: Bocs Szabyxxx, most vettem észre, hogy amit te írtál és ez ugyan az.
« Utoljára szerkesztve: 2012. Február 28. - 17:01:04 írta Cannonn »

Tûz probléma
« Válasz #10 Dátum: 2012. Február 28. - 16:58:49 »
0 Show voters
Lol a második hozzázólást a kódot teszteld le pawno-ba és nézd meg nicns benne a hiba a második hozzászóólás az enyém...  amit kijavitottam  :smokin:

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal