AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Random Respawn Chance (https://forums.alliedmods.net/showthread.php?t=295548)

LifeStone 03-29-2017 04:16

Random Respawn Chance
 
1 Attachment(s)
Hello guys i want to make this plugin to give chance once per round and not with the time
(example: if i write /reviveme me and command used say "Try again in x seconds.")
and i want to make it to give one chance per round
and something else i want to make it to give more chance to admins
(example: admins 15% chance players 10% chance)
like this
PHP Code:

        register_cvar("spawnchance_odds","100")

        new 
ChanceAmount random(get_cvar_num("spawnchance_odds")) 

        if (
get_user_flags(id) & ADMIN_IMMUNITY
        { 
            if (
ChanceAmount <= 15
            { 
                
client_print(id,print_chat"You win! Prepare to be respawned!"
            } 
            else if (
ChanceAmount 15
            { 
                
client_print(id,print_chat"Sorry, you didn't respawn this time!"
            } 
        } 
        else 
        { 
            if (
ChanceAmount <= 10
            { 
                
client_print(id,print_chat"You win! Prepare to be respawned!"
            } 
            else if (
ChanceAmount 10
            { 
                
client_print(id,print_chat"Sorry, you didn't respawn this time!"
            } 
        } 


EFFx 03-29-2017 13:22

Re: Random Respawn Chance
 
Use an array with [33] size and get_systime().

PHP Code:

new iSysTime get_systime()
if(
iSysTime >= YourArray[id])
{
    
YourArray[id] = iSysTime yourdelay
}
else
{
    
client_print(idprint_chat"Wait %i second%s", (YourArray[id] - iSysTime), (YourArray[id] - iSysTime) > "s" "")


For set a chance, use random_num().

PHP Code:

new iRandom random_num(firstValue, (get_user_flags(id) & ADMIN_BAN) ? secondValueAdmin secondValueNormalPlayer)
if(
iRandom == ValueYouWant)
{
    
// bla bla



LifeStone 03-30-2017 12:34

Re: Random Respawn Chance
 
someone can help me ?

LifeStone 03-31-2017 07:58

Re: Random Respawn Chance
 
someone can help me ? sry double post :/

Natsheh 04-01-2017 15:00

Re: Random Respawn Chance
 
1 Attachment(s)
here's respawn by chance each round...


All times are GMT -4. The time now is 17:59.

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