Raised This Month: $ Target: $400
 0% 

Respawn and speed add doesn't work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 03-29-2011 , 08:05   Respawn and speed add doesn't work
Reply With Quote #1

I don't get how to fix but respawn and speed add doesn't work, turbo works perfect but those two doesn't work

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Catch Mod Vip"
#define VERSION "1.0"
#define AUTHOR "Slimi.lt"

#define FLAG ADMIN_LEVEL_H
#define TID_RESP 2551    

new cvar_speed;
new 
cvar_time;
new 
respawned[33];
new 
respawn[33];
new 
speed[33];
new 
turbos[33];
new 
wait false
new team[32]
new 
turbo[32][2]
new 
choose[33];
new 
g_timeleft[33]
new 
g_max_players

new catch_t_speed;

new 
catch_speed,catch_f_speed,catch_o_speed,catch_l_speed

public plugin_init()
{
    
register_plugin(PLUGIN,VERSION,AUTHOR)

    
cvar_speed register_cvar("speed_add""200")
    
catch_speed register_cvar("default_speed""2.0")
    
catch_t_speed register_cvar("turbo_add""2.0")
    
catch_f_speed register_cvar("catch_f_speed","1.0")
    
catch_o_speed register_cvar("catch_o_speed","1.0")
    
catch_l_speed register_cvar("catch_l_speed","1.15")
    
catch_t_speed register_cvar("catch_t_speed","1.5")
    
register_event("CurWeapon""event_cur_weapon""be")
    
cvar_time register_cvar("time_respawn""5.0")
    
RegisterHam(Ham_Spawn"player""bacon_spawn"1)
    
register_clcmd("say /vipmenu""vipmenu")
    
register_logevent("round_end"2"1=Round_End")
    
register_logevent("round_start"2"1=Round_Start")
    
register_logevent("logevent_round_end"2"1=Round_End")
        
g_max_players get_maxplayers()
}

public 
client_connect(client)
{
    
turbos[client] = 0;
    
respawned[client] = 0;
    
speed[client] = 0;
    
choose[client] = 0;
}

public 
client_disconnect(client)
{
    
turbos[client] = 0;
    
respawned[client] = 0;
    
speed[client] = 0;
    
choose[client] = 0;
}

public 
round_end(id)
{
    
turbos[id] = 0;
    
respawned[id] = 0;
    
speed[id] = 0;
    
choose[id] = 0;
}

public 
round_start(id)
{    
    
turbos[id] = 0;
    
respawned[id] = 0;
    
speed[id] = 0;
    
choose[id] = 0;
}

public 
bacon_spawn(id)
{
    if(!
is_user_alive(id))
       return;

    if(
get_user_flags(id) & FLAG)
    {
        
vipmenu(id)
        
turbos[id] = 0;
        
respawned[id] = 0;
        
speed[id] = 0;
    }
}

public 
vipmenu(id)
{
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED

        
new menu menu_create("\rVip menu" "Vip_Menu");
        
menu_additem(menu ,"\w200% Turbo""1" 0);
        
menu_additem(menu ,"\w200 Speed""2" 0);
        
menu_additem(menu ,"\r1 \wrespawn after death""3" 0);
 
        
menu_setprop(menu MPROP_EXIT MEXIT_ALL);
 
        
menu_display(id menu 0);

        return 
PLUGIN_CONTINUE;
}

public 
Vip_Menu(idmenuitemplayer)
{
   if (
item == MENU_EXIT)
   {
      
menu_destroy(menu)
      return 
PLUGIN_HANDLED
   
}

   new 
data[6], iName[64]
   new 
accesscallback
   menu_item_getinfo
(menuitemaccessdata5iName63callback)
   
   new 
key str_to_num(data)
   
   switch(
key)
   {
      case 
1:
      {
        
turbos[id] = 1;
        
respawn[id] = 0;
        
speed[id] = 0;
        
choose[id] = 1;
        
speedup(id);
      }

      case 
2:
      {
        
turbos[id] = 0;
        
respawn[id] = 1;
        
choose[id] = 1;
        
speed[id] = 0;
      }

      case 
3:
      {
        
turbos[id] = 0;
        
respawn[id] = 0;
        
choose[id] = 1;
        
speed[id] = 1;
      }
   }
   
menu_destroy(menu)
   return 
PLUGIN_HANDLED;
}

public 
event_cur_weapon(idplayer)
{
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED
    
    
if(speed[id] == 1)
    {
            static 
Float:speedasspeedas get_pcvar_float(catch_speed) + get_pcvar_float(cvar_speed)
            
set_pev(idpev_maxspeedspeedas)
    }
    return 
PLUGIN_CONTINUE
}

public 
speedup(id
{
    new 
Float:speed

    
if(team[id-1] == 1)
        
speed 320.0 get_pcvar_float(catch_speed) * get_pcvar_float(catch_f_speed)
    else {
        if(
other_num() == && !wait && get_playersnum() > 2)
            
speed 320.0 get_pcvar_float(catch_speed) * get_pcvar_float(catch_l_speed)
        else
            
speed 320.0 get_pcvar_float(catch_speed) * get_pcvar_float(catch_o_speed)
    }

    if(
turbo[id-1][0] == 1)
        
speed *= get_pcvar_float(catch_t_speed)

    
set_user_maxspeed(id,speed)
}

public 
other_num() {
    new 
count 0
    
for(new i=1;i<33;i++)
        if(
team[i-1] == && is_user_connected(i) && is_user_alive(i))
            
count++
    
    return 
count
}

public 
fwd_ClientKill(id)
{
    if((
respawned[id] == 0) && (respawn[id] == 1) && (get_user_flags(id) & FLAG))
    {
            static 
id
            id 
read_data(2)
            if(!
is_user_connected(id) || is_user_alive(id))
                return
            
g_timeleft[id] = get_pcvar_num(cvar_time)
            
set_task(1.0"count"TID_RESP+id)
            if(
is_user_bot(id))
                return
    }
}

public 
count(tidid)
{
    if((
respawned[id] == 0) && (respawn[id] == 1) && (get_user_flags(id) & FLAG))
    {
            static 
id
            id 
tid-TID_RESP
            
if(!is_user_connected(id) || is_user_alive(id))
                return


            
g_timeleft[id] -= 1
            
if(g_timeleft[id] <= 0){
                
set_pev(id,pev_deadflag,DEAD_RESPAWNABLE);
                
set_task(0.2"respawna"id)
                return
            }else{
                
set_task(1.0"count"TID_RESP+id)
            }
    
            if(
is_user_bot(id))
                return
    }
}

public 
respawna(id)
{
    if((
respawned[id] == 0) && (respawn[id] == 1) && (get_user_flags(id) & FLAG))
    {
            if(!
is_user_connected(id) || is_user_alive(id))
                return
            
dllfunc(DLLFunc_Spawnid)
        
respawned[id] = 1;
        
respawn[id] = 0;
    }
}

public 
logevent_round_end(id)
{
        new 
i
        
for(i=1i<=g_max_playersi++){
            if(
task_exists(TID_RESP+i))
                
remove_task(TID_RESP+i)
        }

DoviuX is offline
Send a message via Skype™ to DoviuX
Nyuszy
Senior Member
Join Date: Apr 2009
Old 03-29-2011 , 13:40   Re: Respawn and speed add doesn't work
Reply With Quote #2

i'm not a good amxx scripter, but:

1. round_start, round_end and logevent_round_end are global events, so you can't use
PHP Code:
public round_start(id
just
PHP Code:
public round_start() 
and you need to loop through players...

2.
PHP Code:
public event_cur_weapon(idplayer
->
PHP Code:
public event_cur_weapon(id// id = player index 
3.
PHP Code:
dllfunc(DLLFunc_Spawnid
->
PHP Code:
ExecuteHamB(Ham_CS_RoundRespawnid
Nyuszy 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 14:33.


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