Raised This Month: $ Target: $400
 0% 

Need help with task


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazyChickenTest
Member
Join Date: Jul 2010
Location: World ;)
Old 07-15-2010 , 03:41   Need help with task
Reply With Quote #1

Hi. I need help with two task. I try do in code that if you dead others your team mates can revival you but they have only 15 seconds to do it! I have code with one of plugin on this forum. And how can I must edit it to my idea?
It's code here:
Code:
public event_death()
{
    new id = read_data(2)
    
    reset_player(id)
    if(g_haskit[id])
    {
        g_haskit[id] = false
    }
    
    static Float:minsize[3]
    pev(id, pev_mins, minsize)
    
    if(minsize[2] == -18.0)
        g_wasducking[id] = true
    else
        g_wasducking[id] = false
    
    set_task(0.5, "task_check_dead_flag", id)
}

public task_check_dead_flag(id)
{
    if(!is_user_connected(id))
        return
    
    if(pev(id, pev_deadflag) == DEAD_DEAD)
        create_fake_corpse(id)
    else
        set_task(0.5, "task_check_dead_flag", id)
}
I think I must do it here but how?
Sry for my not good english
CrazyChickenTest is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 07-15-2010 , 13:36   Re: Need help with task
Reply With Quote #2

PHP Code:

#include <fakemeta>
new boolcan_revive[33]
public 
event_death()
{
    new 
id read_data(2)
    
    
reset_player(id)
    if(
g_haskit[id])
    {
        
g_haskit[id] = false
    
}
    
    static 
Float:minsize[3]
    
pev(idpev_minsminsize)
    
    if(
minsize[2] == -18.0)
        
g_wasducking[id] = true
    
else
        
g_wasducking[id] = false
    
    set_task
(0.5"task_check_dead_flag"id)
    
set_task(15"task_b"id)
}

public 
task_check_dead_flag(id)
{
    if(!
is_user_connected(id))
        return
    
    if(
pev(idpev_deadflag) == DEAD_DEAD)
        
create_fake_corpse(id)
    else
        
set_task(0.5"task_check_dead_flag"id)
}
  
public 
task_b(id) {
    
can_revive[id] = false


public 
round_start() 
      for (new 
i=1i<=get_maxplayers(); i++)
            if (
is_user_alive(i) && is_user_connected(i))
                   
can_revive[i] = true

//Now you have to check if player want to revive someone..
//I suppose that to revive someone you have to write in say "/revive [name]"
public plugin_init() {
      
register_event("HLTV","Event_StartRound","a","1=0","2=0")
      
register_clcmd("say /revive""sayrevive"ADMIN_ALL)
}

public 
sayrevive(idlevelcid) {
          if (!
cmd_access(idlevelcid3)
                    
//He put more of 3 arguments
                     
return PLUGIN_HANDLED
          
new data[32]
          
read_argv(2data31)
          if (!
is_user_alive(id) || is_user_alive(data))
                     
//Revived client are alive or reviver are dead
                     
return PLUGIN_HANDLED
          
new rid find_player("lb"data)
          if (!
rid)
                     
//Part of name doesn't found
                     
return PLUGIN_HANDLED
          
if (!can_revive[rid]) //If can revive is false
                     //15 seconds have passed
                     
return PLUGIN_HANDLED
          ExecuteHamB
(Ham_CS_RoundRespawnrid)
          
set_task(0.1,"revivePl",0,rid,2)    

          return 
PLUGIN_CONTINUE    
}

public 
revivePl(id

    
fm_DispatchSpawn(id
    if (
get_user_team(id)==1
    { 
        
fm_give_item(id,weapons[WEAPON_KNIFE]) 
        
fm_give_item(id,weapons[WEAPON_GLOCK18]) 
        
fm_give_item_x(id,ammo_9mm,2)
    } 
    else 
    { 
        
fm_give_item(id,weapons[WEAPON_KNIFE]) 
        
fm_give_item(id,weapons[WEAPON_USP]) 
        
fm_give_item_x(id,ammo_45acp,2
    }

Test it
Mxnn is offline
CrazyChickenTest
Member
Join Date: Jul 2010
Location: World ;)
Old 07-15-2010 , 17:26   Re: Need help with task
Reply With Quote #3

thx it works Topic is ready for close ;)
CrazyChickenTest is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 07-15-2010 , 18:24   Re: Need help with task
Reply With Quote #4

Quote:
Originally Posted by Mxnn View Post
PHP Code:

#include <fakemeta>
new boolcan_revive[33]
public 
event_death()
{
    new 
id read_data(2)
    
    
reset_player(id)
    if(
g_haskit[id])
    {
        
g_haskit[id] = false
    
}
    
    static 
Float:minsize[3]
    
pev(idpev_minsminsize)
    
    if(
minsize[2] == -18.0)
        
g_wasducking[id] = true
    
else
        
g_wasducking[id] = false
    
    set_task
(0.5"task_check_dead_flag"id)
    
set_task(15"task_b"id)
}

public 
task_check_dead_flag(id)
{
    if(!
is_user_connected(id))
        return
    
    if(
pev(idpev_deadflag) == DEAD_DEAD)
        
create_fake_corpse(id)
    else
        
set_task(0.5"task_check_dead_flag"id)
}
  
public 
task_b(id) {
    
can_revive[id] = false


public 
round_start() 
      for (new 
i=1i<=get_maxplayers(); i++)
            if (
is_user_alive(i) && is_user_connected(i))
                   
can_revive[i] = true

//Now you have to check if player want to revive someone..
//I suppose that to revive someone you have to write in say "/revive [name]"
public plugin_init() {
      
register_event("HLTV","Event_StartRound","a","1=0","2=0")
      
register_clcmd("say /revive""sayrevive"ADMIN_ALL)
}

public 
sayrevive(idlevelcid) {
          if (!
cmd_access(idlevelcid3)
                    
//He put more of 3 arguments
                     
return PLUGIN_HANDLED
          
new data[32]
          
read_argv(2data31)
          if (!
is_user_alive(id) || is_user_alive(data))
                     
//Revived client are alive or reviver are dead
                     
return PLUGIN_HANDLED
          
new rid find_player("lb"data)
          if (!
rid)
                     
//Part of name doesn't found
                     
return PLUGIN_HANDLED
          
if (!can_revive[rid]) //If can revive is false
                     //15 seconds have passed
                     
return PLUGIN_HANDLED
          ExecuteHamB
(Ham_CS_RoundRespawnrid)
          
set_task(0.1,"revivePl",0,rid,2)    

          return 
PLUGIN_CONTINUE    
}

public 
revivePl(id

    
fm_DispatchSpawn(id
    if (
get_user_team(id)==1
    { 
        
fm_give_item(id,weapons[WEAPON_KNIFE]) 
        
fm_give_item(id,weapons[WEAPON_GLOCK18]) 
        
fm_give_item_x(id,ammo_9mm,2)
    } 
    else 
    { 
        
fm_give_item(id,weapons[WEAPON_KNIFE]) 
        
fm_give_item(id,weapons[WEAPON_USP]) 
        
fm_give_item_x(id,ammo_45acp,2
    }

Test it
Next time use fun, not fakemeta_util
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-15-2010 , 20:43   Re: Need help with task
Reply With Quote #5

Mxnn, that code doesn't even come close to compiling plus has many inefficiencies. Please only help others if you are sure you know what you're doing.
__________________
Bugsy 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 07:07.


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