Raised This Month: $51 Target: $400
 12% 

MOTD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dineshrohra
Junior Member
Join Date: Aug 2012
Location: Dubai, United Arab Emira
Old 06-05-2014 , 07:06   MOTD
Reply With Quote #1

Hello!
Wanted a small plugin that could show an MOTD from directory after x seconds when a player joins any team..
Tried searching through the forums, could just get this.. But it doesn't seem to work for me.

PHP Code:
#include < amxmodx >
#include < cstrike >

#define MOTD_TASK 13579

public plugin_init ( )
{
     
register_plugin "Connect MOTD""1.0""You" )
}

public 
client_putinserver index )
{
     if ( 
is_user_bot index ) || is_user_hltv index ) )
     {
          return 
PLUGIN_HANDLED
     
}

     
// You can change here the time to recheck the player team.
     
set_task 2.5"show_motd_file"index MOTD_TASK__"b" )
}

public 
show_motd_file index )
{
     
index MOTD_TASK

     
// If the player has a team, show the MOTD and remove the task.
     
if ( cs_get_user_team index ) != CS_TEAM_UNASSIGNED )
     {
          
// Remeber to put 'your_file.txt' in 'cstrike/' folder.
          // And you also can change the MOTD header ( second param ) .
          
show_motd index"your_file.txt""MOTD header" 
EDIT: I'm using this plugin as well. (If that could make any change to any function)

Last edited by dineshrohra; 06-05-2014 at 07:10. Reason: To add further details
dineshrohra is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 06-05-2014 , 07:45   Re: MOTD
Reply With Quote #2

Remove the last three parameters from set_task, you don't need them.
__________________
Kia is offline
dineshrohra
Junior Member
Join Date: Aug 2012
Location: Dubai, United Arab Emira
Old 06-05-2014 , 09:56   Re: MOTD
Reply With Quote #3

Yet the same..
Gives me the following errors when I try to compile locally:

Quote:
//// Connect_MOTD.sma
Connect_MOTD.sma(20) : warning 209: function "client_putinserver" should return a value
Connect_MOTD.sma(24 -- 27) : warning 215: expression has no effect
dineshrohra is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 06-05-2014 , 10:08   Re: MOTD
Reply With Quote #4

It should be : index -= MOTD_TASK
__________________
Kia is offline
dineshrohra
Junior Member
Join Date: Aug 2012
Location: Dubai, United Arab Emira
Old 06-05-2014 , 10:33   Re: MOTD
Reply With Quote #5

PHP Code:
public client_putinserver index )
{
     if ( 
is_user_bot index ) || is_user_hltv index ) )
     {
          return 
PLUGIN_HANDLED
     
}

     
// You can change here the time to recheck the player team.
     
set_task 2.5"show_motd_file"index MOTD_TASK )
}

public 
show_motd_file index )
{
     
index -= MOTD_TASK

     
// If the player has a team, show the MOTD and remove the task.
     
if ( cs_get_user_team index ) != CS_TEAM_UNASSIGNED )
     {
          
// Remeber to put 'your_file.txt' in 'cstrike/' folder.
          // And you also can change the MOTD header ( second param ) .
          
show_motd index"your_file.txt""MOTD header" 
You mean this way?
dineshrohra is offline
Old 06-05-2014, 10:46
GinNNy
This message has been deleted by GinNNy. Reason: not working
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 06-05-2014 , 10:46   Re: MOTD
Reply With Quote #6

PHP Code:
public client_putinserver index 

     if ( 
is_user_bot index ) || is_user_hltv index ) ) 
     { 
          return 
PLUGIN_HANDLED 
     


     
// You can change here the time to recheck the player team. 
     
set_task 2.5"show_motd_file"index


public 
show_motd_file index 

     
// If the player has a team, show the MOTD and remove the task. 
     
if ( cs_get_user_team index ) != CS_TEAM_UNASSIGNED 
     { 
          
// Remeber to put 'your_file.txt' in 'cstrike/' folder. 
          // And you also can change the MOTD header ( second param ) . 
          
show_motd index"your_file.txt""MOTD header" )  
      }

__________________

Last edited by Kia; 06-05-2014 at 10:47.
Kia is offline
dineshrohra
Junior Member
Join Date: Aug 2012
Location: Dubai, United Arab Emira
Old 06-05-2014 , 10:59   Re: MOTD
Reply With Quote #7

PHP Code:
#include <amxmodx>
#include <cstrike>

public plugin_init ( )
{
     
register_plugin"Connect MOTD""1.0""Dinesh" )
}

public 
client_putinserver index 

     if ( 
is_user_bot index ) || is_user_hltv index ) ) 
     { 
          return 
PLUGIN_HANDLED 
     


     
// You can change here the time to recheck the player team. 
     
set_task 1.0"show_motd_file"index 


public 
show_motd_file index 

     
// If the player has a team, show the MOTD and remove the task. 
     
if ( cs_get_user_team index ) != CS_TEAM_UNASSIGNED 
     { 
          
// Remeber to put 'your_file.txt' in 'cstrike/' folder. 
          // And you also can change the MOTD header ( second param ) . 
          
show_motd index"rules.txt""Server Rules" )  
      }

This is my code, still shows this warning as above:
Quote:
//// Connect_MOTD.sma
Connect_MOTD.sma(20) : warning 209: function "client_putinserver" should return a value
dineshrohra is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 06-05-2014 , 11:00   Re: MOTD
Reply With Quote #8

Isn't a big problem, just return something.

PHP Code:
#include <amxmodx>
#include <cstrike>

public plugin_init ( )
{
     
register_plugin"Connect MOTD""1.0""Dinesh" )
}

public 
client_putinserver index 

     if ( 
is_user_bot index ) || is_user_hltv index ) ) 
     { 
          return 
PLUGIN_HANDLED 
     


     
// You can change here the time to recheck the player team. 
     
set_task 1.0"show_motd_file"index )

     return 
PLUGIN_HANDLED 


public 
show_motd_file index 

     
// If the player has a team, show the MOTD and remove the task. 
     
if ( cs_get_user_team index ) != CS_TEAM_UNASSIGNED 
     { 
          
// Remeber to put 'your_file.txt' in 'cstrike/' folder. 
          // And you also can change the MOTD header ( second param ) . 
          
show_motd index"rules.txt""Server Rules" )  
      }

__________________
Kia is offline
dineshrohra
Junior Member
Join Date: Aug 2012
Location: Dubai, United Arab Emira
Old 06-05-2014 , 11:13   Re: MOTD
Reply With Quote #9

Thanks, works alright
dineshrohra 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 06:33.


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