AlliedModders

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

Dreuhn 01-24-2010 09:22

Message
 
The script i am currently working on shall have a weapon menu which is only supposed to be enabled when there are 2 players left alive.
That is not a problem, but when there are two people left i want a message like: "Gun menu enabled. Type: /guns " or something similar but i canīt get it working.


PHP Code:

 public plugin_init()
 {
    new 
players[32], num;
    
get_players(playersnum);     
    if (
num == 2)
{

        
client_print(0print_chat"Gun menu enabled. Type: /guns");
}    


Does not work



I also tried:
PHP Code:

public plugin_init()
 {
        
client_print(0print_chat"Gun menu enabled. Type: /guns");              


But that doesn't work either

joropito 01-24-2010 09:27

Re: Message
 
Hook DeathMsg and with that check for alive players count so when there's only 2, you can send the message you want and set a flag to allow the use of the command.

Dreuhn 01-24-2010 09:29

Re: Message
 
DeathMsg?
Beware of that I'm new to Pawn.

wrecked_ 01-24-2010 12:22

Re: Message
 
Quote:

Originally Posted by Dreuhn (Post 1065664)
Hi!
I am currently doing a Deathmatch addon with a weapon menu.
The weapon menu shall only be enabled when there are 2 players left alive.
That is not a problem, but when there are two people left i want a message like: "Gun menu enabled. Type: /guns " or something but it doesn't works.


PHP Code:

 public plugin_init()
 {
    new 
players[32], num;
    
get_players(playersnum);     
    if (
num == 2)
{

        
client_print(0print_chat"Gun menu enabled. Type: /guns");
}    


Doesnt works



I've also tryed:
PHP Code:

public plugin_init()
 {
        
client_print(0print_chat"Gun menu enabled. Type: /guns");              


But that doesn't work either

1. The fact that it's in public plugin_init is a bit strange, you should probably designate a separate function for that.

2. Your check for players,
PHP Code:

if( num == // Only checks if there's exactly two players
if( num >= // Checks if there's two or more players 

3. It's probably not working due to that check error. Unless you had 2 players exactly, it wouldn't show.

Dreuhn 01-24-2010 13:17

Re: Message
 
set_task does not work in plugin_init either :(
Any1 got any suggestions?

wrecked_ 01-24-2010 13:18

Re: Message
 
It should work. Post your code.

Dreuhn 01-24-2010 13:24

Re: Message
 
PHP Code:

public plugin_init()
{
    
set_task(1.0"msg")
}

public 
msg()
{
         
client_print(0print_chat"Gun menu enabled. Type: /guns");
     return 
PLUGIN_HANDLED;



joropito 01-24-2010 13:26

Re: Message
 
I'm sure that one second after plugin_init you can't have players connected :P

wrecked_ 01-24-2010 13:27

Re: Message
 
You need to register the plugin too...

PHP Code:

 register_pluginPLUGINVERSIONAUTHOR 

That too.
Quote:

I'm sure that one second after plugin_init you can't have players connected :P

fysiks 01-24-2010 13:29

Re: Message
 
Quote:

Originally Posted by wrecked_ (Post 1065935)
You need to register the plugin too...

PHP Code:

 register_pluginPLUGINVERSIONAUTHOR 

That too.

Technically optional.


All times are GMT -4. The time now is 07:24.

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