Raised This Month: $ Target: $400
 0% 

register_concmd help (DISPLAYING RULES)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lordshiva
BANNED
Join Date: Aug 2009
Location: Heaven
Old 10-08-2009 , 04:43   register_concmd help (DISPLAYING RULES)
Reply With Quote #1

i ve made this plugin....but it only works sometimes....but i wanted to work this when i type....whn i type amx_rules or /rules than sometimes it works sometimes dont can u correct it
PHP Code:
#include <amxmodx>
#include <colorchat>

public plugin_init() 

    
register_plugin("RULES","1.0","LORDSHIVA")
    
register_concmd("amx_rules""Rules"ADMIN_SLAY"Shows Rules")
    
register_concmd("say /rules""Rules"ADMIN_SLAY"Shows Rules")
}

public 
Rules(id)
{
     if(
is_user_alive(id))
    {
        new 
name[32];
        
get_user_name(idname31);
        
set_hudmessage(2551000, -1.00.3)
        
show_hudmessage(id"%s^rRead Clan Rules"name);
    
set_task5.0"rule"id );  
    }

public 
rule(id)
{
  
ColorChat(0RED"[KR] KNIFEROUND !!!")
  
ColorChat(0BLUE"[TC] TEAM CHOOSING")
  
ColorChat(0GREY"[PR] PISTOLROUND !!! ")
  
ColorChat(0GREEN"CLAN STARTED RACE TO 15 TEAM WINS")
  
set_task6.0"rule1"id ); 
}

public 
rule1()
{
   
ColorChat(0GREEN"LIVE !!!  LIVE !!!  LIVE !!!")
   
ColorChat(0GREEN"LIVE LIVE LIVE !!! ")
   
ColorChat(0GREEN"LIVE !!!  LIVE !!!  LIVE !!!")
   
ColorChat(0GREEN"LIVE LIVE LIVE !!! ")
   
ColorChat(0GREEN"LIVE !!!  LIVE !!!  LIVE !!!")


Last edited by lordshiva; 10-08-2009 at 23:26.
lordshiva is offline
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-08-2009 , 07:28   Re: Plugin Help Correction
Reply With Quote #2

There are two flaws in your code.
For the first matter, whenever using a "say" command, you should use register_clcmd and not register_concmd (else you have to go to the console and type "say /rules" to get it working).
For the second one, whenever you create a task, the third parameter identifies the task with an ID. What you are doing right now is using the player's ID to identify the task, which is nothing but a common mistake. A correct use of set_task follows:

PHP Code:
#define TASK_SHOW_RULES   1234
 
public rule(id)
{
    
ColorChat(0RED"[KR] KNIFEROUND !!!")
    
ColorChat(0BLUE"[TC] TEAM CHOOSING")
    
ColorChat(0GREY"[PR] PISTOLROUND !!! ")
    
ColorChat(0GREEN"CLAN STARTED RACE TO 15 TEAM WINS")
    
set_task6.0"rule1"TASK_SHOW_RULES ); 

For more information, please check:

set_task @ funcwiki: http://www.amxmodx.org/funcwiki.php?go=func&id=253
register_clcmd @ funcwiki: http://www.amxmodx.org/funcwiki.php?go=func&id=259

Hope this helped, any further questions, please don't hesitate.

Last edited by vitorrd; 10-08-2009 at 07:31.
vitorrd is offline
3Di
Member
Join Date: Sep 2009
Location: #php_title
Old 10-08-2009 , 09:31   Re: Plugin Help Correction
Reply With Quote #3

Edited for stupidity.

Last edited by 3Di; 10-08-2009 at 09:35.
3Di is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-08-2009 , 09:32   Re: Plugin Help Correction
Reply With Quote #4

Quote:
Originally Posted by 3Di View Post
vittord, why are you defining the index as 1234?

For all players: set_task( 6.0, "rule1", 0 );

For one player: set_task( 6.0, "rule1", index );
Thats wrong. its task id, and not players id.
__________________
xPaw is offline
3Di
Member
Join Date: Sep 2009
Location: #php_title
Old 10-08-2009 , 09:35   Re: Plugin Help Correction
Reply With Quote #5

Quote:
Originally Posted by xPaw View Post
Thats wrong. its task id, and not players id.
Wow, I'm sorry I completely read that wrong and wasn't thinking. Thanks for catching my mistake.
3Di is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-08-2009 , 10:03   Re: Plugin Help Correction
Reply With Quote #6

It happens often the the player's index is passed as TaskId for simplicity.
__________________
Arkshine is offline
Old 10-08-2009, 10:27
lordshiva
This message has been deleted by lordshiva.
lordshiva
BANNED
Join Date: Aug 2009
Location: Heaven
Old 10-08-2009 , 10:31  
Reply With Quote #7

Quote:
Originally Posted by xPaw View Post
Thats wrong. its task id, and not players id.
xPaw how to proceed with task id

is this correct
set_task( 5.0, "rule", id );



register_concmd("amx_rules","Rules", ADMIN_SLAY, "Shows Rules")-------THIS IS NOT WORKING
register_clcmd("say /rules","Rules", ADMIN_SLAY, "Shows Rules")-------THIS IS WORKING


EDIT:

When i type rcon amx_rules than nothing is displayed but when in console i type amx_rules than it is displaying

EDIT 2:

i want this in format like

when i type rcon amx_rules than it displays to ALL players...........
public Rules(id)
public rule(id)
public rule1()

and when i alone type /rules...than it displays TO ME ONLY
public Rules(id)
public rule(id)
public rule1()

Last edited by Exolent[jNr]; 10-08-2009 at 11:23.
lordshiva is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-08-2009 , 11:24   Re: Plugin Help Correction
Reply With Quote #8

Don't post again if you have the last post. Instead, edit your last post.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
lordshiva
BANNED
Join Date: Aug 2009
Location: Heaven
Old 10-08-2009 , 11:27   Re: Plugin Help Correction
Reply With Quote #9

yeah will not post again but can u help me in correcting
lordshiva is offline
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-08-2009 , 12:46   Re: Plugin Help Correction
Reply With Quote #10

@Arkshine: Leading to this kind of mistakes

@lordshiva: You should pass the player's ID to the task and then use the ColorChat prints on that ID (0 shows to everyone).
vitorrd 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 22:37.


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