My friend sended a plugin that shows 3 Colored HUD lines in when the map starts. It looks like this :
Now i would like to make people see a message with a big colored "WELCOME {NAME}" in the center of the screen, as soon as a player joins the server.
Anyone who can help me? is it a simple edit in the smx or? 10$ who helps me, paypal required
PHP Code:
#pragma semicolon 1
#include <sourcemod>
//#define MAX_PLAYERS 8
#define NUMBER_OF_MESSAGES 3
new Handle:hHudText = INVALID_HANDLE;
new number_of_color_schemes;
new SchemeColor[3*NUMBER_OF_MESSAGES];
new String:message1[128];
new String:message2[128];
new String:message3[128];
new String:lineBuf[128];
public Plugin:myinfo = {
name = "Asbi Announcer",
author = "Mad Orange",
description = "Asbi difficulty announcer+",
version = "0.2",
url = "n/a"
};
public OnPluginStart()
{
HookEvent("marine_selected", MarineSelected);
decl String:path[PLATFORM_MAX_PATH];
BuildPath(Path_SM, path, sizeof(path), "configs/asbi_announce.cfg");
new Handle:file = OpenFile(path, "r");
if (file == INVALID_HANDLE)
{
PrintToServer("asbi_announce.cfg is missing!");
return;
}
ReadFileLine(file, message1, sizeof(message1));
ReadFileLine(file, message2, sizeof(message2));
ReadFileLine(file, message3, sizeof(message3));
ReadFileLine(file, lineBuf, sizeof(lineBuf)); //first empty line
ReadFileLine(file, lineBuf, sizeof(lineBuf));
number_of_color_schemes = StringToInt(lineBuf);
ReadFileLine(file, lineBuf, sizeof(lineBuf)); //second empty line
//chosing random position of color scheme
new offset = GetRandomInt(0, number_of_color_schemes-1)*4-1;
// PrintToChatAll("%d", offset);
for(new i=0; i<offset; i++)
{
ReadFileLine(file, lineBuf, sizeof(lineBuf));
}
///Getting NUMBER_OF_MESSAGES number lines in string array
decl String:SchemeColorStrings[3*NUMBER_OF_MESSAGES][4]; //red1, green1, blue1, red2, green2, blue2, red3, green3, blue3 etc
new j=0;
for(new ColSchemeLinesCounter=0; ColSchemeLinesCounter<NUMBER_OF_MESSAGES; ColSchemeLinesCounter++)
{
ReadFileLine(file, lineBuf, sizeof(lineBuf));
new LinePartCounter=0;
for (new i=0; lineBuf[i] != '\n', lineBuf[i+1] != '\0'; i++)
{
if (lineBuf[i] == ' ')
{
SchemeColorStrings[j][LinePartCounter] = '\0';
j++;
LinePartCounter = 0;
}
else
{
SchemeColorStrings[j][LinePartCounter] = lineBuf[i];
LinePartCounter++;
}
}
SchemeColorStrings[j][LinePartCounter] = '\0';
j++;
}
//String array->usial array
for(new i=0; i<3*NUMBER_OF_MESSAGES; i++)
{
SchemeColor[i] = StringToInt(SchemeColorStrings[i]);
}
CloseHandle(file);
}
public Action:MarineSelected(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
//timers to show messages after some delay
CreateTimer(1.5, PrintMsg1, client);
CreateTimer(3.0, PrintMsg2, client);
CreateTimer(4.5, PrintMsg3, client);
CreateTimer(10.0, HandleCloseFunc, client);
return Plugin_Handled;
}
public Action:PrintMsg1(Handle:timer, any:client)
{
hHudText = CreateHudSynchronizer();
SetHudTextParams(-1.0, 0.76, 5.0, SchemeColor[0], SchemeColor[1], SchemeColor[2], 255, 1, 2.0, 0.5, 0.5);
ShowSyncHudText(client, hHudText, message1);
return Plugin_Continue;
}
public Action:PrintMsg2(Handle:timer, any:client)
{
hHudText = CreateHudSynchronizer();
SetHudTextParams(-1.0, 0.80, 5.0, SchemeColor[3], SchemeColor[4], SchemeColor[5], 255, 1, 2.0, 0.5, 0.5);
ShowSyncHudText(client, hHudText, message2);
return Plugin_Continue;
}
public Action:PrintMsg3(Handle:timer, any:client)
{
hHudText = CreateHudSynchronizer();
SetHudTextParams(-1.0, 0.84, 5.0, SchemeColor[6], SchemeColor[7], SchemeColor[8], 255, 1, 2.0, 0.5, 0.5);
ShowSyncHudText(client, hHudText, message3);
return Plugin_Continue;
}
public Action:HandleCloseFunc(Handle:timer, any:client)
{
CloseHandle(hHudText);
return Plugin_Continue;
}