Raised This Month: $ Target: $400
 0% 

[ HELP ] How to fix the code?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-19-2015 , 19:00   Re: [ HELP ] How to fix the code?
Reply With Quote #1

Thank for the help, the other problem was g_hamczbots.
I've got another little problem, I made a plugin to give an extra item to a random bot, and modified so that no extra if the bot already have, only when all the bots already have the extra, the weapon is given to a player with id 0, how to fix?

Code:
#include < amxmodx > #include < zombieplague > new const VERSION[] = "1.0"; new g_MaxPlayers, cvar_give_extras_delay, g_endround, g_has_extra[33]; public plugin_init() {     register_plugin("[ZP43] Addon: Give Random Extras Bot", VERSION, "CrazY");     g_MaxPlayers = get_maxplayers()     cvar_give_extras_delay = register_cvar("zp_give_extras_delay", "20.0"); } public zp_round_started() {     g_endround = false;     set_task(get_pcvar_float(cvar_give_extras_delay), "give_extras_bot", 053, .flags="b"); } public zp_round_ended() {     g_endround = true;     if(task_exists(053)) remove_task(053); } public give_extras_bot() {     if(!g_endround)     {         static iBotName[33], iBotsNum; iBotsNum = fnGetAlive();         new botid = fnGetRandomAlive(random_num(1, iBotsNum))         get_user_name(botid, iBotName, 32);         set_hudmessage(random(255), random(255), random(255), -1.0, 0.7, 1, 6.0, 1.1, 0.5, 0.5);         show_hudmessage(0, "O bot %s ganhou uma  M249 Para Machinegun", iBotName);         zp_force_buy_extra_item(botid, zp_get_extra_item_id("M249 Para Machinegun"), 1);         g_has_extra[botid] = true;     } }   stock fnGetAlive() {     new iAlive, id;         for (id = 1; id <= g_MaxPlayers; id++)     {        if (is_user_alive(id) && is_user_bot(id) && !zp_get_user_zombie(id) && !zp_get_user_survivor(id) && !g_has_extra[id])             iAlive++     }         return iAlive; } stock fnGetRandomAlive(target_index) {     new iAlive, id;         for (id = 1; id <= g_MaxPlayers; id++)     {         if (is_user_alive(id) && is_user_bot(id) && !zp_get_user_zombie(id) && !zp_get_user_survivor(id) && !g_has_extra[id])             iAlive++                 if (iAlive == target_index)             return id;     }         return -1; }
__________________








CrazY. is offline
Reply



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 18:04.


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