Raised This Month: $ Target: $400
 0% 

[help] SPRITE laser


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
spirit
Senior Member
Join Date: Jul 2009
Location: Quimper
Old 10-22-2009 , 14:08   [help] SPRITE laser
Reply With Quote #1

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)

Last edited by spirit; 10-22-2009 at 14:51.
spirit is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-22-2009 , 14:30   Re: [help] SPRITE laser
Reply With Quote #2

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.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-22-2009 , 15:10   Re: [help] SPRITE laser
Reply With Quote #3

  • 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.
__________________

Last edited by Hawk552; 10-22-2009 at 15:17. Reason: corrected typo in my last sentence
Hawk552 is offline
Send a message via AIM to Hawk552
spirit
Senior Member
Join Date: Jul 2009
Location: Quimper
Old 10-22-2009 , 15:45   Re: [help] SPRITE laser
Reply With Quote #4

sorry but i haven't sprite bullshit.spr can you add me this sprite please
spirit is offline
uxMal
Member
Join Date: Oct 2007
Old 10-22-2009 , 16:09   Re: [help] SPRITE laser
Reply With Quote #5

Quote:
Originally Posted by spirit View Post
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.
uxMal is offline
spirit
Senior Member
Join Date: Jul 2009
Location: Quimper
Old 10-22-2009 , 16:26   Re: [help] SPRITE laser
Reply With Quote #6

can i use laserbeam ?
spirit is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-22-2009 , 17:57   Re: [help] SPRITE laser
Reply With Quote #7

Quote:
Originally Posted by spirit View Post
sorry but i haven't sprite bullshit.spr can you add me this sprite please
LMFAO I actually burst out laughing
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 10-22-2009 , 16:08   Re: [help] SPRITE laser
Reply With Quote #8

put in there a spritename which you want
KadiR is offline
RICHIERICH
BANNED
Join Date: Oct 2009
Location: RICH HOUSE
Old 10-23-2009 , 10:16   Re: [help] SPRITE laser
Reply With Quote #9

any body having laser gun and its sprite,than send me !!!
RICHIERICH is offline
spirit
Senior Member
Join Date: Jul 2009
Location: Quimper
Old 10-23-2009 , 13:05   Re: [help] SPRITE laser
Reply With Quote #10

Hawk Can i use laserbeam for the sprite or no ?
spirit is offline
Reply



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

Forum Jump


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


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