AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Speedmeter +AmmoPacks (https://forums.alliedmods.net/showthread.php?t=347442)

Hn.S Xmix 04-25-2024 20:32

Speedmeter +AmmoPacks
 
1 Attachment(s)
Hello

i tried my best to edit a plugin speedmeter for players get only 1 ammopacks every time they reach 1800 speed. But the problem is if the players stay at +1800 speed for too long they will get a lot of Aps as you can see in Screan Shot

Request: Is it possible to make a players get 1 ammo packs everytime they hit 1800 speed?


https://i.ibb.co/0t1yhqb/discord-pro...lfj1j46kte.jpg

bigdaddy424 04-25-2024 21:49

Re: Speedmeter +AmmoPacks
 
keeping this logic the player will get 1 ammo pack every FREQ seconds, in this case thats 0.1 or 10 ammo packs per second
you have 2 options. either give player 1 ammo pack every few seconds if they keep a constant speed of 1800+ or give player 1 ammo pack once they reach 1800 and in order to get another one, speed has to drop down around 1100 so its safe to assume that theyre not abusing or benefiting from the small lump where hitting 1799 and 1800 again will get you another ammo pack...

Hn.S Xmix 04-26-2024 07:31

Re: Speedmeter +AmmoPacks
 
Quote:

Originally Posted by bigdaddy424 (Post 2821626)
keeping this logic the player will get 1 ammo pack every FREQ seconds, in this case thats 0.1 or 10 ammo packs per second
you have 2 options. either give player 1 ammo pack every few seconds if they keep a constant speed of 1800+ or give player 1 ammo pack once they reach 1800 and in order to get another one, speed has to drop down around 1100 so its safe to assume that theyre not abusing or benefiting from the small lump where hitting 1799 and 1800 again will get you another ammo pack...

Thank you. those ideas are good but..

i did this actually before and it work but sometimes the player will not get any aps bcs if they strafe with +500 fps the speed will increase and jump EX: from 1795 to 1810 in 0.1 second so he will not get any aps + there is another problem some maps got ramp pucher that puch you with +1900 speed so there is no chance getting AmmoPacks

PHP Code:

SpeedTask(id)
{
    static 
get
        
new name[32]
    
get_user_name(idname31)
    static 
itarget
    
static Float:velocity[3]
    static 
Float:speedFloat:speedh
    
    
for(i=1i<=maxplayersi++)
    {
        if(!
is_user_connected(i)) continue
        if(!
plrSpeed[i]) continue
        
        
target pev(ipev_iuser1) == pev(ipev_iuser2) : i
        pev
(targetpev_velocityvelocity)

        
speed vector_length(velocity)
        
speedh floatsqroot(floatpower(velocity[0], 2.0) + floatpower(velocity[1], 2.0))
        
        static 
rgb
        
if(speedh >= 1805)
        {
            
255
            g 
20
            b 
20
        set_hudmessage
(rgb, -1.00.700.0FREQ0.010.0)
        
ShowSyncHudMsg(iSyncHud"%3.2f units/second^n%3.2f velocity^n^nWow! You Hit 1800 Speed!!!!"speedspeedh)
        
        }
        else if(
speedh >= 1800)
        {
            
255
            g 
20
            b 
20
        zp_set_user_ammo_packs
(izp_get_user_ammo_packs(i) + get_pcvar_num(zp_ammo_packs_get))
        
ColorChat(iTEAM_COLOR"^4[ZP] ^1You Got^3 %i ^4Ammo Packs"get_pcvar_num(zp_ammo_packs_get))
        
set_hudmessage(rgb, -1.00.700.0FREQ0.010.0)
        
ShowSyncHudMsg(iSyncHud"%3.2f units/second^n%3.2f velocity^n^nWow! You Hit 1800 Speed!!!!"speedspeedh)

        }
        else if(
speedh >= 1000)
        {
            
255
            g 
215
            b 
0
        set_hudmessage
(rgb, -1.00.700.0FREQ0.010.0)
        
ShowSyncHudMsg(iSyncHud"%3.2f units/second^n%3.2f velocity^n^nYou Hit 1000 Speed"speedspeedh)
        }
        else if(
speedh >= 500)
        {
            
20
            g 
255
            b 
20
        set_hudmessage
(rgb, -1.00.700.0FREQ0.010.0)
        
ShowSyncHudMsg(iSyncHud"%3.2f units/second^n%3.2f velocity^n^nYou Hit 500 Speed"speedspeedh)
        }
        else
        {
            
255
            g 
255
            b 
255
        set_hudmessage
(rgb, -1.00.700.0FREQ0.010.0)
        
ShowSyncHudMsg(iSyncHud"%3.2f units/second^n%3.2f velocity"speedspeedh)
        }
    }


i have question, is it possible to make ammopacks duration? i mean if the player hit +1800 speed he will get 1 aps every 10 seconds

Ace67 04-26-2024 20:59

Re: Speedmeter +AmmoPacks
 
Quote:

Originally Posted by Hn.S Xmix (Post 2821645)

i have question, is it possible to make ammopacks duration? i mean if the player hit +1800 speed he will get 1 aps every 10 seconds

I checked it and tested it on my friends server. It should work normally

PHP Code:

SpeedTask(id)
{
    static 
get
    
new name[32]
    
get_user_name(idname31)
    static 
itarget
    
static Float:velocity[3]
    static 
Float:speedFloat:speedh
    
static Float:lastSpeedCheck[33]
    static 
Float:lastAmmoPackTime[33]
    static 
Float:cooldownTime 10.0
    
    
for(i=1i<=maxplayersi++)
    {
        if(!
is_user_connected(i)) continue
        if(!
plrSpeed[i]) continue
        
        
target pev(ipev_iuser1) == pev(ipev_iuser2) : i
        pev
(targetpev_velocityvelocity)

        
speed vector_length(velocity)
        
speedh floatsqroot(floatpower(velocity[0], 2.0) + floatpower(velocity[1], 2.0))
        
        static 
rgb
        
if(speedh >= 1800 && lastSpeedCheck[i] < 1800)
        {
            
lastSpeedCheck[i] = speedh
            Float currentTime 
get_gametime()
            if(
currentTime lastAmmoPackTime[i] >= cooldownTime)
            {
                
lastAmmoPackTime[i] = currentTime
                zp_set_user_ammo_packs
(izp_get_user_ammo_packs(i) + 1
                
ColorChat(iTEAM_COLOR"^4[ZP] ^1You Got^3 1 ^4Ammo Pack")
            }
        }
        
        if(
speedh 1800 && lastSpeedCheck[i] >= 1800)
        {
            
lastSpeedCheck[i] = speedh
        
}
        
        
// SPEED
        
if(speedh >= 1800)
        {
            
255
            g 
20
            b 
20
            set_hudmessage
(rgb, -1.00.700.0FREQ0.010.0)
            
ShowSyncHudMsg(iSyncHud"%3.2f units/second^n%3.2f velocity^n^nWow! You Hit 1800 Speed!!!!"speedspeedh)
        }
        else if(
speedh >= 1000)
        {
            
255
            g 
215
            b 
0
            set_hudmessage
(rgb, -1.00.700.0FREQ0.010.0)
            
ShowSyncHudMsg(iSyncHud"%3.2f units/second^n%3.2f velocity^n^nYou Hit 1000 Speed"speedspeedh)
        }
        else if(
speedh >= 500)
        {
            
20
            g 
255
            b 
20
            set_hudmessage
(rgb, -1.00.700.0FREQ0.010.0)
            
ShowSyncHudMsg(iSyncHud"%3.2f units/second^n%3.2f velocity^n^nYou Hit 500 Speed"speedspeedh)
        }
        else
        {
            
255
            g 
255
            b 
255
            set_hudmessage
(rgb, -1.00.700.0FREQ0.010.0)
            
ShowSyncHudMsg(iSyncHud"%3.2f units/second^n%3.2f velocity"speedspeedh)
        }
    }



Hn.S Xmix 04-27-2024 08:03

Re: Speedmeter +AmmoPacks
 
It work so good i wasn't expecting to see so much changes you are absolutely genius, im trying so hard to be like you. by the way..

i got this error
Quote:

Error: Undefined symbol "Float" on line 104
Error: Undefined symbol "currentTime" on line 105
Error: Undefined symbol "currentTime" on line 107

3 Errors.
Could not locate output file C:\Users\BST\Desktop\plugin\zp_addons_speedom eter.amx (compile failed).
so i kinda fix it and it work perfectly. i have change this
----->

PHP Code:

Float currentTime get_gametime() 

to this
----->

PHP Code:

static Float:currentTime
currentTime 
get_gametime() 


Ace67 04-27-2024 17:25

Re: Speedmeter +AmmoPacks
 
Quote:

Originally Posted by Hn.S Xmix (Post 2821687)
It work so good i wasn't expecting to see so much changes you are absolutely genius, im trying so hard to be like you. by the way..

i got this error


so i kinda fix it and it work perfectly. i have change this
----->

PHP Code:

Float currentTime get_gametime() 

to this
----->

PHP Code:

static Float:currentTime
currentTime 
get_gametime() 


Strange, there were no errors in my friends servers console. Enjoy buddy if you need help feel free to PM me.


All times are GMT -4. The time now is 01:25.

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