AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Noclip with time (https://forums.alliedmods.net/showthread.php?t=87760)

SpokY 03-16-2009 03:17

Noclip with time
 
Hello Guy's

can anyone make all player's have noclip for 8 or 10 secs when a round starts?

Thanks

Code:

/*
--------------------------------------------------------------
----------------------  Made by Deviance ---------------------
--------------------- www.the-place.co.nr --------------------
--------------------------------------------------------------
*/

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

#define Plugin "Noclip"
#define Version "1.3"
#define Author "Doombringer"

new bool:Has_to_wait[32], bool:Has_Noclip[32]
new player_noclip[32], temp

new nocliptime, noclipwait
public plugin_init()
{
        register_plugin(Plugin, Version, Author)
       
        register_clcmd("say noclipme", "noclip_init")
        register_clcmd("say_team noclipme", "noclip_init")
       
        nocliptime = register_cvar("NC_time", "30")
        noclipwait = register_cvar("NC_wait", "300")       
}

public client_putinserver(id)
{
        player_noclip[id] = get_pcvar_num(nocliptime)
}

public can_use_again(id)
{
        Has_to_wait[id] = false
        player_noclip[id] = get_pcvar_num(nocliptime)
}

public noclip_time(id)
{
        if(temp == 5 || player_noclip[id] < 6)
        {
                new number[32]
                num_to_word(player_noclip[id], number, 31)
               
                client_cmd(id, "spk ^"%s^"", number)
                temp = 0
        }
       
        player_noclip[id]--
       
        if(player_noclip[id] < 1)
        {
                set_user_noclip(id, 0)
               
                client_print(id, print_chat, "Your noclip time is over")       
                remove_task(id)
               
                Has_to_wait[id] = true
                Has_Noclip[id] = false

                set_task(float(get_pcvar_num(noclipwait)), "can_use_again", id)
               
                return PLUGIN_CONTINUE
        }
       
        temp++
        set_task(1.0, "noclip_time", id)
       
        return PLUGIN_CONTINUE
}

public give_noclip(id)
{
        set_user_noclip(id, 1)       
}

public noclip_init(id)
{
        if(Has_to_wait[id])
        {
                client_print(id, print_chat, "Sorry, you can't use noclip for the moment, try again later")
                return PLUGIN_CONTINUE
        }

        else if(Has_Noclip[id])
        {
                client_print(id, print_chat, "You already have noclip!")
                return PLUGIN_CONTINUE
        }

        else if(!is_user_alive(id))
        {
                client_print(id, print_chat, "You can't use noclip when your dead!")
                return PLUGIN_CONTINUE
        }
       
        Has_Noclip[id] = true
       
        set_task(5.0, "noclip_time", id)
        set_task(5.0, "give_noclip", id)
       
        client_print(id, print_chat, "You will get noclip in 5 seconds")
        temp = 5
       
        return PLUGIN_CONTINUE


TheRadiance 03-16-2009 03:41

Re: Noclip with time
 
PHP Code:

#include < amxmodx >
#include < fun >

public plugin_init( )
{
    
register_plugin"Noclip""1.0""SpokY" )
    
register_logevent"LogeventRoundStart"2"1=Round_Start" )
}

public 
LogeventRoundStart( )
{
    new 
iPlayers32 ]
    new 
iNum
    get_players
iPlayersiNum"a" )

    for ( new 
0iNuma++ )
        
set_user_noclipiPlayers], )

    
set_task9.0"TaskRemoveNoclip" )
}

public 
TaskRemoveNoclip( )
{
    new 
iPlayers32 ]
    new 
iNum
    get_players
iPlayersiNum"a" )

    for ( new 
0iNuma++ )
        
set_user_noclipiPlayers], )



SpokY 03-16-2009 14:31

Re: Noclip with time
 
Thanks but this Plugin allowed to fly 8 sec.
I mean which one through a player through to go can without this to touch oneself.

Dores 03-16-2009 16:27

Re: Noclip with time
 
@TheRadiance:
PHP Code:

for ( new 0iNuma++ )
    
set_user_noclipiPlayers], )

---->

new 
id;
for(new 
iNum a++)
{
      
id iPlayers[a]; // To avoid re-indexing.
      
      
set_user_noclip(id1);


I don't know what re-indexing means or why you should avoid it, but you just should. :shock:

ConnorMcLeod 03-16-2009 17:15

Re: Noclip with time
 
Quote:

Originally Posted by Dores (Post 782129)
I don't know what re-indexing means or why you should avoid it, but you just should. :shock:

It's usefull as soon as you gonna use many times iPlayers[a]
In thats case it's only used 1 time so you don't need to cache the value.

http://wiki.amxmodx.org/Optimizing_P...e-index_Arrays

Dores 03-16-2009 18:22

Re: Noclip with time
 
Woot! I've never seen that page(Optimizing Plugins)! Who wrote it?
And thanks, I thought so but wasn't too sure.

SpokY 03-17-2009 13:49

Re: Noclip with time
 
back 2 topic please

Dores 03-17-2009 16:43

Re: Noclip with time
 
Quote:

Originally Posted by SpokY (Post 782048)
I mean which one through a player through to go can without this to touch oneself.

This is not English, I don't understand what you want.

Arkshine 03-17-2009 16:46

Re: Noclip with time
 
Quote:

Who wrote it?
BAILOPAN.

gtpunkt 03-22-2009 14:10

Re: Noclip with time
 
Hello,
he dont want have a Noclip at round start.he mean Semiclip/Noblock at round start.
So the question should be hot.
can anyone make all player's have semiclip for 8/10 sec when a round starts?


All times are GMT -4. The time now is 08:58.

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