AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   public event_round_start (https://forums.alliedmods.net/showthread.php?t=153869)

Samsoniq 03-30-2011 12:16

public event_round_start
 
HTML Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

new rbnumber[33]

public plugin_init()
{
    register_plugin("RedBull","1.0","*SAms0n_")
    register_clcmd("rb","aredbull")
    register_cvar("RBCost","10")
    register_cvar("RBLasts","30.0")     
        register_logevent("event_round_start", 2, "1=Round_Start")
}
public client_connect(id)
{
    rbnumber[id]=0
}

public client_disconnect(id)
{
    rbnumber[id]=0

}

public event_round_start(){
    remove_task(234)
    return PLUGIN_CONTINUE
 } 
 
public aredbull(id)
{
    if(cs_get_user_money(id)<get_cvar_num("RBCost"))
    {
        return PLUGIN_HANDLED
    }
    cs_set_user_money(id,cs_get_user_money(id) - get_cvar_num("RBCost"),1)
    rbnumber[id]=0
    set_task(0.0,"special",id)
    return PLUGIN_HANDLED
}



public special(id)
{

       
    if(floatcmp(float(rbnumber[id]),get_cvar_float("RBLasts"))==0.0 ||  floatcmp(float(rbnumber[id]),get_cvar_float("RBLasts"))==1)
    {
       
        rbnumber[id]=0
        set_user_gravity(id,1.0)
        set_user_maxspeed(id,320.0)
        return PLUGIN_HANDLED
    }
    set_user_gravity(id,0.6)
    set_user_maxspeed(id,0.0)
    rbnumber[id] = rbnumber[id] + 1
    set_task(1.0,"special",id,"234")
    set_user_health(id,1)

  message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
  write_short(1<<10)
  write_short(1<<10)
  write_short(0x0000)
  write_byte(0)
  write_byte(0)
  write_byte(200)
  write_byte(75)
  message_end()



    return PLUGIN_HANDLED


      }





public costs(id,level,cid)
{
    if(!cmd_access(id,level,cid,2))
    {
        return PLUGIN_HANDLED
    }
    new arg1[32]
    read_argv(1,arg1,31)
    set_cvar_num("RBCosts",str_to_num(arg1))
    return PLUGIN_HANDLED

}

public event_round_start dont work :shock:
so in next round player has 1hp and others function

Nyuszy 03-30-2011 12:31

Re: public event_round_start
 
this is because the 4. param of set_task isn't the id, so you can't remove the task with id 234 because it doesn't exist, you must loop over the players and remove tasks by their ids

Samsoniq 03-30-2011 12:47

Re: public event_round_start
 
Quote:

Originally Posted by Nyuszy (Post 1441743)
this is because the 4. param of set_task isn't the id, so you can't remove the task with id 234 because it doesn't exist, you must loop over the players and remove tasks by their ids

:shock:

so you can show me this? :mrgreen:

lis_16 03-30-2011 14:03

Re: public event_round_start
 
When u set task: set_task(time, function, id+245) in fuction(idd) new id=idd-245. In event new round make a loop for and remove task for each players.

Samsoniq 03-30-2011 14:29

Re: public event_round_start
 
I do not understand fully
can you show this in script :cry:

lis_16 03-30-2011 16:10

Re: public event_round_start
 
PHP Code:

public function(idd){
new 
id=idd-254
client_print
(idprint_chat"sdasdsadawed")
}

public 
something(id){
set_task(1.0"function"id+254)
}

public 
new_round(){
for(new 
id=0id<=32id++){
if(
task_exsists(id+254remove_task(id+254))
}


I hope there are no mistakes.

Samsoniq 03-30-2011 16:41

Re: public event_round_start
 
I see sam mistakes )
but can't compile it :grrr:

lis_16 03-30-2011 16:52

Re: public event_round_start
 
This is just an example. "function" is registered so it can be name of function.

Samsoniq 03-30-2011 18:05

Re: public event_round_start
 
Quote:

Originally Posted by lis_16 (Post 1441860)
This is just an example. "function" is registered so it can be name of function.

I know , but can't do this in my script :shock:

Exolent[jNr] 04-08-2011 21:12

Re: public event_round_start
 
You have been warned too many times about bumping before 2 weeks have passed.

This thread is now locked for 2 weeks and all similar threads will be locked.


All times are GMT -4. The time now is 14:30.

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