Raised This Month: $ Target: $400
 0% 

Message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dreuhn
Junior Member
Join Date: Jan 2010
Old 01-24-2010 , 09:22   Message
Reply With Quote #1

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

Last edited by Dreuhn; 07-27-2012 at 15:48. Reason: Grammar
Dreuhn is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 01-24-2010 , 09:27   Re: Message
Reply With Quote #2

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.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Dreuhn
Junior Member
Join Date: Jan 2010
Old 01-24-2010 , 09:29   Re: Message
Reply With Quote #3

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

Last edited by Dreuhn; 07-27-2012 at 14:59.
Dreuhn is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 01-24-2010 , 12:22   Re: Message
Reply With Quote #4

Quote:
Originally Posted by Dreuhn View Post
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.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Dreuhn
Junior Member
Join Date: Jan 2010
Old 01-24-2010 , 13:17   Re: Message
Reply With Quote #5

set_task does not work in plugin_init either
Any1 got any suggestions?
Dreuhn is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 01-24-2010 , 13:18   Re: Message
Reply With Quote #6

It should work. Post your code.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Dreuhn
Junior Member
Join Date: Jan 2010
Old 01-24-2010 , 13:24   Re: Message
Reply With Quote #7

PHP Code:
public plugin_init()
{
    
set_task(1.0"msg")
}

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

Dreuhn is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 01-24-2010 , 13:26   Re: Message
Reply With Quote #8

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

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 01-24-2010 , 13:27   Re: Message
Reply With Quote #9

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
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-24-2010 , 13:29   Re: Message
Reply With Quote #10

Quote:
Originally Posted by wrecked_ View Post
You need to register the plugin too...

PHP Code:
 register_pluginPLUGINVERSIONAUTHOR 
That too.
Technically optional.
__________________
fysiks 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:24.


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