AlliedModders

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

elpouletorange 10-21-2007 10:30

Help start round...
 
How can i give health at start of round to someone??

ConnorMcLeod 10-21-2007 10:47

Re: Help start round...
 
First make sure you well understand this tut : http://forums.alliedmods.net/showthread.php?t=42159

Use ResetHud event to give player HP.
Then it will depend on whitch module you wish to use.
Most simple to use is get / set_user_health

elpouletorange 10-21-2007 11:02

Re: Help start round...
 
So if a do:
PHP Code:

public event_player_spawn(id
{
    
set_user_health(idskill_strenght 5)
    
set_user_armor............
    ........................


at spawning the player get 101hp ??

or i should do:
PHP Code:

#define MAX_PLAYERS 32
new bool:g_restart_attempt[MAX_PLAYERS 1]
 
public 
plugin_init() {
    
register_event("ResetHUD""event_hud_reset""be")
    
register_clcmd("fullupdate""clcmd_fullupdate"
    
register_event("TextMsg""event_restart_attempt""a""2=#Game_will_restart_in")
}
 
public 
clcmd_fullupdate() {
    return 
PLUGIN_HANDLED_MAIN
}
 
public 
event_restart_attempt() {
    new 
players[32], num
    get_players
(playersnum"a")
    for (new 
inum; ++i)
        
g_restart_attempt[players[i]] = true
}
 
public 
event_hud_reset(id) {
    if (
g_restart_attempt[id]) {
        
g_restart_attempt[id] = false
        
return
    }
    
event_player_spawn(id)
}
 
// this function is called on player spawn
public event_player_spawn(id) {
    
set_user_health(idskill_strenght 5)
    
set_user_armor(idskill_defence 10)
    
set_user_gravity(id800 skill_dexterity 50)
    
set_user_maxspeed(id100 skill_agility 5)


and do this is correct ?
PHP Code:

skill_strenght(id) = skill_strenght(id) + 


M249-M4A1 10-21-2007 14:09

Re: Help start round...
 
I'd assume its:

PHP Code:

set_user_health(idget_user_health(id) + (skill_strengt 5)) 

I take that you want to add skill_strength * 5 to the existing health. Otherwise, what you have right now is replacing the user's health with skill_blahblah * 5

elpouletorange 10-21-2007 19:21

Re: Help start round...
 
skill_strenght dont need (id) ? Because its not a global.. it can be 0 for one and 49 for anorther ??

YamiKaitou 10-21-2007 20:17

Re: Help start round...
 
Quote:

Originally Posted by elpouletorange (Post 544700)
and do this is correct ?
PHP Code:

skill_strenght(id) = skill_strenght(id) + 



No. First, you have to define it as being an array. So, you would have to define it like this.
PHP Code:

new skill_strenght[33]; 

Then, you would rewrite that line like this
PHP Code:

skill_strenght[id]++; 

OR
PHP Code:

skill_strenght[id] = skill_strenght[id] + 1



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

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