Raised This Month: $ Target: $400
 0% 

[ H3LP ] Laser sight mistake?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-30-2017 , 16:19   [ H3LP ] Laser sight mistake?
Reply With Quote #1

Hello, I've done a laser sight, it's working but with some problems. As the item_PostFrame is called many times per second, they are appearing 4 lasers instead of just one. Any suggestions?

Code:
public fw_Item_PostFrame(entity) {     if (!is_valid_ent(entity))         return HAM_IGNORED;     static id     id = get_pdata_cbase(entity, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS)     if (!is_user_alive(id))         return HAM_IGNORED;     if (!GetPlayerBit(g_has_plasma_caster, id))         return HAM_IGNORED;     static Float:victim_origin[3], victim     victim = get_aim_ent(id, victim_origin)     static Float:origin[3]     GetGunPosition(id, 3.0, -9.0, 0.0, origin)     static end[3]     if (victim)         FVecIVec(victim_origin, end)     else         get_user_origin(id, end, 3)     message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)     write_byte(TE_BEAMPOINTS)     write_coord(floatround(origin[0]))     write_coord(floatround(origin[1]))     write_coord(floatround(origin[2]))     write_coord(end[0])     write_coord(end[1])     write_coord(end[2])     write_short(sprite_laser)     write_byte(0)     write_byte(10)     write_byte(1)     write_byte(5)     write_byte(0)     write_byte(200)     write_byte(0)     write_byte(0)     write_byte(200)     write_byte(10)     message_end()     return HAM_IGNORED; }
__________________









Last edited by CrazY.; 07-30-2017 at 16:48.
CrazY. is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 07-31-2017 , 05:56   Re: [ H3LP ] Laser sight mistake?
Reply With Quote #2

You can make a timestamps to how long do you another laser will be created

PHP Code:
new Float:g_Timestamps[33]

public 
fw_Item_PostFrame(entity)
{
    if (!
is_valid_ent(entity))
        return 
HAM_IGNORED;

    static 
id 
    id 
get_pdata_cbase(entityOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS)

    if(
g_Teamstamps[id] + 1.0 get_gametime()) //1 second
        
return HAM_IGNORED

    g_Timestamps
[id] = get_gametime()

__________________
My plugin:

Last edited by Celena Luna; 07-31-2017 at 05:57.
Celena Luna is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-31-2017 , 09:30   Re: [ H3LP ] Laser sight mistake?
Reply With Quote #3

And also change the beam point life time to 10 is 1 sec.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-31-2017 at 09:30.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 08-11-2017 , 11:25   Re: [ H3LP ] Laser sight mistake?
Reply With Quote #4

Quote:
Originally Posted by Celena Luna View Post
You can make a timestamps to how long do you another laser will be created

PHP Code:
new Float:g_Timestamps[33]

public 
fw_Item_PostFrame(entity)
{
    if (!
is_valid_ent(entity))
        return 
HAM_IGNORED;

    static 
id 
    id 
get_pdata_cbase(entityOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS)

    if(
g_Teamstamps[id] + 1.0 get_gametime()) //1 second
        
return HAM_IGNORED

    g_Timestamps
[id] = get_gametime()

Quote:
Originally Posted by Natsheh View Post
And also change the beam point life time to 10 is 1 sec.
You need combine 2 reply not only 1
__________________
My plugin:
Celena Luna is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-02-2017 , 18:31   Re: [ H3LP ] Laser sight mistake?
Reply With Quote #5

I tried to modify your code, but it's not working. My theory of what's going on:

Code:
new Float:g_Timestamps[33] = 0.0

Code:
if (g_Teamstamps[id] + 1.0 (0.0 + 1.0  = 1.0) < get_gametime() (suppose to be 2.0 or any other value greater than 1.0.)

Code:
Then, do nothing...
__________________









Last edited by CrazY.; 08-02-2017 at 18:32.
CrazY. 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 23:09.


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