allow to get current kill message from cube script + more checks
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6231 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -697,21 +697,17 @@ void dodamage(int damage, playerent *pl, playerent *actor, int gun, bool gib, bo
|
||||
|
||||
void setkillmessage(int gun, bool gib, const char *message)
|
||||
{
|
||||
if(!message || !*message)
|
||||
{
|
||||
result(killmessage(gun, gib));
|
||||
return;
|
||||
}
|
||||
|
||||
if(gun < 0 || gun >= NUMGUNS)
|
||||
{
|
||||
conoutf("invalid gun specified");
|
||||
return;
|
||||
}
|
||||
if(strlen(message)==0)
|
||||
{
|
||||
conoutf("invalid message");
|
||||
return;
|
||||
}
|
||||
if(strlen(message)>MAXKILLMSGLEN)
|
||||
{
|
||||
conoutf("message is too long (max len is %i)", MAXKILLMSGLEN);
|
||||
return;
|
||||
}
|
||||
|
||||
if(gib) formatstring(gibmessages[gun])("%s", message);
|
||||
else formatstring(fragmessages[gun])("%s", message);
|
||||
|
||||
@@ -619,6 +619,8 @@ extern char fragmessages[NUMGUNS][MAXKILLMSGLEN];
|
||||
extern char gibmessages[NUMGUNS][MAXKILLMSGLEN];
|
||||
inline char *killmessage(int gun, bool gib = false)
|
||||
{
|
||||
if(gun<0 || gun>=NUMGUNS) return "";
|
||||
|
||||
if(gib) return gibmessages[gun];
|
||||
else return fragmessages[gun];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user