View Single Post
Rav3n!
Junior Member
Join Date: May 2007
Location: UK
Old 05-08-2007 , 07:17   Re: [QUESTION] hud messages using stock written by jopmako
Reply With Quote #5

hello again sorry bout no reply. and thanks for thehelp

i had a look this morning before i came on to see what was up with the code and notice as you stated i hadn't hooked the event player death, and so the event headshot doesn't exist, i then added as you have stated, but then compiled using web cause i cannot work the compiler in the sourcemod sdk compiled and hello errors

so ran jopmako's code above and got the below
Code:
/home/groups/sourcemod/upload_tmp/text5UDLKQ.sp(43 -- 44) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/text5UDLKQ.sp(45) : error 021: symbol already defined: "SendMsg_TextMsg"
/home/groups/sourcemod/upload_tmp/text5UDLKQ.sp(46) : error 010: invalid function or declaration
i looked and thought hmmmmm stuff

i so new to this its funny, any ideas cause the compiler errors mean nothing cause i dont have a great understanding of the sourcepawn so it would be nice to learn from and maybe ideas and not answers to me problem would be ace

many thanks

the complete code run is below

Code:
#include <sourcemod>

public Plugin:myinfo = 
{
    name = "Plugin",
    author = "People",
    description = "A plugin",
    version = "0.0.0.1",
    url = "www.sourcemod.net"
};


// Stock written by jopmako
stock SendMsg_TextMsg(client, type, const String:szMsg[], any:...)
{
   if (strlen(szMsg) > 191){
      LogError("Disallow string len(%d) > 191", strlen(szMsg));
      return;
   }

   decl String:buffer[192];
   VFormat(buffer, sizeof(buffer), szMsg, 4);

   new Handle:hBf;
   if (!client)
      hBf = StartMessageAll("TextMsg");
   else hBf = StartMessageOne("TextMsg", client);

   if (hBf != INVALID_HANDLE)
   {
      BfWriteByte(hBf, type);
      BfWriteString(hBf, buffer);
      EndMessage();
   }
}


public OnPluginStart()
{
    HookEvent("player_death", event_headshot, EventHookMode_Pre);
}
public event_headshot(Handle:event, const String:name[], bool:dontBroadcast)
(
   if (GetEventBool(event, "headshot"))
      SendMsg_TextMsg(0, TEXTMSG_PRINTCENTER, "Headshot");
    return Plugin_Continue
}
edit: a quick one, the section

Code:
public event_headshot(Handle:event, const String:name[], bool:dontBroadcast)
(
   if (GetEventBool(event, "headshot"))
      SendMsg_TextMsg(0, TEXTMSG_PRINTCENTER, "Headshot");
    return Plugin_Continue
}
is a if then else statement and there is only the if section section of the code, this is due to the headshot event returning a boolen value one or zero, and that the reason for missing the else is due to there being no need for it because if there is no headshot that event hasn't been hooked??

Last edited by Rav3n!; 05-08-2007 at 07:32. Reason: thought about stuff
Rav3n! is offline