AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Stop_user_hp (https://forums.alliedmods.net/showthread.php?t=128811)

SaM.ThE.MaN 06-05-2010 17:05

Stop_user_hp
 
Fixed

Sylwester 06-05-2010 18:12

Re: Stop_user_hp
 
That's because you registered Health event (this event is called whenever player health changes) and you set player max health there. Instead of that you should register post spawn (you can use hamsandwich) and set it there.

Your way of setting player max health based on level is a total failure. You needed 500 lines of code while you could achieve the same effect using 2 lines:
PHP Code:

public Health(id)
    
set_user_health(id100 PlayerLevel[id]) 


SaM.ThE.MaN 06-06-2010 04:30

Re: Stop_user_hp
 
oh, thanx ...
Actually what i did was
PHP Code:

public Health(id)
    
set_user_health(id100 PlayerLevel

I forgot to add id after player :D .. so it kept sayin array must be indexed, therefore i did it the other way ,
anyways back to the topic:
Quote:

you should register post spawn (you can use hamsandwich) and set it there.
can you show me how i am supposed to do that

GXLZPGX 06-06-2010 04:43

Re: Stop_user_hp
 
Quote:

Originally Posted by SaM.ThE.MaN (Post 1201076)
oh, thanx ...
Actually what i did was
PHP Code:

public Health(id)
    
set_user_health(id100 PlayerLevel

I forgot to add id after player :D .. so it kept sayin array must be indexed, therefore i did it the other way ,
anyways back to the topic:


can you show me how i am supposed to do that

Add #include <hamsandwich>

Then:

PHP Code:

register_event("Health""Health""be"); 

:arrow:
PHP Code:

RegisterHam(Ham_Spawn"player""Health"1

And:

PHP Code:

public Health(id)
{
set_user_health(id100 PlayerLevel[id])  


:arrow:
PHP Code:

public Health(id)
{
    if(
is_user_alive(id))
    {
        
set_user_health(id100 PlayerLevel[id]) 
    } 



SaM.ThE.MaN 06-06-2010 05:16

Re: Stop_user_hp
 
oh thanx alot m8 ,
well am not so familiar with ham sandwich , but now i get think i get what it does

fysiks 06-06-2010 17:12

Re: Stop_user_hp
 
Everybody trying to script AMX Mod X plugins should have read this tutorial before asking questions.

GXLZPGX 06-06-2010 17:18

Re: Stop_user_hp
 
Quote:

Originally Posted by fysiks (Post 1201729)
Everybody trying to script AMX Mod X plugins should have read this tutorial before asking questions.

Truth be told


All times are GMT -4. The time now is 05:27.

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