AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Function on all (https://forums.alliedmods.net/showthread.php?t=160015)

Diegorkable 06-24-2011 05:49

Function on all
 
Hey.
I want to make a plugin that includes round_start()
it means that it is called when the round starts, now my question is, how do I do inside the public function that it checks all the players that are currently logged in the server and checks if they are CT?

Nyuszy 06-24-2011 06:46

Re: Function on all
 
PHP Code:

public round_start()
{
    new 
players[32], numid
    get_players
(playersnum"eh""CT")
    for(new 
0numi++)
    {
        
id players[i]
        
// ...
    
}



Diegorkable 06-24-2011 13:25

Re: Function on all
 
Hey!

I made a code that is supposed to give all the CT players each round a defusal kit.

Still it is not working, tell me why?

PHP Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "Defuse Kit"
#define VERSION "1.0"
#define AUTHOR "p1Mp"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
}

public 
round_start()
{
    new 
players[32], numid
    get_players
(playersnum"aeh""CT")
    for(new 
0numi++)
    {
        
id players[i]
        
give_item(id"item_thighpack")
    }



Exolent[jNr] 06-24-2011 13:26

Re: Function on all
 
Because you never hooked round_start() to anything.

Diegorkable 06-24-2011 13:33

Re: Function on all
 
what do you mean? could you please elaborate?
I did the same with the public function player_connect() and didn't have to 'hook' it up to anything and it worked.

How do I hook up round_start() to something that it will work?? please tell me

Exolent[jNr] 06-24-2011 14:18

Re: Function on all
 
https://forums.alliedmods.net/showthread.php?t=42159

Diegorkable 06-24-2011 15:04

Re: Function on all
 
Here is the new code, it doesn't work either.
Whats wrong?!?

PHP Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "Defuse Kit"
#define VERSION "1.0"
#define AUTHOR "p1Mp"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("round_start"2"1=Round_Start")  
}

public 
round_start()
{
    new 
players[32], numid
    get_players
(playersnum"aeh""CT")
    for(new 
0numi++)
    {
        
id players[i]
        
give_item(i"item_thighpack")
    }



Exolent[jNr] 06-24-2011 15:14

Re: Function on all
 
Because you changed part of your code.

Quote:

Originally Posted by Diegorkable (Post 1495387)
PHP Code:

        give_item(id"item_thighpack"


Quote:

Originally Posted by Diegorkable (Post 1495477)
PHP Code:

        give_item(i"item_thighpack"



Diegorkable 06-24-2011 15:31

Re: Function on all
 
thank you very much!!


All times are GMT -4. The time now is 23:31.

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