Raised This Month: $ Target: $400
 0% 

Why does my code not work? CS 1.6


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 01-14-2016 , 09:27   Re: Why does my code not work? CS 1.6
Reply With Quote #6

Quote:
Originally Posted by abdobiskra View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat> //I'm using colorchat for colors :3

#define PLUGIN "WelcomeMessage"
#define VERSION "1.0"
#define AUTHOR "JavoL" //<-- That's my name :O


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR
}

public 
client_putinserver(id)
{
    if(
is_user_connected(id))        
    
set_task(8.0"welcome"id)

}
public 
welcome(id)
{
    new 
szName[33//User's name
    
get_user_name(idszNamecharsmax(szName)) //Well... You kno'
    
ColorChat(idTEAM_COLOR"^3Dobrodosao na server ^4%s^3! ^3Say: ^4/pravila ^3da vidite pravila servera."szName//Message

Actually your code is wrong. Wtf you are checking on putin and after 8 seconds you are not checking if player is connected?
And you should check if task exists so it would be will exactly at 8 seconds.

This code is correct:



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

#define PLUGIN "WelcomeMessage"
#define VERSION "1.0"
#define AUTHOR "JavoL"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR); 
}

public 
client_putinserver(id)
{      
    if(
task_exists(id))
         
remove_task(id);

    
set_task(8.0"welcome_msg"id);
}

public 
welcome_msg(id)
{
    if(!
is_user_connected(id)) return;
    new 
szName[33];
    
get_user_name(idszNamecharsmax(szName));
    
ColorChat(idTEAM_COLOR"^3Dobrodosao na server ^4%s^3! ^3Say: ^4/pravila ^3da vidite pravila servera."szName);

siriusmd99 is offline
 



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 09:25.


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