AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ESF] Powerlevel transformation problem [SOLVED] (https://forums.alliedmods.net/showthread.php?t=283315)

Turbo ESF 05-30-2016 17:22

[ESF] Powerlevel transformation problem [SOLVED]
 
Hi, i am new to plugins and, I made a plugin consisting of:

E (Powerup)+T (Turbo) = increased power (PL)
the problem is that when I transform my ki becomes menor.
I leave the code have if someone can solve it

PHP Code:

#include <amxmodx>
#include <esf>

#define PLUGIN "ESF AumentarPL"
#define VERSION "1.0"
#define AUTHOR "Turbo"

const TASK_ID 1324

new g_powerup[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("+powerup""clcmd_powerup_start")
    
register_clcmd("-powerup""clcmd_powerup_end")
    
register_clcmd("turbo""clcmd_turbo")
}

public 
clcmd_powerup_start(id)
{
    
g_powerup[id] = 1
}

public 
clcmd_powerup_end(id)
{
    
g_powerup[id] = 0
    remove_task
(id+TASK_ID)
}


public 
clcmd_turbo(id)
{
    if(
g_powerup[id] == 1)
    {
        
g_powerup[id] = 2

        set_task
(0.1"task_powerup"id+TASK_ID, .flags="b")
    }
}
    

public 
task_powerup(id)
{
    
id -= TASK_ID
    
    setClientPL
(idgetClientPL(id) + 9995)


PL before transformation:
http://i.imgur.com/6t10iNF.png?1

PL after transformation:
http://i.imgur.com/4fuJiK4.png?1

Karibeean 05-30-2016 17:54

Re: [ESF] Powerlevel transformation problem
 
What is the ki limit?

Edit:

Try set max ki using

setClientKI

Turbo ESF 05-30-2016 19:30

Re: [ESF] Powerlevel transformation problem
 
Quote:

Originally Posted by Karibeean (Post 2423365)
What is the ki limit?

Edit:

Try set max ki using

setClientKI

I tried what he says and what happens is that KI rises but only the blue bar not the numbers.
I also tried the ACPL (Actual PowerLevel) but does not work

Karibeean 05-30-2016 20:06

Re: [ESF] Powerlevel transformation problem
 
PHP Code:

setClientPL(idgetClientPL(id) + 9995

->

PHP Code:

setClientPL(id, (getClientPL(id) + 9995)) 


EFFx 05-30-2016 21:31

Re: [ESF] Powerlevel transformation problem
 
Quote:

Originally Posted by Karibeean (Post 2423385)
PHP Code:

setClientPL(idgetClientPL(id) + 9995

->

PHP Code:

setClientPL(id, (getClientPL(id) + 9995)) 




???????

Turbo ESF 05-30-2016 21:50

Re: [ESF] Powerlevel transformation problem
 
Quote:

Originally Posted by Karibeean (Post 2423385)
PHP Code:

setClientPL(idgetClientPL(id) + 9995

->

PHP Code:

setClientPL(id, (getClientPL(id) + 9995)) 


I just compiling and does not work

wickedd 05-30-2016 22:25

Re: [ESF] Powerlevel transformation problem
 
Quote:

Originally Posted by Turbo ESF (Post 2423383)
I tried what he says and what happens is that KI rises but only the blue bar not the numbers.
I also tried the ACPL (Actual PowerLevel) but does not work

May be it's a float, so try it and see.

P.S. I don't know anything about the game, I'm only guessing.

Edit: I was talking about with setClientKI

Karibeean 05-31-2016 18:04

Re: [ESF] Powerlevel transformation problem
 
Try

PHP Code:

setClientPL(idgetClientPL(id) + 9995 

for

PHP Code:

esf_set_powerlevel(idesf_get_powerlevel(id) + 9995


Turbo ESF 05-31-2016 19:55

Re: [ESF] Powerlevel transformation problem
 
Quote:

Originally Posted by Karibeean (Post 2423619)
Try

PHP Code:

setClientPL(idgetClientPL(id) + 9995 

for

PHP Code:

esf_set_powerlevel(idesf_get_powerlevel(id) + 9995


Do not compile

siriusmd99 06-01-2016 09:20

Re: [ESF] Powerlevel transformation problem
 
I don't know your problem, try to change the limit, but I made some optimizations to your plugin.
PHP Code:

#include <amxmodx>
#include <esf>

#define PLUGIN "ESF AumentarPL"
#define VERSION "1.0"
#define AUTHOR "Turbo"

new g_clientpl[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("+powerup""clcmd_powerup_start")
    
register_clcmd("-powerup""clcmd_powerup_end")
    
register_clcmd("turbo""clcmd_turbo")
}

public 
clcmd_powerup_start(id)
    
g_clientpl[id]=0;

public 
clcmd_powerup_end(id)
    if(
task_exists(id))
         
remove_task(id)


public 
clcmd_turbo(id)
{
    if(!
g_clientpl[id])
    {
        
g_clientpl[id]= getClientPL(id);
        
set_task(0.1"task_powerup"id, .flags="b")
    }
}
    
public 
task_powerup(id){
    
g_clientpl[id]+=9995
    setClientPL
(id,  g_clientpl[id])




All times are GMT -4. The time now is 18:35.

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