RNPC ZOMBIES
#5

OK HERES MY CODE
PHP код:
    if(IsPlayerNPC(playerid))
    {
        new 
randomuladat random(2);
        new 
spawn random(sizeof(ZombieSpawns));
         
SetPlayerPos(playeridZombieSpawns[spawn][0], ZombieSpawns[spawn][1], ZombieSpawns[spawn][2]);
        if(
randomuladat == 0)
        {
            
zombiklasi[playerid] = 1;
               
SetPlayerSkin(playerid162);
               
SetRNPCHealth(playerid150);
           }
           if(
randomuladat == 1)
           {
               
zombiklasi[playerid] = 2;
               
SetRNPCHealth(playerid200);
               
SetPlayerSkin(playeridZSkins[random(4)]);
             
SetPlayerAttachedObject(playerid1290820.064999,0.045000,0.000999176.5000005.69999895.0000070.9419991.0829991.075000);
              
SetPlayerAttachedObject(playerid2290710.038000,0.051000,0.027000,-94.999984, -0.29999589.3999321.00.7390001.211000);
               
SetPlayerAttachedObject(playerid329065, -0.146000,0.000000,-0.007000,10.299988,1.500002, -89.8000101.01.01.0);
            
SetPlayerAttachedObject(playerid4290510, -0.176999,0.082000,0.0050000.0000000.000000, -92.700004,1.0679990.6629990.998000);
            
SetPlayerAttachedObject(playerid5280480.240999,0.034000,0.0000000.0000000.000000,91.4999770.7579991.0000001.214999);
            
SetPlayerAttachedObject(playerid528031,0.132999,-0.161000,0.0000000.000000,91.599998,102.6999890.259000,0.3699990.719000);
        }
        if(
randomuladat == 2)
        {
            
zombiklasi[playerid] = 3;
            
SetRNPCHealth(playerid350);
            
SetPlayerSkin(playeridZSkins[random(4)]);
            switch(
GetPlayerSkin(playerid))
            {
                  
#define SPAO21{%0,%1,%2,%3,%4,%5,%6,%7,%8} SetPlayerAttachedObject(playerid, 0, 2906, 1, (%0), (%1), (%2), (%3), (%4), (%5), (%6), (%7), (%8));
                  
case 1..299SPAO21{0.240.060.48814.699, -81.999, -0.3981.4851.4131.547}
             }
             switch(
GetPlayerSkin(playerid))
             {
                  
#define SPAO22{%0,%1,%2,%3,%4,%5,%6,%7,%8} SetPlayerAttachedObject(playerid, 1, 2907, 1, (%0), (%1), (%2), (%3), (%4), (%5), (%6), (%7), (%8));
                  
case 1..299SPAO22{-0.0510.0710.03391.801, -172.199, -91.8982.1570.9982.815}
             }
             switch(
GetPlayerSkin(playerid))
             {
                  
#define SPAO23{%0,%1,%2,%3,%4,%5,%6,%7,%8} SetPlayerAttachedObject(playerid, 2, 2908, 1, (%0), (%1), (%2), (%3), (%4), (%5), (%6), (%7), (%8));
                  
case 1..299SPAO23{0.6220.1340.0451.998170, -81.6992.6742.3352.368}
             }
               switch(
GetPlayerSkin(playerid))
             {
                  
#define SPAO24{%0,%1,%2,%3,%4,%5,%6,%7,%8} SetPlayerAttachedObject(playerid, 3, 2906, 1, (%0), (%1), (%2), (%3), (%4), (%5), (%6), (%7), (%8));
                  
case 1..299SPAO24{0.3240.121, -0.359107.89995, -119.2991.8761.2921.250}
             }
             switch(
GetPlayerSkin(playerid))
             {
                 
#define SPAO25{%0,%1,%2,%3,%4,%5,%6,%7,%8} SetPlayerAttachedObject(playerid, 4, 2905, 10, (%0), (%1), (%2), (%3), (%4), (%5), (%6), (%7), (%8));
                  
case 1..299SPAO25{-0.3230.2260.032, -4.499, -3.199, -77.8992.3021.2782.686}
             }
              switch(
GetPlayerSkin(playerid))
             {
                 
#define SPAO26{%0,%1,%2,%3,%4,%5,%6,%7,%8} SetPlayerAttachedObject(playerid, 5, 2905, 9, (%0), (%1), (%2), (%3), (%4), (%5), (%6), (%7), (%8));
                  
case 1..299SPAO26{-0.260.1430.064, -140174.901932.5731.1102.330}
               }
        }
           
SetPlayerColor(playeridZOMBIE_COLOR);
           
RNPC_SetShootable(playerid1);
        
RNPC_ToggleVehicleCollisionCheck(playerid1);
        
GetZombieVictimID[playerid] = INVALID_PLAYER_ID;
        return 
1;
    }
    else
    {
        
GetVictimDetectRange[playerid] = ZOMBIE_DETECT;
        
GetVictimTimerStatus[playerid] = 0;
    }
public 
OnZombieAttack()
{
    for(new 
npcid 0npcid MAX_ZOMBIESnpcid++)
    {
        if(
IsPlayerNPC(npcid))
        {
            if(
GetRNPCHealth(npcid) > 0)
            {
                new 
victim GetZombieVictim(npcid), Float:xFloat:yFloat:zFloat:health;
                
GetPlayerPos(npcidxyz);
                if(
victim != INVALID_PLAYER_ID)
                {
                    if(
IsPlayerInRangeOfPoint(victimGetVictimDetectRange[victim], xyz))
                    {
                        
GetZombieVictimID[npcid] = victim;

                        if(
IsPlayerInRangeOfPoint(victim1xyz))
                        {
                            
RNPC_CreateBuild(npcidPLAYER_RECORDING_TYPE_ONFOOT);
                            
RNPC_AddPause(100);
                            
RNPC_SetKeys(KEY_FIRE);
                            
RNPC_AddPause(100);
                            
RNPC_SetKeys(0);
                            
RNPC_FinishBuild();
                            
RNPC_StartBuildPlayback(npcid);
                            
GetPlayerHealth(victimhealth);
                              
SetPlayerHealth(victimhealth ZOMBIE_DAMAGE);
                              
Player[victim][pBlood] -= random(3500);
                            continue;
                        }
                        
GetPlayerPos(victimxyz);
                        
MoveRNPC(npcidxyzRNPC_SPEED_RUN1);
                    }
                }
            }
        }
    }
    return 
1;
}

public 
OnZombieRoam()
{
    for(new 
npcid 0npcid MAX_ZOMBIESnpcid++)
    {
        if(
IsPlayerNPC(npcid))
        {
            if(
GetRNPCHealth(npcid) > 0)
            {
                new 
victim GetZombieVictim(npcid), Float:xFloat:yFloat:z;
                
GetPlayerPos(npcidxyz);
                if(
victim == INVALID_PLAYER_ID)
                  {
                    new 
pos random(4);
                    if(
pos == 0) { 100.0; }
                    else if(
pos == 1) { 100.0; }
                    else if(
pos == 2) { 100.0; }
                    else if(
pos == 3) { 100.0; }

                    
GetZombieVictimID[npcid] = INVALID_PLAYER_ID;

                    
RNPC_SetKeys(0);

                    
MoveRNPC(npcidxyzRNPC_SPEED_WALK1);
                 }
            }
        }
    }
    return 
1;
}

public 
ResetDetectRange(playerid)
{
    if(
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK)
    {
        
GetVictimDetectRange[playerid] = (ZOMBIE_DETECT 4);
        
GetVictimTimerStatus[playerid] = 1;
        
GetVictimResetTimer[playerid] = SetTimerEx("ResetDetectRange"5000false"i"playerid);
        return 
1;
    }

    
GetVictimTimerStatus[playerid] = 0;
    
GetVictimDetectRange[playerid] = ZOMBIE_DETECT;
    return 
1;
}
stock GetZombieVictim(npcid)
{
    for(new 
playerid 0playerid MAX_PLAYERSplayerid++)
    {
        if(!
IsPlayerNPC(playerid) && IsPlayerConnected(playerid))
        {
            new 
Float:xFloat:yFloat:z;
            
GetPlayerPos(npcidxyz);
            if(
IsPlayerInRangeOfPoint(playeridGetVictimDetectRange[playerid], xyz) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerInterior(playerid) == && GetPlayerVirtualWorld(playerid) == 0) return playerid;
        }
    }
    return 
INVALID_PLAYER_ID;
}
stock GetMaxZombies()
{
    return 
350;

Reply


Messages In This Thread
RNPC ZOMBIES - by Pearson - 07.10.2016, 23:05
Re: RNPC ZOMBIES - by Pearson - 08.10.2016, 01:51
Re: RNPC ZOMBIES - by SickAttack - 08.10.2016, 02:38
Re: RNPC ZOMBIES - by Kaliber - 08.10.2016, 03:32
Re: RNPC ZOMBIES - by Pearson - 08.10.2016, 12:15
Re: RNPC ZOMBIES - by Mauzen - 08.10.2016, 13:03
Re: RNPC ZOMBIES - by Pearson - 08.10.2016, 13:59
Re: RNPC ZOMBIES - by Pearson - 08.10.2016, 21:19

Forum Jump:


Users browsing this thread: 1 Guest(s)