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

Need advertise plugin with more lines


Post New Thread Reply   
 
Thread Tools Display Modes
mazdarx8
Veteran Member
Join Date: Aug 2014
Old 08-31-2016 , 16:07   Re: Need advertise plugin with more lines
Reply With Quote #11

Tried it now with your plugin and I compiled it... \n dont work for me..

\n is displaying in chat.
mazdarx8 is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 09-01-2016 , 03:07   Re: Need advertise plugin with more lines
Reply With Quote #12

Tried the first version ? I might debug it later tonight.
__________________
Arkarr is offline
mazdarx8
Veteran Member
Join Date: Aug 2014
Old 09-01-2016 , 03:59   Re: Need advertise plugin with more lines
Reply With Quote #13

Tried the one in post 10. Should I try post 9 ?
mazdarx8 is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 09-01-2016 , 04:02   Re: Need advertise plugin with more lines
Reply With Quote #14

Quote:
Originally Posted by mazdarx8 View Post
Tried the one in post 10. Should I try post 9 ?
Yup
__________________
Arkarr is offline
mazdarx8
Veteran Member
Join Date: Aug 2014
Old 09-01-2016 , 05:22   Re: Need advertise plugin with more lines
Reply With Quote #15

With post 9 no ads are showing..
mazdarx8 is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 09-05-2016 , 10:48   Re: Need advertise plugin with more lines
Reply With Quote #16

I'm going to make it work. Give me a sec.
__________________
Arkarr is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 09-05-2016 , 11:34   Re: Need advertise plugin with more lines
Reply With Quote #17

Sorry for double post. Tested and worked.

PHP Code:
#pragma semicolon 1 

#include <sourcemod> 
#include <multicolors> 
#include <cstrike> 
#include <clientprefs> 
#include <geoip> 

#define PLUGIN_URL "https://github.com/ESK0" 
#define PLUGIN_VERSION "2.6" 
#define PLUGIN_AUTHOR "ESK0" 

#define LoopClients(%1) for(int %1 = 1; %1 <= MaxClients; %1++) 

int g_iEnable

char g_sTag[50]; 
char g_sTime[32]; 

KeyValues g_hMessages

char FILE_PATH[PLATFORM_MAX_PATH]; 

Handle Cv_filepath INVALID_HANDLE
float g_fMessageDelay


public 
Plugin myinfo =  

    
name "Server Advertisement",  
    
author PLUGIN_AUTHOR,  
    
version PLUGIN_VERSION,  
    
description "Server Advertisement",  
    
url PLUGIN_URL 
}; 

public 
OnPluginStart() 

    
AutoExecConfig(true); 
    
CreateConVar("ServerAdvertisement_version"PLUGIN_VERSION"Server Advertisement plugin"FCVAR_PLUGIN FCVAR_SPONLY FCVAR_REPLICATED FCVAR_NOTIFY); 
    
Cv_filepath CreateConVar("ServerAdvertisement_filepath""addons/sourcemod/configs/ServerAdvertisement.cfg""Path for file with settings"); 
    
GetConVarString(Cv_filepathFILE_PATHsizeof(FILE_PATH)); 
    
LoadConfig(); 

public 
OnMapStart() 

    
LoadMessages(); 
    
CreateTimer(g_fMessageDelayEvent_PrintAdvert_TIMER_REPEAT TIMER_FLAG_NO_MAPCHANGE); 

public 
OnMapEnd() 

     

public 
Action Event_PrintAdvert(Handle timer

    
PrintAdverToAll(); 

public 
Action PrintAdverToAll() 

    if (
g_iEnable
    { 
        
char cookievalue[12]; 
        if (!
g_hMessages.GotoNextKey()) 
        { 
            
g_hMessages.GoBack(); 
            
g_hMessages.GotoFirstSubKey(); 
        } 
        
LoopClients(i
        { 
            if (
IsValidPlayer(i) && StrEqual(cookievalue"")) 
            { 
                
char sType[12]; 
                
char sText[256]; 
                
char sBuffer[256]; 
                
char sCountryTag[3]; 
                
char sAdminList[128]; 
                
char sIP[26]; 
                
                
GetClientIP(isIPsizeof(sIP)); 
                
GeoipCode2(sIPsCountryTag); 
                
KvGetString(g_hMessagessCountryTagsTextsizeof(sText), "LANGMISSING"); 
                if (
StrEqual(sText"LANGMISSING")) 
                    
g_hMessages.GetString("default"sTextsizeof(sText));
                 
                
char lines[10][256]; 
                 
                for (
int line 0line ExplodeString(sText"\\n"linessizeof linessizeof lines[]); line++) 
                { 
                    if (
StrContains(lines[line], "{NEXTMAP}") != -1
                    { 
                        
GetNextMap(sBuffersizeof(sBuffer)); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{NEXTMAP}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{CURRENTMAP}") != -1
                    { 
                        
GetCurrentMap(sBuffersizeof(sBuffer)); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{CURRENTMAP}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{CURRENTTIME}") != -1
                    { 
                        
FormatTime(sBuffersizeof(sBuffer), g_sTime); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{CURRENTTIME}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{SERVERIP}") != -1
                    { 
                        
int ips[4]; 
                        
int ip GetConVarInt(FindConVar("hostip")); 
                        
int port GetConVarInt(FindConVar("hostport")); 
                        
ips[0] = (ip >> 24) & 0x000000FF
                        
ips[1] = (ip >> 16) & 0x000000FF
                        
ips[2] = (ip >> 8) & 0x000000FF
                        
ips[3] = ip 0x000000FF
                        
Format(sBuffersizeof(sBuffer), "%d.%d.%d.%d:%d"ips[0], ips[1], ips[2], ips[3], port); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{SERVERIP}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{SERVERNAME}") != -1
                    { 
                        
GetConVarString(FindConVar("hostname"), sBuffersizeof(sBuffer)); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{SERVERNAME}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{ADMINSONLINE}") != -1
                    { 
                        
LoopClients(x
                        { 
                            if (
IsValidPlayer(x) && IsPlayerAdmin(x)) 
                            { 
                                if (
sAdminList[0] == 0)Format(sAdminListsizeof(sAdminList), "'%N'"x); 
                                else 
Format(sAdminListsizeof(sAdminList), "%s,'%N'"sAdminListx); 
                            } 
                        } 
                        
ReplaceString(lines[line], sizeof(lines[]), "{ADMINSONLINE}"sAdminList); 
                    } 
                    if (
StrContains(lines[line], "{TIMELEFT}") != -1
                    { 
                        
int i_Minutes
                        
int i_Seconds
                        
int i_Time
                        if (
GetMapTimeLeft(i_Time) && i_Time 0
                        { 
                            
i_Minutes i_Time 60
                            
i_Seconds i_Time 60
                        } 
                        
Format(sBuffersizeof(sBuffer), "%d:%02d"i_Minutesi_Seconds); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{TIMELEFT}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{PLAYERNAME}") != -1
                    { 
                        
Format(sBuffersizeof(sBuffer), "%N"i); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{PLAYERNAME}"sBuffer); 
                    } 
                    
g_hMessages.GetString("type"sTypesizeof(sType), "T"); 
                    if (
StrEqual(sType"T"false)) 
                    { 
                        
CPrintToChat(i"%s %s"g_sTaglines[line]); 
                    } 
                     
                    if (
StrEqual(sType"C"false)) 
                    { 
                        
PrintHintText(i"%s"lines[line]); 
                    } 
                } 
            } 
        } 
    } 


public 
LoadMessages() 

    
g_hMessages = new KeyValues("ServerAdvertisement"); 
    if (!
FileExists(FILE_PATH)) 
    { 
        
SetFailState("[ServerAdvertisement] '%s' not found!"FILE_PATH); 
        return; 
    } 
    
g_hMessages.ImportFromFile(FILE_PATH); 
    if (
g_hMessages.JumpToKey("Messages")) 
    { 
        
g_hMessages.GotoFirstSubKey(); 
    } 

public 
LoadConfig() 

    
KeyValues hConfig = new KeyValues("ServerAdvertisement"); 
    if (!
FileExists(FILE_PATH)) 
    { 
        
SetFailState("[ServerAdvertisement] '%s' not found!"FILE_PATH); 
        return; 
    } 
    
hConfig.ImportFromFile(FILE_PATH); 
    if (
hConfig.JumpToKey("Settings")) 
    { 
        
g_iEnable hConfig.GetNum("Enable"); 
        
g_fMessageDelay hConfig.GetFloat("Delay_between_messages"); 
        
hConfig.GetString("Time_Format"g_sTimesizeof(g_sTime)); 
        
hConfig.GetString("Advertisement_tag"g_sTagsizeof(g_sTag)); 
    } 
    else 
    { 
        
SetFailState("Config for 'Server Advertisement' not found!"); 
        return; 
    } 
    
delete hConfig

stock bool IsValidPlayer(int clientbool alive false

    if (
client >= && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && (alive == false || IsPlayerAlive(client))) { 
        return 
true
    } 
    return 
false

stock bool IsPlayerAdmin(client

    if (
GetAdminFlag(GetUserAdmin(client), Admin_Generic)) 
    { 
        return 
true
    } 
    return 
false

__________________
Arkarr is offline
my11
Member
Join Date: Feb 2015
Location: Argentina
Old 11-24-2016 , 22:59   Re: Need advertise plugin with more lines
Reply With Quote #18

Quote:
Originally Posted by Arkarr View Post
Sorry for double post. Tested and worked.

PHP Code:
#pragma semicolon 1 

#include <sourcemod> 
#include <multicolors> 
#include <cstrike> 
#include <clientprefs> 
#include <geoip> 

#define PLUGIN_URL "https://github.com/ESK0" 
#define PLUGIN_VERSION "2.6" 
#define PLUGIN_AUTHOR "ESK0" 

#define LoopClients(%1) for(int %1 = 1; %1 <= MaxClients; %1++) 

int g_iEnable

char g_sTag[50]; 
char g_sTime[32]; 

KeyValues g_hMessages

char FILE_PATH[PLATFORM_MAX_PATH]; 

Handle Cv_filepath INVALID_HANDLE
float g_fMessageDelay


public 
Plugin myinfo =  

    
name "Server Advertisement",  
    
author PLUGIN_AUTHOR,  
    
version PLUGIN_VERSION,  
    
description "Server Advertisement",  
    
url PLUGIN_URL 
}; 

public 
OnPluginStart() 

    
AutoExecConfig(true); 
    
CreateConVar("ServerAdvertisement_version"PLUGIN_VERSION"Server Advertisement plugin"FCVAR_PLUGIN FCVAR_SPONLY FCVAR_REPLICATED FCVAR_NOTIFY); 
    
Cv_filepath CreateConVar("ServerAdvertisement_filepath""addons/sourcemod/configs/ServerAdvertisement.cfg""Path for file with settings"); 
    
GetConVarString(Cv_filepathFILE_PATHsizeof(FILE_PATH)); 
    
LoadConfig(); 

public 
OnMapStart() 

    
LoadMessages(); 
    
CreateTimer(g_fMessageDelayEvent_PrintAdvert_TIMER_REPEAT TIMER_FLAG_NO_MAPCHANGE); 

public 
OnMapEnd() 

     

public 
Action Event_PrintAdvert(Handle timer

    
PrintAdverToAll(); 

public 
Action PrintAdverToAll() 

    if (
g_iEnable
    { 
        
char cookievalue[12]; 
        if (!
g_hMessages.GotoNextKey()) 
        { 
            
g_hMessages.GoBack(); 
            
g_hMessages.GotoFirstSubKey(); 
        } 
        
LoopClients(i
        { 
            if (
IsValidPlayer(i) && StrEqual(cookievalue"")) 
            { 
                
char sType[12]; 
                
char sText[256]; 
                
char sBuffer[256]; 
                
char sCountryTag[3]; 
                
char sAdminList[128]; 
                
char sIP[26]; 
                
                
GetClientIP(isIPsizeof(sIP)); 
                
GeoipCode2(sIPsCountryTag); 
                
KvGetString(g_hMessagessCountryTagsTextsizeof(sText), "LANGMISSING"); 
                if (
StrEqual(sText"LANGMISSING")) 
                    
g_hMessages.GetString("default"sTextsizeof(sText));
                 
                
char lines[10][256]; 
                 
                for (
int line 0line ExplodeString(sText"\\n"linessizeof linessizeof lines[]); line++) 
                { 
                    if (
StrContains(lines[line], "{NEXTMAP}") != -1
                    { 
                        
GetNextMap(sBuffersizeof(sBuffer)); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{NEXTMAP}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{CURRENTMAP}") != -1
                    { 
                        
GetCurrentMap(sBuffersizeof(sBuffer)); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{CURRENTMAP}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{CURRENTTIME}") != -1
                    { 
                        
FormatTime(sBuffersizeof(sBuffer), g_sTime); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{CURRENTTIME}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{SERVERIP}") != -1
                    { 
                        
int ips[4]; 
                        
int ip GetConVarInt(FindConVar("hostip")); 
                        
int port GetConVarInt(FindConVar("hostport")); 
                        
ips[0] = (ip >> 24) & 0x000000FF
                        
ips[1] = (ip >> 16) & 0x000000FF
                        
ips[2] = (ip >> 8) & 0x000000FF
                        
ips[3] = ip 0x000000FF
                        
Format(sBuffersizeof(sBuffer), "%d.%d.%d.%d:%d"ips[0], ips[1], ips[2], ips[3], port); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{SERVERIP}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{SERVERNAME}") != -1
                    { 
                        
GetConVarString(FindConVar("hostname"), sBuffersizeof(sBuffer)); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{SERVERNAME}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{ADMINSONLINE}") != -1
                    { 
                        
LoopClients(x
                        { 
                            if (
IsValidPlayer(x) && IsPlayerAdmin(x)) 
                            { 
                                if (
sAdminList[0] == 0)Format(sAdminListsizeof(sAdminList), "'%N'"x); 
                                else 
Format(sAdminListsizeof(sAdminList), "%s,'%N'"sAdminListx); 
                            } 
                        } 
                        
ReplaceString(lines[line], sizeof(lines[]), "{ADMINSONLINE}"sAdminList); 
                    } 
                    if (
StrContains(lines[line], "{TIMELEFT}") != -1
                    { 
                        
int i_Minutes
                        
int i_Seconds
                        
int i_Time
                        if (
GetMapTimeLeft(i_Time) && i_Time 0
                        { 
                            
i_Minutes i_Time 60
                            
i_Seconds i_Time 60
                        } 
                        
Format(sBuffersizeof(sBuffer), "%d:%02d"i_Minutesi_Seconds); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{TIMELEFT}"sBuffer); 
                    } 
                    if (
StrContains(lines[line], "{PLAYERNAME}") != -1
                    { 
                        
Format(sBuffersizeof(sBuffer), "%N"i); 
                        
ReplaceString(lines[line], sizeof(lines[]), "{PLAYERNAME}"sBuffer); 
                    } 
                    
g_hMessages.GetString("type"sTypesizeof(sType), "T"); 
                    if (
StrEqual(sType"T"false)) 
                    { 
                        
CPrintToChat(i"%s %s"g_sTaglines[line]); 
                    } 
                     
                    if (
StrEqual(sType"C"false)) 
                    { 
                        
PrintHintText(i"%s"lines[line]); 
                    } 
                } 
            } 
        } 
    } 


public 
LoadMessages() 

    
g_hMessages = new KeyValues("ServerAdvertisement"); 
    if (!
FileExists(FILE_PATH)) 
    { 
        
SetFailState("[ServerAdvertisement] '%s' not found!"FILE_PATH); 
        return; 
    } 
    
g_hMessages.ImportFromFile(FILE_PATH); 
    if (
g_hMessages.JumpToKey("Messages")) 
    { 
        
g_hMessages.GotoFirstSubKey(); 
    } 

public 
LoadConfig() 

    
KeyValues hConfig = new KeyValues("ServerAdvertisement"); 
    if (!
FileExists(FILE_PATH)) 
    { 
        
SetFailState("[ServerAdvertisement] '%s' not found!"FILE_PATH); 
        return; 
    } 
    
hConfig.ImportFromFile(FILE_PATH); 
    if (
hConfig.JumpToKey("Settings")) 
    { 
        
g_iEnable hConfig.GetNum("Enable"); 
        
g_fMessageDelay hConfig.GetFloat("Delay_between_messages"); 
        
hConfig.GetString("Time_Format"g_sTimesizeof(g_sTime)); 
        
hConfig.GetString("Advertisement_tag"g_sTagsizeof(g_sTag)); 
    } 
    else 
    { 
        
SetFailState("Config for 'Server Advertisement' not found!"); 
        return; 
    } 
    
delete hConfig

stock bool IsValidPlayer(int clientbool alive false

    if (
client >= && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && (alive == false || IsPlayerAlive(client))) { 
        return 
true
    } 
    return 
false

stock bool IsPlayerAdmin(client

    if (
GetAdminFlag(GetUserAdmin(client), Admin_Generic)) 
    { 
        return 
true
    } 
    return 
false

I Have this error

SourcePawn Compiler 1.7.1
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2014 AlliedModders LLC

/groups/sourcemod/upload_tmp/textJe3Z0q.sp(4) : fatal error 182: cannot read from file: "multicolors"

Compilation aborted.
1 Error.
__________________
my11 is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 11-25-2016 , 01:30   Re: Need advertise plugin with more lines
Reply With Quote #19

You want to download morecolors.Inc, and put it on the scripting directory. Same for geoip I believe.
__________________
Arkarr is offline
my11
Member
Join Date: Feb 2015
Location: Argentina
Old 12-01-2016 , 10:45   Re: Need advertise plugin with more lines
Reply With Quote #20

i don't know how to include it
__________________
my11 is offline
Reply


Thread Tools
Display Modes

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 12:42.


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