Author
|
Message
|
Senior Member
Join Date: Feb 2010
Location: Norway
|
11-09-2015
, 10:00
replacing texts/adding color to them.
|
#1
|
Trying to add a colored prefix to a jumpstats plugin with another plugin, Bacardi made the code I just swapped SM with JS,
Quote:
#include <sourcemod>
public OnPluginStart()
{
HookUserMessage(GetUserMessageId("TextMsg"), TextMsg, true);
}
public Action:TextMsg(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init)
{
if(reliable)
{
new String:buffer[256];
BfReadString(bf, buffer, sizeof(buffer));
if(StrContains(buffer, "\x03[JS]") == 0)
{
new Handle:pack;
CreateDataTimer(0.0, timer_strip, pack);
WritePackCell(pack, playersNum);
for(new i = 0; i < playersNum; i++)
{
WritePackCell(pack, players[i]);
}
WritePackString(pack, buffer);
ResetPack(pack);
return Plugin_Handled;
}
}
return Plugin_Continue;
}
public Action:timer_strip(Handle:timer, Handle:pack)
{
new playersNum = ReadPackCell(pack);
new players[playersNum];
for(new i = 0; i < playersNum; i++)
{
players[i] = ReadPackCell(pack);
}
new String:buffer[256];
ReadPackString(pack, buffer, sizeof(buffer));
ReplaceStringEx(buffer, sizeof(buffer), "[JS]", "\x05[JS]\x01");
new Handle:bf = StartMessage("TextMsg", players, playersNum);
BfWriteString(bf, buffer);
EndMessage();
}
|
It complied but everytime I jump and its printing the message(Nothin happens to the message no change at all), I get a error in the console,
Quote:
L 11/09/2015 - 15:56:55: [SM] [0] Line 13, C:\steamcmd\csgo\csgo\addons\sourc
emod\scripting\colorjumpstats.sp::TextMsg()
L 11/09/2015 - 15:56:55: [SM] Plugin encountered error 21: Native is not bound
L 11/09/2015 - 15:56:55: [SM] Native "BfReadString" reported:
L 11/09/2015 - 15:56:55: [SM] Displaying call stack trace for plugin "colorjumps
tats.smx":
|
What did I do wrong?
|
|
|
|