SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/03/2013, 03:14 PM   #1
seoseokbin
Little Clucker
 
Join Date: Dec 2012
Posts: 15
Reputation: 0
Default DynamicObject problem

I CreateDynamicObject, MoveDynamicObject, GetDynamicObjectPos and IsValidDynamicObject this includes the use Streamer.inc.But compiled perfectly.Once inside the server object, blink disappeared and appeared to repeat.

Current PAWN version 0.3D.

've Been using the below code. Please, please fix this problem.
PHP Code:
#include <a_samp>
#include <Dini>
#include <gameinfo>
#include <utils>
#include <morphinc>
#include <veh>
#include <Streamer>
#include <audio>


new Ticket[M_P];
forward HoldingFire();
enum weapParts
{
    
WeapId,
    
allow,
    
Float:range,
    
Float:wide,
    
damageMin,
    
damageMax,
    
cutting,
    
instaGib,
    
continua,
    
mnsg[150]
};
new 
weapL[55][weapParts]=
{
//  ID                      allow    range   wide    dMin    dMax    cutting    insGib    continua    msng
    
{0,                     true,   1.0,    45.0,    5,        10,        false,    false,    false,  "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_BRASSKNUCKLE,    true,    1.5,    45.0,    5,        15,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_GOLFCLUB,        true,    2.0,    35.0,    20,        25,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_NITESTICK,        true,    1.5,    35.0,    10,        15,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_KNIFE,            true,    1.5,    15.0,    10,        15,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_BAT,            true,    2.0,    35.0,    10,        15,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_SHOVEL,            true,    2.0,    35.0,    10,        25,        true,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_POOLSTICK,        true,    2.0,    35.0,    10,        15,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_KATANA,            true,    2.0,    45.0,    20,        45,        true,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_CHAINSAW,        true,    2.5,    35.0,    20,        35,        true,    false,    true,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_DILDO,            false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_DILDO2,            false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_VIBRATOR,        false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_VIBRATOR2,        false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_FLOWER,            false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_CANE,            true,    2.0,    35.0,    10,        15,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_GRENADE,        true,    30.0,    35.0,    10,        100,    false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Hit"},
    {
WEAPON_TEARGAS,        false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_MOLTOV,            false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {-
1,                    false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {-
1,                    false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {-
1,                    false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_COLT45,            true,    20.0,    7.0,    10,        15,        false,    false,    true,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_SILENCED,        true,    20.0,    3.0,    10,        15,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_DEAGLE,            true,    30.0,    10.0,    15,        25,        false,    true,    true,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_SHOTGUN,        true,    18.0,    7.0,    10,        25,        true,    true,    true,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_SAWEDOFF,        true,    12.0,    10.0,    12,        18,        true,    true,    true,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_SHOTGSPA,        true,    18.0,    7.0,    25,        45,        true,    true,    true,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_UZI,            false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_MP5,            false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_AK47,            false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_M4,                false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_TEC9,            false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_RIFLE,            true,    50.0,    2.0,    0,        50,        false,    true,    true,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_SNIPER,            true,    100.0,    1.0,    0,        60,        false,    true,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_ROCKETLAUNCHER,    false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_HEATSEEKER,        false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_FLAMETHROWER,    true,    8.0,    15.0,    10,        20,        false,    false,    true,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_MINIGUN,        true,    25.0,    3.0,    1,        99,        true,    true,    true,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_SATCHEL,        false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_BOMB,            false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_SPRAYCAN,        true,    2.0,    25.0,    10,        0,        false,    false,    true,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_FIREEXTINGUISHER,true,    3.5,    15.0,    10,        0,        false,    false,    true,    "~n~~n~~n~~n~~n~~n~~n~~r~HIT!"},
    {
WEAPON_CAMERA,            false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {-
1,                    false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {-
1,                    false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_PARACHUTE,        false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {-
1,                    false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {-
1,                    false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_VEHICLE,        false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {-
1,                    false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {-
1,                    false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {-
1,                    false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_DROWN,            false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"},
    {
WEAPON_COLLISION,        false,    0.0,    0.0,    0,        0,        false,    false,    false,    "~n~~n~~n~~n~~n~~n~~n~~r~Dont Hit"}
};

new 
NOFZombies=0;
new 
TOTALZombies=9999;
new 
Float:Zspeed 2.9;
new 
ZTimerSpeed 500;
new 
Float:vaiven 5.0;
new 
Float:X,Float:Y,Float:Z;

#define MAX_ZOMBIES 9999

#define brazo1 1
#define brazo2 2
#define pierna1 4
#define pierna2 8
enum zombiParts
{
    
rArm,
    
lArm,
    
rLeg,
    
lLeg,
    
head,
    
torso,
    
pedazos,
    
HP,
    
Float:ArmAngle,
    
Float:ArmStatus,
    
Float:angulo,
    
Float:speed,
    
LegsH,
    
undead,
    
target
};

new 
zombie[MAX_ZOMBIES][zombiParts];

enum zombiPos
{
    
partModel,
    
Float:RelX,
    
Float:RelY,
    
Float:RelZ,
    
Float:RelrX,
    
Float:RelrY,
    
Float:RelrZ
}
enum zpart
{
    
rLegZ,
    
rArmZ,
    
torsoZ,
    
lArmZ,
    
headZ,
    
lLegZ
}
new 
z1[zpart][zombiPos]=
{
    {
2905,-0.115479,-0.023924, -1.280131, -90.00000090.000000,0.000000},
    {
2906, -0.2189950.200928, -0.2531350.000000180.0000000.000000},
    {
2907, -0.032227, -0.045897, -0.544213270.0000000.0000000.000000},
    {
29060.1879870.158448, -0.2657930.0000000.0000000.000000},
    {
29080.0000000.0000000.000000270.00000090.0000000.000000},
    {
29050.101074, -0.012694, -1.288253270.00000090.0000000.000000}
};

new 
z2[6][zombiPos]=
{
    {
29050.005614, -0.110107, -1.280131, -90.00000090.00000090.000000},
    {
2906, -0.148926, -0.180663, -0.2531350.000000180.00000090.000000},
    {
29070.047852, -0.039061, -0.544213270.0000000.00000090.000000},
    {
2906, -0.1523430.171387, -0.2657930.0000000.00000090.000000},
    {
29080.0000000.0000000.000000270.00000090.00000090.000000},
    {
29050.0009770.090332, -1.288253270.00000090.00000090.000000}
};
enum zArm
{
    
Float:AZ,
    
Float:AA
};
enum tipo
{
    
der,
    
izq
};
new 
A1[tipo][zArm]=
{
    {-
0.253135,0.0},
    {-
0.265793,0.0}
};
new 
A2[tipo][zArm]=
{
    {-
0.359635, -90.0},
    {-
0.338874, -90.0}
};
forward zombieAtaca(playerid);
forward attacknearest();
new 
TimerAtaca=-1;
new 
TimerAPO=-1;
new 
PlayerDeath[M_P];

new 
CatchZombie[M_P]; // 잡기퀘스트 변수
new Float:itemx,Float:itemy,Float:itemz;
new 
Float:rex,Float:rey,Float:rez;

new 
apocalipsis false;

enum WeaponType
{
    
pWeapId,
    
pAmmo
};
new 
WeaponList[M_P][12][WeaponType];
new 
LastWeaponUsed[M_P];
forward QuitarArmasZombie(playerid);
forward DevolverArmasZombie(playerid);
forward CreateRandomZombie();

#define delay 500

new lstring[256];
new 
lstr[256];



public 
attacknearest()
{
    new 
Float:pX,Float:pY,Float:pZ;
    new 
Float:distNew,Float:distOld;
    new 
candidato;
    for (new 
j=0;j<TOTALZombies;j++)
    {
        if (
zombie[j][undead])
        {
            
distOld=9999.9;
            
candidato=-1;
            
GetDynamicObjectPos(zombie[j][head],X,Y,Z);
            for(new 
i=0;i<MAX_PLAYERS;i++)
            {
                if(
IsPlayerConnected(i))
                {
                    
GetPlayerPos(i,pX,pY,pZ);
                    
distNew floatabs(pX-X) + floatabs(pY-Y);
                    if (
distNew<distOld)
                    {
                    
distOld distNew;
                    
candidato i;
                    }
                }
            }
            if (
distOld>100.0)
            {
                
DestroyDynamicObject(zombie[j][head]);
                
DestroyDynamicObject(zombie[j][rLeg]);
                
DestroyDynamicObject(zombie[j][lLeg]);
                
DestroyDynamicObject(zombie[j][rArm]);
                
DestroyDynamicObject(zombie[j][lArm]);
                
DestroyDynamicObject(zombie[j][torso]);
                
NOFZombies--;
                
zombie[j][undead]=false;
                
SetTimer("CreateRandomZombie",1000,0);
            }
            
zombie[j][target]=candidato;
        }
    }
}
//------------------------------------------------------------------------------
CrearZombie(Float:pX,Float:pY,Float:pZ,Float:angle)
{
    new 
Float:PEPE floatsin((angle*3.14159/180.0));
    new 
Float:PIPO floatcos((angle*3.14159/180.0));
    if (
NOFZombies<TOTALZombies)
    {
        new 
j=0;
        while ((
zombie[j][undead])){j++;}
        if (
IsValidDynamicObject(zombie[j][torso]))
        {
            
DestroyDynamicObject(zombie[j][head]);
            
DestroyDynamicObject(zombie[j][rLeg]);
            
DestroyDynamicObject(zombie[j][lLeg]);
            
DestroyDynamicObject(zombie[j][rArm]);
            
DestroyDynamicObject(zombie[j][lArm]);
            
DestroyDynamicObject(zombie[j][torso]);
        }
        
zombie[j][head]=CreateDynamicObject(z1[headZ][partModel],pX,pY,pZ,z1[headZ][RelrX],z1[headZ][RelrY],angle);
        
zombie[j][torso]=CreateDynamicObject(z1[torsoZ][partModel],pX+z1[torsoZ][RelX]*PIPO+PEPE*z2[torsoZ][RelX],pY+z1[torsoZ][RelY]*PIPO+PEPE*z2[torsoZ][RelY],pZ+z1[torsoZ][RelZ],z1[torsoZ][RelrX],z1[torsoZ][RelrY],angle);
        
zombie[j][lArm]=CreateDynamicObject(z1[lArmZ][partModel],pX+z1[lArmZ][RelX]*PIPO+PEPE*z2[lArmZ][RelX],pY+z1[lArmZ][RelY]*PIPO+PEPE*z2[lArmZ][RelY],pZ+z1[lArmZ][RelZ],z1[lArmZ][RelrX],z1[lArmZ][RelrY],angle);
        
zombie[j][rArm]=CreateDynamicObject(z1[rArmZ][partModel],pX+z1[rArmZ][RelX]*PIPO+PEPE*z2[rArmZ][RelX],pY+z1[rArmZ][RelY]*PIPO+PEPE*z2[rArmZ][RelY],pZ+z1[rArmZ][RelZ],z1[rArmZ][RelrX],z1[rArmZ][RelrY],angle);
        
zombie[j][rLeg]=CreateDynamicObject(z1[rLegZ][partModel],pX+z1[rLegZ][RelX]*PIPO+PEPE*z2[rLegZ][RelX],pY+z1[rLegZ][RelY]*PIPO+PEPE*z2[rLegZ][RelY],pZ+z1[rLegZ][RelZ],z1[rLegZ][RelrX],z1[rLegZ][RelrY],angle);
        
zombie[j][lLeg]=CreateDynamicObject(z1[lLegZ][partModel],pX+z1[lLegZ][RelX]*PIPO+PEPE*z2[lLegZ][RelX],pY+z1[lLegZ][RelY]*PIPO+PEPE*z2[lLegZ][RelY],pZ+z1[lLegZ][RelZ],z1[lLegZ][RelrX],z1[lLegZ][RelrY],angle);

        
zombie[j][LegsH]=true;
        
zombie[j][speed]=random(100)+50;
        
zombie[j][ArmAngle]=0;
        
zombie[j][ArmStatus]=random(5)+5;
        
zombie[j][undead]=true;
        
zombie[j][HP]=100;
        
zombie[j][pedazos]= brazo1 brazo2 pierna1 pierna2;
        
zombie[j][angulo]=angle;
        
NOFZombies++;
    }
    return 
1;
}
//------------------------------------------------------------------------------


cleanZombies()
{
    for (new 
j=0;j<TOTALZombies;j++)
    {
        
zombie[j][undead]=false;
        if (
IsValidDynamicObject(zombie[j][torso]))DestroyDynamicObject(zombie[j][torso]);
        if (
IsValidDynamicObject(zombie[j][head]))    DestroyDynamicObject(zombie[j][head]);
        if (
IsValidDynamicObject(zombie[j][rLeg]))    DestroyDynamicObject(zombie[j][rLeg]);
        if (
IsValidDynamicObject(zombie[j][lLeg]))    DestroyDynamicObject(zombie[j][lLeg]);
        if (
IsValidDynamicObject(zombie[j][rArm]))    DestroyDynamicObject(zombie[j][rArm]);
        if (
IsValidDynamicObject(zombie[j][lArm]))    DestroyDynamicObject(zombie[j][lArm]);
        
NOFZombies--;
    }
    if (
TimerAPO!=-1){KillTimer(TimerAPO);}
    if (
TimerAtaca!=-1){KillTimer(TimerAtaca);}
}



public 
zombieAtaca(playerid)
{
    new 
Float:pX,Float:pY,Float:pZ,Float:angle,Float:PEPE,Float:PIPO,Float:AA1,Float:AA2,Float:H;
    new 
vehicleStatus;
    if (
NOFZombies<&& !apocalipsis)
    {
          if (
TimerAPO!=-1){KillTimer(TimerAPO);}
        if (
TimerAtaca!=-1){KillTimer(TimerAtaca);}
    }
    
HoldingFire();
    for (new 
j=0;j<TOTALZombies;j++)
    {

        
GetDynamicObjectPos(zombie[j][head],X,Y,Z);
        if(
zombie[j][undead]&&IsPlayerConnected(playerid) && GetPlayerInterior(playerid)==&& PlayerToPoint(10.0,playerid,X,Y,Z))
        {
            
vehicleStatus IsPlayerInAnyVehicle(playerid);
            
GetPlayerPos(playerid,pX,pY,pZ);
            
pZ+=0.7;
            
GetDynamicObjectPos(zombie[j][head],X,Y,Z);
            
angle 180.0-atan2(X-pX,Y-pY);
            
angle+=vaiven;
            
vaiven*=-1;
            
PEPE floatsin((angle*3.14159/180.0));
            
PIPO floatcos((angle*3.14159/180.0));
            
zombie[j][angulo]=angle;
            if(
floatabs(zombie[j][ArmAngle])>10.0){zombie[j][ArmStatus]*=-1;}
            
zombie[j][ArmAngle]+=zombie[j][ArmStatus];

            
zombie[j][LegsH]=!zombie[j][LegsH];

            
AA1 floatcos(zombie[j][ArmAngle]*3.14159/180.0);
            
AA2 floatsin(zombie[j][ArmAngle]*3.14159/180.0);

            if ((
pZ-Z)>3.0)
               {
                   
Z+=1.0;
            }
            else if((
pZ-Z)<-3.0)
            {
                
Z-=1.0;
            }
            
//we destroy the old zombi
            
DestroyDynamicObject(zombie[j][torso]);
            
DestroyDynamicObject(zombie[j][head]);
            if (
zombie[j][pedazos] & brazo1DestroyDynamicObject(zombie[j][rArm]);
            if (
zombie[j][pedazos] & brazo2DestroyDynamicObject(zombie[j][lArm]);
            if (
zombie[j][pedazos] & pierna1DestroyDynamicObject(zombie[j][rLeg]);
            if (
zombie[j][pedazos] & pierna2DestroyDynamicObject(zombie[j][lLeg]);

            
//we recreate the zombie
            
zombie[j][head]=CreateDynamicObject(z1[headZ][partModel],X,Y,pZ,z1[headZ][RelrX],z1[headZ][RelrY],angle+vaiven);
            
zombie[j][torso]=CreateDynamicObject(z1[torsoZ][partModel],X+z1[torsoZ][RelX]*PIPO+PEPE*z2[torsoZ][RelX],Y+z1[torsoZ][RelY]*PIPO+PEPE*z2[torsoZ][RelY],pZ+z1[torsoZ][RelZ],z1[torsoZ][RelrX],z1[torsoZ][RelrY],angle);
            if (
zombie[j][pedazos] & brazo1)
            
zombie[j][rArm]=CreateDynamicObject(z1[rArmZ][partModel],X+z1[rArmZ][RelX]*PIPO+PEPE*z2[rArmZ][RelX],Y+z1[rArmZ][RelY]*PIPO+PEPE*z2[rArmZ][RelY],pZ+A1[der][AZ]*AA1+AA2*A2[der][AZ],(-1)*zombie[j][ArmAngle],z1[rArmZ][RelrY],angle);
            if (
zombie[j][pedazos] & brazo2)
            
zombie[j][lArm]=CreateDynamicObject(z1[lArmZ][partModel],X+z1[lArmZ][RelX]*PIPO+PEPE*z2[lArmZ][RelX],Y+z1[lArmZ][RelY]*PIPO+PEPE*z2[lArmZ][RelY],pZ+A1[izq][AZ]*AA1-AA2*A2[izq][AZ],zombie[j][ArmAngle],z1[lArmZ][RelrY],angle);
            if (
zombie[j][pedazos] & pierna1)
            
zombie[j][rLeg]=CreateDynamicObject(z1[rLegZ][partModel],X+z1[rLegZ][RelX]*PIPO+PEPE*z2[rLegZ][RelX],Y+z1[rLegZ][RelY]*PIPO+PEPE*z2[rLegZ][RelY],pZ+z1[rLegZ][RelZ]+float(zombie[j][LegsH])*0.2,z1[rLegZ][RelrX],z1[rLegZ][RelrY],angle);

            if (
zombie[j][pedazos] & pierna2)
            
zombie[j][lLeg]=CreateDynamicObject(z1[lLegZ][partModel],X+z1[lLegZ][RelX]*PIPO+PEPE*z2[lLegZ][RelX],Y+z1[lLegZ][RelY]*PIPO+PEPE*z2[lLegZ][RelY],pZ+z1[lLegZ][RelZ]+float(!zombie[j][LegsH])*0.2,z1[lLegZ][RelrX],z1[lLegZ][RelrY],angle);

//            new zp = GetObjectPos(zombie[j][head],X,Y,Z);

            
if ( (floatabs(pX-X) + floatabs(pY-Y) + floatabs(pZ-Z) )>(2.0+6.0*vehicleStatus))//The zombie will move to your position to eat you because if you are too far away
            
{
                
MoveDynamicObject(zombie[j][head],pX,pY,pZ,zombie[j][speed]*0.01*Zspeed);
                
MoveDynamicObject(zombie[j][torso],pX+z1[torsoZ][RelX]*PIPO+PEPE*z2[torsoZ][RelX],pY+z1[torsoZ][RelY]*PIPO+PEPE*z2[torsoZ][RelY],pZ+z1[torsoZ][RelZ],zombie[j][speed]*0.01*Zspeed);
                if (
zombie[j][pedazos] & brazo1)
                
MoveDynamicObject(zombie[j][rArm],pX+z1[rArmZ][RelX]*PIPO+PEPE*z2[rArmZ][RelX],pY+z1[rArmZ][RelY]*PIPO+PEPE*z2[rArmZ][RelY],pZ+A1[der][AZ]*AA1+AA2*A2[der][AZ],zombie[j][speed]*0.01*Zspeed);
                if (
zombie[j][pedazos] & brazo2)
                
MoveDynamicObject(zombie[j][lArm],pX+z1[lArmZ][RelX]*PIPO+PEPE*z2[lArmZ][RelX],pY+z1[lArmZ][RelY]*PIPO+PEPE*z2[lArmZ][RelY],pZ+A1[izq][AZ]*AA1-AA2*A2[izq][AZ],zombie[j][speed]*0.01*Zspeed);
                if (
zombie[j][pedazos] & pierna1)
                
MoveDynamicObject(zombie[j][rLeg],pX+z1[rLegZ][RelX]*PIPO+PEPE*z2[rLegZ][RelX],pY+z1[rLegZ][RelY]*PIPO+PEPE*z2[rLegZ][RelY],pZ+z1[rLegZ][RelZ]+float(zombie[j][LegsH])*0.2,zombie[j][speed]*0.01*Zspeed);
                if (
zombie[j][pedazos] & pierna2)
                
MoveDynamicObject(zombie[j][lLeg],pX+z1[lLegZ][RelX]*PIPO+PEPE*z2[lLegZ][RelX],pY+z1[lLegZ][RelY]*PIPO+PEPE*z2[lLegZ][RelY],pZ+z1[lLegZ][RelZ]+float(!zombie[j][LegsH])*0.2,zombie[j][speed]*0.01*Zspeed);
            }
            else
//the zombie EATS you unless you are in a vehicle or you are alredy dead
            
{
                
StopDynamicObject(zombie[j][head]);
                
StopDynamicObject(zombie[j][torso]);
                
StopDynamicObject(zombie[j][rArm]);
                
StopDynamicObject(zombie[j][lArm]);
                
StopDynamicObject(zombie[j][rLeg]);
                
StopDynamicObject(zombie[j][lLeg]);
                
GetPlayerHealth(playerid,H);
                if ( !
vehicleStatus && !PlayerDeath[zombie[j][target]])
                {
                    
SetPlayerHealth(playerid,H-2.5);
                }
            }
        }
    }
    return 
1;
}

fire(playerid,STAT)
{
//    new tmp[250];
    
new  weap GetPlayerWeapon(playerid);
//    format(tmp,sizeof(tmp),"ARMA ID : %d ", weap);
//    SendClientMessageToAll(0xFFFF00AA,tmp);
    
if (!weapL[weap][allow])
    {

        
GameTextForPlayer(playerid,weapL[weap][mnsg],2000,5);
        return 
1;
    }
    if (!
weapL[weap][continua] && STAT==HOLD)
    {
        return 
1;
    }
    
Ticket[playerid]=tickcount()+delay;

    new 
Float:pX,Float:pY,Float:pZ,Float:pA,Float:PEPE,Float:PIPO;
    new 
Float:zzX,Float:zzY,Float:zzA;
    
GetPlayerPos(playerid,pX,pY,pZ);
    
GetPlayerFacingAngle(playerid,pA);
    
pZ=pZ+0.7;
    new 
ran;
    for (new 
j=0;j<TOTALZombies;j++)
    {
        if (
IsValidDynamicObject(zombie[j][torso]))
        {
            
GetDynamicObjectPos(zombie[j][head],X,Y,Z);
            
zzX=X-pX;zzY=Y-pY;zzA=atan2(zzX,zzY);if(zzA>0)zzA-=360.0;
        }
        if (
zombie[j][undead]&&(floatsqroot(floatpower(zzX,2)+floatpower(zzY,2)))<weapL[weap][range] && (floatabs(zzA+pA)<weapL[weap][wide]))
        {
            
Z-=1.7;
            
zombie[j][HP]-= random(weapL[weap][damageMax]-weapL[weap][damageMin])+weapL[weap][damageMin];
            
GameTextForPlayer(playerid,weapL[weap][mnsg],delay-100,5);
            
PEPE floatsin((zombie[j][angulo]*3.14159/180.0));
            
PIPO floatcos((zombie[j][angulo]*3.14159/180.0));
            if (
weapL[weap][cutting])
            {
                if  ((
zombie[j][pedazos] & brazo1) || (zombie[j][pedazos] & brazo2))
                {
                    if (
ran 20)
                    {
                        if (( 
ran 10 || !(zombie[j][pedazos] & brazo2)) && (zombie[j][pedazos] & brazo1))
                        {
                            
zombie[j][pedazos]-=brazo1;MoveDynamicObject(zombie[j][rArm],X+z1[rArmZ][RelX]*PIPO+PEPE*z2[rArmZ][RelX],Y+z1[rArmZ][RelY]*PIPO+PEPE*z2[rArmZ][RelY],Z,1.0);
                        }
                        else
                        {
                            
zombie[j][pedazos]-=brazo2;MoveDynamicObject(zombie[j][lArm],X+z1[lArmZ][RelX]*PIPO+PEPE*z2[lArmZ][RelX],Y+z1[lArmZ][RelY]*PIPO+PEPE*z2[lArmZ][RelY],Z,1.0);
                        }
                    }
                }
                else if  (
zombie[j][HP]<40 && (zombie[j][pedazos] & pierna1 ) && (zombie[j][pedazos] & pierna2))
                {
                    if (
ran 15){zombie[j][pedazos]-=pierna1;MoveDynamicObject(zombie[j][rLeg],X+z1[rLegZ][RelX]*PIPO+PEPE*z2[rLegZ][RelX],Y+z1[rLegZ][RelY]*PIPO+PEPE*z2[rLegZ][RelY],Z,1.0);}
                    else{
zombie[j][pedazos]-=pierna2;MoveDynamicObject(zombie[j][lLeg],X+z1[lLegZ][RelX]*PIPO+PEPE*z2[lLegZ][RelX],Y+z1[lLegZ][RelY]*PIPO+PEPE*z2[lLegZ][RelY],Z,1.0);}
                    
zombie[j][speed]-=float(40);
                }
            }
            if (
zombie[j][HP]<&& zombie[j][undead]) //좀비 사망부분
            
{
                
                
zombierespawn2 SetTimerEx("zombierespawn",300000,true,"i",playerid)
                
GetDynamicObjectPos(zombie[j][head],rex,rey,rez);
                
                
ZK[playerid] += 1;

                new 
cString[256];
                
format(cString,sizeof(cString),"/줍기",tatoos[playerid]);
                
GetPlayerPos(playerid,itemx,itemy,itemz);
                
GetDynamicObjectPos(zombie[j][head],itemx,itemy,itemz);
                
Graffti[playerid] = Create3DTextLabel(cString,0xFF0000FF,itemx,itemy,itemz,30,0,0);

                if(
PlayerInfo[playerid][Quest] == && PlayerInfo[playerid][pTut] == 11)
                {
                
PlayerFixRadio(playerid);
                
PlayerInfo[playerid][pTut] = 12;
                
PlayerInfo[playerid][Quest] = 3;
                
SCM(playerid,COLOR_YELLOW,"  ");
                
SCM(playerid,COLOR_YELLOW,"[Quest]"#C_WHITE" 퀘스트를 완료했습니다. 엘리스에게 돌아가야합니다");
                
SCM(playerid,COLOR_YELLOW,"  ");
                }
                
                if(
PlayerInfo[playerid][Quest] == && PlayerInfo[playerid][pTut] == 14)
                {
                
PlayerFixRadio(playerid);
                
PlayerInfo[playerid][pTut] = 15;
                
PlayerInfo[playerid][Quest] = 4;
                
SCM(playerid,COLOR_YELLOW,"  ");
                
SCM(playerid,COLOR_YELLOW,"[Quest]"#C_WHITE" 퀘스트를 완료했습니다. 엘리스에게 돌아가야합니다");
                
SCM(playerid,COLOR_YELLOW,"  ");
                }
                
                if(
PlayerInfo[playerid][Quest] == && PlayerInfo[playerid][pTut] == 16)
                {
                new 
string[256];
                
CatchZombie[playerid]++;
                
format(string,sizeof(string),"~r~%d~r~/~r~3",CatchZombie[playerid]);
                
GameTextForPlayer(playerid,string,2500,3);
                
                if(
CatchZombie[playerid] >= 3)
                {
                
PlayerFixRadio(playerid);
                
PlayerInfo[playerid][pTut] = 17;
                
PlayerInfo[playerid][Quest] = 5;
                
SCM(playerid,COLOR_YELLOW,"  ");
                
SCM(playerid,COLOR_YELLOW,"[Quest]"#C_WHITE" 퀘스트를 완료했습니다. 엘리스에게 돌아가야합니다");
                
SCM(playerid,COLOR_YELLOW,"  ");
                }
                }
                
                if(
PlayerInfo[playerid][Quest] == && PlayerInfo[playerid][pTut] == 19)
                {
                new 
string[256];
                
CatchZombie[playerid]++;
                
format(string,sizeof(string),"~r~%d~r~/~r~7",CatchZombie[playerid]);
                
GameTextForPlayer(playerid,string,2500,3);

                if(
CatchZombie[playerid] >= 7)
                {
                
PlayerFixRadio(playerid);
                
PlayerInfo[playerid][pTut] = 20;
                
PlayerInfo[playerid][Quest] = 6;
                
SCM(playerid,COLOR_YELLOW,"  ");
                
SCM(playerid,COLOR_YELLOW,"[Quest]"#C_WHITE" 퀘스트를 완료했습니다. 엘리스에게 돌아가야합니다");
                
SCM(playerid,COLOR_YELLOW,"  ");
                }
                }
                
                if(
PlayerInfo[playerid][Quest] == && PlayerInfo[playerid][pTut] == 21)
                {
                new 
string[256];
                
CatchZombie[playerid]++;
                
format(string,sizeof(string),"~r~%d~r~/~r~10",CatchZombie[playerid]);
                
GameTextForPlayer(playerid,string,2500,3);

                if(
CatchZombie[playerid] >= 10)
                {
                
PlayerFixRadio(playerid);
                
PlayerInfo[playerid][pTut] = 22;
                
PlayerInfo[playerid][Quest] = 7;
                
SCM(playerid,COLOR_YELLOW,"  ");
                
SCM(playerid,COLOR_YELLOW,"[Quest]"#C_WHITE" 퀘스트를 완료했습니다. 엘리스에게 돌아가야합니다");
                
SCM(playerid,COLOR_YELLOW,"  ");
                }
                }
                
                if(
PlayerInfo[playerid][Quest] == && PlayerInfo[playerid][pTut] == 23)
                {
                new 
string[256];
                
CatchZombie[playerid]++;
                
format(string,sizeof(string),"~r~%d~r~/~r~15",CatchZombie[playerid]);
                
GameTextForPlayer(playerid,string,2500,3);

                if(
CatchZombie[playerid] >= 15)
                {
                
PlayerFixRadio(playerid);
                
PlayerInfo[playerid][pTut] = 24;
                
PlayerInfo[playerid][Quest] = 8;
                
SCM(playerid,COLOR_YELLOW,"  ");
                
SCM(playerid,COLOR_YELLOW,"[Quest]"#C_WHITE" 퀘스트를 완료했습니다. 엘리스에게 돌아가야합니다");
                
SCM(playerid,COLOR_YELLOW,"  ");
                }
                }

                
zombie[j][undead]=false;
                
NOFZombies--;
                
MoveDynamicObject(zombie[j][head],X,Y,Z,2.0);
                
MoveDynamicObject(zombie[j][torso],X+z1[torsoZ][RelX]*PIPO+PEPE*z2[torsoZ][RelX],Y+z1[torsoZ][RelY]*PIPO+PEPE*z2[torsoZ][RelY],Z+0.4,2.0);
                if (
zombie[j][pedazos] & brazo1)
                
MoveDynamicObject(zombie[j][rArm],X+z1[rArmZ][RelX]*PIPO+PEPE*z2[rArmZ][RelX],Y+z1[rArmZ][RelY]*PIPO+PEPE*z2[rArmZ][RelY],Z,2.0);
                if (
zombie[j][pedazos] & brazo2)
                
MoveDynamicObject(zombie[j][lArm],X+z1[lArmZ][RelX]*PIPO+PEPE*z2[lArmZ][RelX],Y+z1[lArmZ][RelY]*PIPO+PEPE*z2[lArmZ][RelY],Z,2.0);
                if (
zombie[j][pedazos] & pierna1)
                
StopDynamicObject(zombie[j][rLeg]);
                if (
zombie[j][pedazos] & pierna2)
                
StopDynamicObject(zombie[j][lLeg]);
            }
        }
    }
    return 
1;
}
public 
HoldingFire()
{
    new 
keys,updown,leftright;
    for (new 
i=0;i<M_P;i++)
    {
        if (
IsPlayerConnected(i))
        {
            
GetPlayerKeys(i,keys,updown,leftright);
            if ((
keys KEY_FIRE)&&(!IsPlayerInAnyVehicle(i))&&(Ticket[i]<tickcount()))
            {
                
fire(i,HOLD);
            }
        }
    }
}
public 
CreateRandomZombie()
{
    new 
playerid random(M_P);
    while (!
IsPlayerConnected(playerid)&&GetPlayerInterior(playerid)==0)playerid random(M_P);
    new 
Float:pX,Float:pY,Float:pZ,Float:Ang;
    
GetPlayerPos(playerid,pX,pY,pZ);
    
Ang=float(random(360));
    
pX=pX+50.0*floatsin(Ang,degrees);
    
pY=pY+50.0*floatcos(Ang,degrees);
    
pZ=pZ+0.7;
    
CrearZombie(pX,pY,pZ,Ang);
}
//------------------------------------------------------------------------------
public QuitarArmasZombie(playerid)
{
    
LastWeaponUsed[playerid]=GetPlayerWeapon(playerid);GetPlayerWeapon(playerid);
    new 
WeaponId;
    new 
ammo;
    for (new 
i=0;i<11;i++)
        {
                
GetPlayerWeaponData(playerid,i,WeaponId,ammo);
                
WeaponList[playerid][i][pWeapId]=WeaponId;
                
WeaponList[playerid][i][pAmmo]=ammo;
        }
    
ResetPlayerWeapons(playerid);
    return 
1;
}
//------------------------------------------------------------------------------
public DevolverArmasZombie(playerid)
{
    new 
index;
    for (new 
i=0;i<11;i++)
        {
                if      (
WeaponList[playerid][i][pWeapId]!=0)
                {
                    if  (
WeaponList[playerid][i][pWeapId]!=LastWeaponUsed[playerid])
                {
                        
GivePlayerWeapon(playerid,WeaponList[playerid][i][pWeapId],WeaponList[playerid][i][pAmmo]);
                }
                        else
                        {
                                
index=i;
                        }
        }
        }
    
GivePlayerWeapon(playerid,WeaponList[playerid][index][pWeapId],WeaponList[playerid][index][pAmmo]);
    return 
1;

seoseokbin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Map] BackYard Mapping(Parties) - Including DynamicObject cluckernine50 Maps 0 24/02/2013 12:32 PM
How to give ObjectID to a dynamicobject? qkac1234 Scripting Help 4 26/01/2013 09:33 AM
Info Pickup problem [SOLVED] New problem now..... Juanxz Help Archive 2 22/01/2010 07:19 AM
[SOLVED] 3 problem's! (1 problem still unsolved, but stopped solving.) Mechscape Help Archive 9 24/12/2009 08:47 PM


All times are GMT. The time now is 10:26 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.