Hello,
I've created my CS 1.6 server with AMX MOD X (latest) and MetaMod (latest) and i've installed many plugins without problems. I know a little bit about plugins (sma source file scripting and working with resources (mdl, sprites and so one), and compiled .amxx file that is specified into the plugins.ini file)
What i want to achieve is to color bullet hole on the wall after every shooting with any kind of weapon.
Why to do it via a plugin ?
I don't want to do it via decals.wad file (cause it needs to be done on client side, not on server if i'm correct. I'm said that because i've already changed decals.wad on my server and nothing occurs for me and others)
I've never found a plugin to do this but in my memory, it existed. Maybe the Paint Ball Decals plugin (by Krot@l,
http://www.amxmod.net/forum/showthread.php?tid=421) but it's in .amx format and not .amxx and the AMX Mod backwards compatibility layer doesn't seem to solve the problem (to allow runing this plugin)
Except Paint Ball Mod which is full mod and which includes colored bullet holes, I just want colored bulletHoles
and not weapons, models etc...
The result I want is like that :
So i'm newbie in AMXX scripting. I've analyzed paintball mod and extract the interesting parts. It works with a .spr file which contain the "splash" (view paintball.zip) and theses parts :
For the pre-caching :
Code:
precache_model("sprites/paintball.spr");
For the rendering :
Code:
public fw_touch(bullet, ent)
{
engfunc(EngFunc_SetModel, bullet, "sprites/paintball.spr");
}
I've tried to analyze Krot@l one .sma file but it's including VexdUM which is not AMX Mod X compatible
Code:
#include <amxmod>
#include <VexdUM>
#define MAX_DECALS 7 // edit here the maximum number of decals
new g_lastWeapon[33]
new g_lastAmmo[33]
new g_cvar_paintball_decals
new g_decalsnum
new g_decals[MAX_DECALS]
public plugin_init() {
register_plugin("Paint Ball (Decals)", "0.1", "KRoT@L")
g_cvar_paintball_decals = register_cvar("paintball_decals", "1")
register_event("CurWeapon", "eventCurWeapon", "be", "1=1", "3!-1")
new const decalsNames[MAX_DECALS][] = {
"{spit1",
"{spit2", // default
"{break1",
"{break2",
"{break3", // default
"{smscorch1", // default
"{smscorch2"
//"{gaussshot1"
}
new decal
for(new i = 0; i < MAX_DECALS; i++) {
g_decals[g_decalsnum++] = ((decal = get_decal_index(decalsNames[i])) > 0) ? decal : 0
}
}
public eventCurWeapon(id) {
if(get_cvarptr_num(g_cvar_paintball_decals) > 0) {
new weaponID = read_data(2)
new ammo = read_data(3)
const BITS_SKIPPED_WEAPONS = ((1<<CSW_KNIFE)|(1<<CSW_HEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_C4))
if(((1<<weaponID) & BITS_SKIPPED_WEAPONS) == 0 && weaponID == g_lastWeapon[id] && ammo < g_lastAmmo[id])
{
new origin[3]
get_user_origin(id, origin, 3)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY, origin)
write_byte(TE_WORLDDECAL)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_byte(g_decals[random(g_decalsnum)])
message_end()
}
g_lastWeapon[id] = weaponID
g_lastAmmo[id] = ammo
}
}
but didn't manage to reproduce it in correct format
I think it's easy for advanced AMXX developers, that's why i need help because i find this forum really useful when i need help (many interseting threads)