Need a little help
#1

Код:
#include < a_samp >
#include < a_npc >

#define MAX_MINIGUNS 5
#undef MAX_PLAYERS
#define MAX_PLAYERS 100
new
        mgun[ MAX_MINIGUNS ]
        ,minigunnum = 0
        ,vehhasminigun[ MAX_VEHICLES ]
        ,laser[ MAX_PLAYERS ]
;

#define PUB:%1(%2) forward %1(%2); public %1(%2)

GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
        new Float:a;
        GetPlayerPos(playerid, x, y, a);
        GetPlayerFacingAngle(playerid, a);
        if (GetPlayerVehicleID(playerid))
        {
            GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
        }
        x += (distance * floatsin(-a, degrees));
        y += (distance * floatcos(-a, degrees));
}

public OnFilterScriptInit( ) {
        for( new i = 0; i < MAX_VEHICLES; ++i )
            vehhasminigun[ i ] = 0;
        SetTimer( "check", 5000, 1 );
        SetTimer( "loop", 500, 1 );
        print( "Miniguns on tanks by Mean loaded." );
        return 1;
}

PUB:check( ) {
        for( new i = 0; i < MAX_VEHICLES; ++i ) {
                new model = GetVehicleModel( i );
                if( model == 411 ) {
                    if( vehhasminigun[ i ] == 0 ) {
                        vehhasminigun[ i ] = 1;
                        mgun[ minigunnum ] = CreateObject( 2985, 0, 0, 0, 0, 0, 0 );
                        AttachObjectToVehicle( mgun[ minigunnum ], i, -0.499999, -1.864998, -0.609999, 0.000000, 0.000000, -90.0); //Object Model: 2985 |
                        minigunnum ++;
                        }
                }
        }
        return 1;
}

PUB:loop( ) {
for( new i = 0; i < MAX_PLAYERS; ++i ) {
if( IsPlayerConnected( i ) ) {
new vehicleid = GetPlayerVehicleID( i );
new model = GetVehicleModel( vehicleid );
if( model == 411 ) {
new
keys
,ud
,lr;

GetPlayerKeys( i, keys, ud, lr );
if( keys & (512) ) {
laser[ i ] = CreateObject( 19084, 0.75, 3.84, 0.86, 0.00, 0.00, 92.61 );
AttachObjectToVehicle( laser[ i ], vehicleid, -0.499999, -1.864998, 0.514999, 0.000000, 0.000000, -90.0); //Object Model: 19084 |
PlayerPlaySound( i, 1135, 0.0, 0.0, 0.0 );
SetTimerEx( "destroy", 250, 0, "i", i );

new
Float:x
,Float:y
,Float:z
,Float:x2
,Float:y2
;
GetPlayerPos( i, x2, y2, z );
#pragma unused x2
#pragma unused y2
GetXYInFrontOfPlayer( i, x, y, 5.0 );
for( new u = 0; u < MAX_PLAYERS; ++u ) {
if( IsPlayerInRangeOfPoint( u, 6.0, x, y, z ) && u != i ) {
new Float:hp;
GetPlayerHealth( u, hp );
SetPlayerHealth( u, hp - 20 );
PlayerPlaySound( u, 1135, 0.0, 0.0, 0.0 );

if( hp < 1 )
CallLocalFunction( "OnPlayerDeath", "ddd", u, i, 38 );
}
}
}
}
}
}
return 1;
}

PUB:destroy( i ) {
        RemovePlayerAttachedObject( i, 0 );
        DestroyObject( laser[ i ] );
        return 1;
}

public OnPlayerDeath( playerid, killerid, reason ) {
        // Paste your OnPlayerDeath here!
        return 1;
}
this makes the mini-guns fire the ones in front of the infernus i want the opposite to make it fire the ones behind the infernus
that's all
Reply


Messages In This Thread
Need a little help - by Opah - 27.05.2012, 02:35
Re: Need a little help - by Aira - 27.05.2012, 06:58
Re: Need a little help - by MP2 - 27.05.2012, 08:57
Re: Need a little help - by Opah - 27.05.2012, 12:16
Re: Need a little help - by Luis- - 27.05.2012, 16:56
Re: Need a little help - by Gangs_Rocks - 27.05.2012, 17:31
Re: Need a little help - by Opah - 27.05.2012, 20:26
Re: Need a little help - by Opah - 30.05.2012, 20:19

Forum Jump:


Users browsing this thread: 5 Guest(s)