AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help] SPRITE laser (https://forums.alliedmods.net/showthread.php?t=107082)

spirit 10-22-2009 14:08

[help] SPRITE laser
 
Hello i need help for create a plugin for a sprite laser when a Counter Terroriste shooting the sprite appears (as in Mod Super Hero BASS but when i shooting)

I don't know the rest of the plugin Can you help me for make to appears the laser (simulate shooting laser as the film star Wars)

Exolent[jNr] 10-22-2009 14:30

Re: [help] SPRITE laser
 
All you need to know is:
- How to detect shot event
- How to make a beam from gun point to aim point

You can find that out by searching this website.

Hawk552 10-22-2009 15:10

Re: [help] SPRITE laser
 
  • Detecting shot fired:
PHP Code:

#include <amxmodx>
#include <engine>
#include <hamsandwich>

new gWeapons[] = 
{
    -
1,
    
CSW_P228,
    -
1,
    
CSW_SCOUT,
    
/*CSW_HEGRENADE*/ -1,
    
CSW_XM1014,
    
/*CSW_C4*/ -1,
    
CSW_MAC10,
    
CSW_AUG,
    
/*CSW_SMOKEGRENADE*/ -1,
    
CSW_ELITE,
    
CSW_FIVESEVEN,
    
CSW_UMP45,
    
CSW_SG550,
    
CSW_GALIL,
    
CSW_FAMAS,
    
CSW_USP,
    
CSW_GLOCK18,
    
CSW_AWP,
    
CSW_MP5NAVY,
    
CSW_M249,
    
CSW_M3,
    
CSW_M4A1,
    
CSW_TMP,
    
CSW_G3SG1,
    
/*CSW_FLASHBANG*/ -1,
    
CSW_DEAGLE,
    
CSW_SG552,
    
CSW_AK47,
    
/*CSW_KNIFE*/ -1,
    
CSW_P90,
    
/*CSW_VEST*/ -1,
    
/*CSW_VESTHELM*/ -1,
}

public 
plugin_init()
{
    
register_plugin"Detect Shot Fired""1.0""Hawk552" )

    for ( new 
iweaponName[32]; sizeof gWeaponsi++ )
    {
        if ( 
gWeapons[i] == -)
            continue

        
get_weaponnamegWeapons[i], weaponNamecharsmaxweaponName ) )

        
RegisterHamHam_Weapon_PrimaryAttackweaponName"HamWeaponPrimaryAttack" )
    }
}

public 
HamWeaponPrimaryAttackweapon )
{
    new 
id entity_get_edictweaponEV_ENT_owner )
    
// your code...

    // block the original shot
    
return HAM_SUPERCEDE

    
// or let it through
    
return HAM_IGNORED


  • Laser:
PHP Code:

#include <amxmodx>
#include <engine>
#include <hamsandwich>

const gSpeedMul 100

new gSpriteId
new gSpriteModel[] = "sprites/bullshit.spr"

public plugin_init()
{
    
register_plugin"Laser""1.0""Hawk552" )

    
// Hook from previous plugin.
}

public 
plugin_precache()
    
gSpriteId precache_modelgSpriteModel )

//#define TE_PROJECTILE               119      // Makes a projectile (like a nail) (this is a high-priority tent)
// write_byte(TE_PROJECTILE)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(velocity.x)
// write_coord(velocity.y)
// write_coord(velocity.z)
// write_short(modelindex)
// write_byte(life)
// write_byte(owner)  projectile won't collide with owner (if owner == 0, projectile will hit any client).

// Assumed to be called by something else.
public ShotFiredid )
{
    new 
origin[3], Float:lookNormal[3], velocity[3]

    
get_user_originidorigin)

    
velocity_by_aimidgSpeedMullookNormal )
    
FVecIVeclookNormalvelocity )

    
message_beginMSG_PVSSVC_TEMPENTITYorigin )
    
write_byteTE_PROJECTILE )
    
write_coordorigin[0] )
    
write_coordorigin[1] )
    
write_coordorigin[2] )
    
write_coordvelocity[0] )
    
write_coordvelocity[1] )
    
write_coordvelocity[2] )
    
write_shortgSpriteId )
    
write_byte100 // might have to adjust this
    
write_byteid )
    
message_end()


  • Combining them:
PHP Code:

#include <amxmodx>
#include <engine>
#include <hamsandwich>

const gSpeedMul 100

new gSpriteId
new gSpriteModel[] = "sprites/bullshit.spr"

new gWeapons[] = 
{
    -
1,
    
CSW_P228,
    -
1,
    
CSW_SCOUT,
    
/*CSW_HEGRENADE*/ -1,
    
CSW_XM1014,
    
/*CSW_C4*/ -1,
    
CSW_MAC10,
    
CSW_AUG,
    
/*CSW_SMOKEGRENADE*/ -1,
    
CSW_ELITE,
    
CSW_FIVESEVEN,
    
CSW_UMP45,
    
CSW_SG550,
    
CSW_GALIL,
    
CSW_FAMAS,
    
CSW_USP,
    
CSW_GLOCK18,
    
CSW_AWP,
    
CSW_MP5NAVY,
    
CSW_M249,
    
CSW_M3,
    
CSW_M4A1,
    
CSW_TMP,
    
CSW_G3SG1,
    
/*CSW_FLASHBANG*/ -1,
    
CSW_DEAGLE,
    
CSW_SG552,
    
CSW_AK47,
    
/*CSW_KNIFE*/ -1,
    
CSW_P90,
    
/*CSW_VEST*/ -1,
    
/*CSW_VESTHELM*/ -1,
}

public 
plugin_init()
{
    
register_plugin"Laser Weapon Replacement""1.0""Hawk552" )

    for ( new 
iweaponName[32]; sizeof gWeaponsi++ )
    {
        if ( 
gWeapons[i] == -)
            continue

        
get_weaponnamegWeapons[i], weaponNamecharsmaxweaponName ) )

        
RegisterHamHam_Weapon_PrimaryAttackweaponName"HamWeaponPrimaryAttack" )
    }
}

public 
plugin_precache()
    
gSpriteId precache_modelgSpriteModel )

public 
HamWeaponPrimaryAttackweapon )
{
    new 
id entity_get_edictweaponEV_ENT_owner ), origin[3], Float:lookNormal[3], velocity[3]

    
get_user_originidorigin)

    
velocity_by_aimidgSpeedMullookNormal )
    
FVecIVeclookNormalvelocity )

    
message_beginMSG_PVSSVC_TEMPENTITYorigin )
    
write_byteTE_PROJECTILE )
    
write_coordorigin[0] )
    
write_coordorigin[1] )
    
write_coordorigin[2] )
    
write_coordvelocity[0] )
    
write_coordvelocity[1] )
    
write_coordvelocity[2] )
    
write_shortgSpriteId )
    
write_byte100 // might have to adjust this
    
write_byteid )
    
message_end()

    
// block the original shot
    
return HAM_SUPERCEDE


All of this is untested. I only tried compiling the final plugin. You'll need plenty more checks, handles and changes but this should get you started.

spirit 10-22-2009 15:45

Re: [help] SPRITE laser
 
sorry but i haven't sprite bullshit.spr can you add me this sprite please

KadiR 10-22-2009 16:08

Re: [help] SPRITE laser
 
put in there a spritename which you want :wink:

uxMal 10-22-2009 16:09

Re: [help] SPRITE laser
 
Quote:

Originally Posted by spirit (Post 969382)
sorry but i haven't sprite bullshit.spr can you add me this sprite please

I lol'd.


Thats just a placeholder, you need to find a adequate sprite by yourself.

spirit 10-22-2009 16:26

Re: [help] SPRITE laser
 
can i use laserbeam ?

Hawk552 10-22-2009 17:57

Re: [help] SPRITE laser
 
Quote:

Originally Posted by spirit (Post 969382)
sorry but i haven't sprite bullshit.spr can you add me this sprite please

LMFAO I actually burst out laughing

RICHIERICH 10-23-2009 10:16

Re: [help] SPRITE laser
 
any body having laser gun and its sprite,than send me !!!

spirit 10-23-2009 13:05

Re: [help] SPRITE laser
 
Hawk Can i use laserbeam for the sprite or no ?


All times are GMT -4. The time now is 17:45.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.