AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Doing a deathshot only once. (https://forums.alliedmods.net/showthread.php?t=221312)

vamppa 07-20-2013 13:21

Doing a deathshot only once.
 
PHP Code:

#define SCREENSHOT_PER_DEATHS random_num( 1, 35)

    
register_event("DeathMsg" "xDeathMsg" "a");

public 
xDeathMsg() 

    new 
id read_data(2
    if ( ! (++
gDeaths[id] % SCREENSHOT_PER_DEATHS) ) 
    { 
          
client_cmd(id"snapshot"
    } 


How would I do the random deathshot one time?

ConnorMcLeod 07-20-2013 13:36

Re: Doing a deathshot only once.
 
PHP Code:

#define SCREENSHOT_PER_DEATHS random_num( 1, 35)

new bool:g_bDeathScreenShotTaken[33]

public 
plugin_init()
{
    
register_event("DeathMsg" "xDeathMsg" "a");
}

public 
client_putinserver(id)
{
    
g_bDeathScreenShotTaken[id] = false
}

public 
xDeathMsg() 

    new 
id read_data(2
    if ( !
g_bDeathScreenShotTaken[id] && ! (++gDeaths[id] % SCREENSHOT_PER_DEATHS) ) 
    { 
          
client_cmd(id"snapshot"
          
g_bDeathScreenShotTaken[id] = true
    




vamppa 07-23-2013 12:14

Re: Doing a deathshot only once.
 
ta!


All times are GMT -4. The time now is 06:32.

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