Raised This Month: $51 Target: $400
 12% 

Laser Mod v1.7


Post New Thread Reply   
 
Thread Tools Display Modes
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-22-2016 , 17:38   Re: Laser Mod v1.2
Reply With Quote #11

Ok, i checked a little, i will tell you from UP to down the changes,

First, all of these:
PHP Code:
#define PLUGIN "Laser"
#define VERSION "1.0"
#define AUTHOR "Alliedmodders/EFFx"

#define TASK_CHECK             200020
#define TASK_KILLME             200021
#define TASK_COUNTDOWN             200022
#define TASK_COUNTDOWNINVIS         200023
#define TASK_SHOWLMS             200024

#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

#define m_pPlayer             41
#define OFFSET_LINUX_WEAPONS        4
#define m_pActiveItem            373
#define OFFSET_CLIPAMMO            51


#define INVALID_WEAPONS         ((1<<CSW_KNIFE)|(1<<CSW_HEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_C4))
#define szPrefix             "!g[LaserMod]!y:"
#define SPRITE_LASER             "sprites/lgtning.spr" 
Could be 'constants'.


About that one:
PHP Code:
new nVault 
Give a proper name, like NvaultFileId or something like that , not 'nvault'

About that one:
PHP Code:
new bool:isFalling33 
I see in all your variable declaration you are arrange the vars like that " [33] " now why are you doing like that: " [ 33 ] " here ? keep always the same style.


In all your natives publics, remove this:
PHP Code:
    if(!is_user_connected(id))
        return 

IMO, this should be handled by coders wich using your natives not by yourself in the native.

I see somewhere you use set_user_gravity()

You could use this stock and give directly the gravity you want, example '750' or '800' ( you can easily make also a cvar with this ):
PHP Code:
SetGravityid iGravity 

    static 
GravityPointer
    GravityPointer 
get_cvar_pointer"sv_gravity" )

    if( 
is_user_aliveid ) && iGravity )  
    { 
        
set_user_gravityidfloatiGravity ) / floatget_pcvar_numGravityPointer ) ) )
    } 



About these fucking functions:
PHP Code:
SaveLmsid 

    new 
szAuthid32 
    
get_user_authididszAuthidcmxszAuthid ) ) 
    
    new 
szVaultKey128 ], szVaultData512 
    
    
formatexszVaultKey127"Laser_%s"szAuthid 
    
formatexszVaultData511"%d"get_user_lm(id)) 
    
nvault_setnVaultszVaultKeyszVaultData 


LoadLmsid 

    new 
szAuthid32 
    
get_user_authididszAuthidcmxszAuthid ) ) 

    new 
szVaultKey128 ], szVaultData512 

    
formatexszVaultKey127"Laser_%s"szAuthid 
    
formatexszVaultData511"%d"get_user_lm(id)) 

    
nvault_getnVaultszVaultKeyszVaultData511 

    new 
lm[32]

    
parseszVaultDatalm31

    
set_user_lm(id0str_to_numlm ) )

They should look like that:
PHP Code:

SaveLms
id 

    new 
szAuthid32 
    
get_user_authididszAuthidcmxszAuthid ) ) 
    
    new 
szData[11];
    
num_to_strget_user_lm(id) , szDatacmxszData ) )

    
nvault_setnVaultszAuthIdszData 


LoadLmsid 

    new 
szAuthid32 
    
get_user_authididszAuthidcmxszAuthid ) ) 

    
set_user_lm(id0nvault_getnVaultszAuthId ) )


About plugin_end: You should arrange it more close to plugin_init( ) as done with plugin_precache, etc ...


Also i seee lot of stocks at the middle of the plugin, just arrange all the stocks at the end of the plugin

And remove 'stock' from them, just put directly the function

So insteand of:

stock MyStock()
{

}

They should be:

MyStock()
{

}
__________________
Project: Among Us

Last edited by Craxor; 12-22-2016 at 17:40.
Craxor is offline
Send a message via ICQ to Craxor
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 12-22-2016 , 19:32   Re: Laser Mod v1.2
Reply With Quote #12

1.

These defines

PHP Code:
#define PLUGIN "Laser"
#define VERSION "1.0"
#define AUTHOR "Alliedmodders/EFFx"

#define TASK_CHECK             200020
#define TASK_KILLME             200021
#define TASK_COUNTDOWN             200022
#define TASK_COUNTDOWNINVIS         200023
#define TASK_SHOWLMS             200024

#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

#define INVALID_WEAPONS         ((1<<CSW_KNIFE)|(1<<CSW_HEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_C4))
#define SPRITE_LASER             "sprites/lgtning.spr" 
I don't changed they because I think its not necessary.

2.

I renamed him

3.

I made this code from other plugin, and I added on the principal plugin ( Laser_Mod ).

4.

I added is_user_connected() because if someone want add a set_task for give/take Laser Money from other player, it will block a debug.

5.

I think I need not this stock.

6.

Done

7.

Done

8.

I don't find it on my code...



If you have more for say, please, continue with that. I appreciate.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-23-2016 , 05:08   Re: Laser Mod v1.2
Reply With Quote #13

8.

I mean these stocks
:
PHP Code:
stock laser_messagecolor(const id, const input[], any:...) 
{
    new 
count 1players32 ]
    static 
msg191 ]
    
vformatmsg190input)
    
    
replace_allmsg190"!g""^4" )
    
replace_allmsg190"!y""^1" )
    
replace_allmsg190"!t""^3" )
    
    if(
idplayers] = id; else get_playersplayerscount"ch" )
    {
        for(new 
0counti++)
        {
            if( 
is_user_connectedplayers] ) )
            {
                
message_beginMSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players] )  
                
write_byteplayers] )
                
write_stringmsg )
                
message_end( )
            }
        }
    }
}

stock IsUserValid(const index)
    return (
is_user_connected(index) && is_user_alive(index) ? true false)
    
stock HasFlags(const index)
    return (
get_user_flags(index) & ACCESS) ? true false 
Just remove 'stock' and leave them like SaveMl and Load without 'stock'.

Also this one:
PHP Code:
stock FreezePlayer(id,const LaserName[],const VictimName[])
{
    if(
HasFlags(UsandoLaser))
        
set_user_lm(UsandoLaser020)
    
    else
        
set_user_lm(UsandoLaser05)
                    
    
laser_messagecolor(0,"%s The player!t %s!y freezed the !t%s!y.",szPrefix,LaserName,VictimName)
    
laser_messagecolor(0,"%s Help him or he will die in %d secon%s.",szPrefix,get_pcvar_num(iPcvarKillSeconds),get_pcvar_num(iPcvarKillSeconds) >= "ds" :"d")
    
    
set_task(30.0,"KillPlayer",id+TASK_KILLME)
                    
    
set_user_rendering(idkRenderFxGlowShell0100200kRenderNormal100)
    
set_pevidpev_flagspevidpev_flags ) | FL_FROZEN )
                    
    
renden[id] = true
    frozen
[id] = true
}
stock UnFreezePlayer(idfreezer)
{
    
renden[id] = false
    frozen
[id] = false
                    
    set_pev
idpev_flagspevidpev_flags ) & ~FL_FROZEN )
    
set_user_rendering(id)
    
remove_task(id+TASK_KILLME)
    
    if(
id != freezer)
        
play_sound(freezer,sounds_help[random(sizeof sounds_help)],PITCH_LOW)
                    
    if(
ismoved[id])
        
CanUseLaser[id] = true

They are at the middle of the plugin, leave them at the end of plugin lines with the rest of the stocks and remove 'stock' from forward.


About '4' it is not needed, the coders who use your natives should handle this by themselves, in the most of the cases they will anyway add is_user_alive wich already contain is_user_connected so you can remove them.


Now again:

1. You could declare a global variable gAuthId and take user steamid just once in client_auhorized insteand of call it two times in Load and Save. You know how to do that no?

2.
Here's not an optimization but IMO looks ugly:
PHP Code:
    get_mapname(iMapPrefix,charsmax(iMapPrefix))
    if(
equal(iMapPrefix,"de_"))
    { 
Leave one line space between get_map and your else
PHP Code:
    get_mapname(iMapPrefix,charsmax(iMapPrefix))

    if(
equal(iMapPrefix,"de_"))
    { 
The same between your if { } and else

3. Your const szPrefix have 3 tabulations space, you used 2 tabulation wtih your const integers, do the same for szPrefix
Code:
new const szPrefix[]  = 			"!g[LaserMod]!y:"
Should be like this:
Code:
new const szPrefix[]  = 		"!g[LaserMod]!y:"
4. in your _set_user_lm() insteand of if else { } you could do this:
PHP Code:
Lm[id] = !type Lm[id] += ammount Lm[id] -= ammount 
(test to see if is working )

5
// You do not need this, just use is_user_alive
PHP Code:
stock IsUserValid(const index)
    return (
is_user_connected(index) && is_user_alive(index) ? true false

// And also this one should be a macro
stock HasFlags(const index)
return (get_user_flags(index) & ACCESS) ? true : false

- >
PHP Code:
#define HasFlags(%1)        (get_user_flags(%1) & ACCESS) 
Anyway you could do more but i don't fully understand your code.
__________________
Project: Among Us

Last edited by Craxor; 12-23-2016 at 05:19.
Craxor is offline
Send a message via ICQ to Craxor
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 12-23-2016 , 13:58   Re: Laser Mod v1.2
Reply With Quote #14

Some suggestions I added, but have formats that make no sense for me.

PHP Code:
Lm[id] = !type Lm[id] += ammount Lm[id] -= ammount 
This doesn't work.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 12-23-2016 at 14:02.
EFFx is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-23-2016 , 14:26   Re: Laser Mod v1.2
Reply With Quote #15

Yes, that's why i said you to test it )

However tell me where you don;t understand.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 12-23-2016 , 14:28   Re: Laser Mod v1.2
Reply With Quote #16

The '2'
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
ish12321
Veteran Member
Join Date: May 2016
Old 12-23-2016 , 16:09   Re: Laser Mod v1.2
Reply With Quote #17

Quote:
Originally Posted by EFFx View Post
The '2'
He's just trying to say to add a line after get_mapname() to beautify code
He's helping you to beautify your code
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here

Last edited by ish12321; 12-23-2016 at 16:09.
ish12321 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 12-23-2016 , 19:11   Re: Laser Mod v1.2
Reply With Quote #18

Aah, '-'
Someone can tell me about this plugin in-game?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
ish12321
Veteran Member
Join Date: May 2016
Old 12-23-2016 , 20:49   Re: Laser Mod v1.2
Reply With Quote #19

Quote:
Originally Posted by EFFx View Post
Aah, '-'
Someone can tell me about this plugin in-game?
Didn't understood you
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here
ish12321 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 12-23-2016 , 21:33   Re: Laser Mod v1.2
Reply With Quote #20

Quote:
Originally Posted by ish12321 View Post
Didn't understood you

If someone can use this plugin in a server and tell my about bugs if it have.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx 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 06:56.


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