RC Tiger isn't shooting rockets
#4

Quote:
Originally Posted by VanillaRain
Посмотреть сообщение
Continue to not shooting
At me shooting



Code
PHP код:
new FireShot[MAX_PLAYERS];
new 
gRocketObj[MAX_PLAYERS];
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
FireShot[playerid] == && KEY_FIRE newkeys)   // Only run the code if the object doesn't already exist, otherwise more objects will take up gRocketObj and the previous ones won't be deleted
     
{
          
SetPlayerTime(playerid,0,0);
        new
            
vehicleid GetPlayerVehicleID(playerid),
             
Float:x,
            
Float:y,
            
Float:z,
            
Float:r,
            
Float:dist 50.0,
            
Float:tmpang,
            
Float:tmpx,
            
Float:tmpy,
            
Float:tmpz;
        
FireShot[playerid] = 1;
        
SetTimerEx("ShotFire"10000"i"playerid);
        
GetVehiclePos(vehicleidxyz);
        
GetVehicleZAngle(vehicleidr);
        new 
rand random(12);
        switch(
rand)
        {
            case 
0gRocketObj[playerid] = CreateObject(18647xyz00r);
            case 
1gRocketObj[playerid] = CreateObject(18648xyz00r);
            case 
2gRocketObj[playerid] = CreateObject(18649xyz00r);
            case 
3gRocketObj[playerid] = CreateObject(18650xyz00r);
            case 
4gRocketObj[playerid] = CreateObject(18651xyz00r);
            case 
5gRocketObj[playerid] = CreateObject(18652xyz00r);
            case 
6gRocketObj[playerid] = CreateObject(18647xyz00r+90);
            case 
7gRocketObj[playerid] = CreateObject(18648xyz00r+90);
            case 
8gRocketObj[playerid] = CreateObject(18649xyz00r+90);
            case 
9gRocketObj[playerid] = CreateObject(18650xyz00r+90);
            case 
10gRocketObj[playerid] = CreateObject(18651xyz00r+90);
            case 
11gRocketObj[playerid] = CreateObject(18652xyz00r+90);
        }
        for(new 
i;i<MAX_PLAYERS;i++)
        {
            if(
IsPlayerConnected(i))
            if(
== playerid)continue;
            if(
IsPlayerInRangeOfPoint(i50.0xyz))
            {
                
GetPlayerPos(itmpxtmpytmpz);
                
tmpang = (90-atan2(tmpy-ytmpx-x));
                if(
tmpang 0)tmpang 360.0+tmpang;
                
tmpang 360.0 tmpang;
                if(
floatabs(tmpang-r) < 5.0)
                {
                    
dist GetPlayerDistanceFromPoint(ixyz);
                }
            }
        }
        
MoveObject(gRocketObj[playerid],+ (dist floatsin(-rdegrees)),+ (dist floatcos(-rdegrees)),z,100.0);                             // Nice and fast!
    
}
}
forward ShotFire(playerid);
public 
ShotFire(playerid)
{
        
FireShot[playerid] = 0;
        return 
1;
}
public 
OnObjectMoved(objectid)
{
        for(new 
i;i<MAX_PLAYERS;i++)
        {
                if(
objectid == gRocketObj[i])
                {
                    new
                        
Float:x,
                         
Float:y,
                          
Float:z;
                    
GetObjectPos(gRocketObj[i], xyz);
                    
CreateExplosion(xyz113.0);
                    
DestroyObject(gRocketObj[i]);
                }
        }

Reply


Messages In This Thread
RC Tiger isn't shooting rockets - by VanillaRain - 07.08.2015, 12:12
Re: RC Tiger isn't shooting rockets - by Logofero - 07.08.2015, 12:42
Re: RC Tiger isn't shooting rockets - by VanillaRain - 07.08.2015, 12:51
Re: RC Tiger isn't shooting rockets - by Logofero - 07.08.2015, 12:56
Re: RC Tiger isn't shooting rockets - by Logofero - 07.08.2015, 13:01
Re: RC Tiger isn't shooting rockets - by VanillaRain - 07.08.2015, 13:08
Re: RC Tiger isn't shooting rockets - by Logofero - 07.08.2015, 13:18
Re: RC Tiger isn't shooting rockets - by VanillaRain - 07.08.2015, 13:20
Re: RC Tiger isn't shooting rockets - by MarvinPWN - 07.08.2015, 13:22
Re: RC Tiger isn't shooting rockets - by Logofero - 07.08.2015, 13:23

Forum Jump:


Users browsing this thread: 1 Guest(s)