Raised This Month: $ Target: $400
 0% 

[help] knife round problem.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-07-2016 , 06:21   Re: [help] knife round problem.
Reply With Quote #4

Drissdev1, your code is worse then thread's author.
Ham spawn is for every player in part , you loop all players on every player spawn.
If there are 32 players then you strip their weapons 32 times.
In this case if you want to do knife= false then you shall use new round event and loop all players with a task:

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>

#define TASK_SW 11442

new bool:knife
new caller;

public 
plugin_init() 
{
    
register_plugin
    
(
        .
plugin_name "Knife Plugin",
        .
version "1.0",
        .
author "Artizy"
    
)
    
register_clcmd("say /knife","CmdSayKnife")
    
register_event("HLTV""event_new_round""a""1=0""2=0")  
}

public 
event_new_round(){

  if(
knife){
  if(
task_exists(TASK_SW))
  
remove_task(TASK_SW)
  
set_task(1.5"set_weapons"TASK_SW)
  }

}

public 
CmdSayKnife(id)
{
    if(
get_user_flags(id) & ADMIN_KICK)
    {
        
knife true
        caller 
id;
        
server_cmd("sv_restart 1")
        
server_cmd("mp_freezetime 0")
        
server_cmd("mp_startmoney 800")
        
client_print(0,print_chat,"[AMXX] KNIFE ROUND ENABLED.")
        return 
PLUGIN_CONTINUE;
    }
    return 
PLUGIN_HANDLED;
}

public 
set_weapons()
{
    new 
iPlayers[32], iPlayersNumiid;
    
get_players(iPlayersiPlayersNum"a")
    for (
0iPlayersNum; ++i)
    {
      
id iPlayers[i]
    
      
strip_user_weapons(id)
          
give_item(id,"weapon_knife")
        if(
caller == id){
           
cs_set_user_money(id,0)
        }else{
           
give_item(id,"weapon_deagle")
        }
    }
    
knife false;


Last edited by siriusmd99; 05-08-2016 at 16:43.
siriusmd99 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 18:41.


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