Raised This Month: $ Target: $400
 0% 

When I try to test the plugin, it crashes the game


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Itz
Junior Member
Join Date: Apr 2021
Old 05-27-2021 , 11:56   Re: When I try to test the plugin, it crashes the game
Reply With Quote #10

Quote:
Originally Posted by Natsheh View Post
PHP Code:

    
while (iKnife iMaxKnife)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_knifer_set(id)
        
iKnife++
        
        
// Apply Knife health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_kni_hp_multi)))
    } 
try to think abit about the logic of this loop and how it will end ?
I did it following the way the plugin had already done like the others so I don't understand why the others that were already not crashing like the ones I add.

For example, this one that works without crashing

PHP Code:
    // Turn specified amount of players into Snipers
    
new iSnipersiMaxSnipers sniper_count
    
while (iSnipers iMaxSnipers)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) )
            continue;
        
        
// If not, turn him into one
        
zp_class_sniper_set(id)
        
iSnipers++
        
        
// Apply sniper health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_sniper_hp_multi)))
    } 
But you may have to make these changes to make it work.
Itz is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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