Raised This Month: $ Target: $400
 0% 

Why does this plugin makes the server crash?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-02-2022 , 19:17   Re: Why does this plugin makes the server crash?
Reply With Quote #11

Show your test code..

Also i hope you noticed i am using break in the loop if no bots were found!

Also i don't see it as a problem calling get_players 30 times if you wish to call it less add two new parameters to the function iPlayers and iNum or create both of them globally but you know i just made it easy to use.

And TBH its not recommended to be used in a loop.

You can use a repeated task to give each bot a new extra item.

Like the following...

PHP Code:
public give_item_task(taskid)
{
    static 
iMaxBots 0;
    if(
taskid == TASK_STARTGIVEiMaxbots 0;
    if(!
iMaxBotsiMaxBots get_pcvar_num(cvar_max_bots);

    static 
idoldbots[MAX_PLAYERS], oldbots_count;

        if(! (
id get_random_bot(oldbotsoldbots_count)) )
        {
            
oldbots_count 0;
            return;
        }

        if (!
zp_get_user_zombie(id) && !g_has_item[id])
            
set_task(1.0"give_item"id+TASK_GIVEITEM);

    
iMaxbots--;

    if(
iMaxbots)
    {
          
set_task(0.5"give_item_task"TASK_STARTGIVE 1);
    }


For the OP use the code from crazy's in post #6
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-02-2022 at 20:01.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
 



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 11:30.


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