hello, everyone ... I would like some help with this plugin ... I would like you to explore a way of buying it ... example "say /teleport"...for a certain amount .... since already thank you very much to all.
/* AMX Mod X
* Teleport Smoke Grenade
*
* (c) Copyright 2006 by VEN
*
* This file is provided as is (no warranties)
*
* DESCRIPTION
* Plugin changes the smoke grenade to teleport grenade with a bit of smoke.
* Usage: drop the grenade, you will be teleported to the spot of explosion.
* Try to crouch if the height of the spot are small for uncrouched player.
*
* CREDITS
* Dread Pirate - idea
*/
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#define PLUGIN_NAME "Smoke Grenade Modes"
#define PLUGIN_VERSION "0.2"
#define PLUGIN_AUTHOR "VEN"
#define SMOKE_SCALE 30
#define SMOKE_FRAMERATE 12
#define SMOKE_GROUND_OFFSET 6
#define IsPlayer(%1) (1 <= %1 <= gMaxClients)
// do not edit
new const g_sound_explosion[] = "weapons/sg_explode.wav"
new const g_classname_grenade[] = "grenade"
new const Float:g_sign[4][2] = {{1.0, 1.0}, {1.0, -1.0}, {-1.0, -1.0}, {-1.0, 1.0}}
new g_spriteid_steam1;
//new g_eventid_createsmoke;
new gMaxClients;
enum GrenadeType{
GRENADE_NORMAL,
GRENADE_TELEPORT
}
new GrenadeType:mode[33] = { GRENADE_NORMAL, ... }
new modetext[][] = {"Smoke grenade", "Teleport Grenade"}
public plugin_init(){
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_forward(FM_EmitSound, "forward_emitsound")
register_event("CurWeapon", "armnade", "b", "1=1", "2=9");
register_forward(FM_CmdStart, "fw_cmdstart");
gMaxClients = get_maxplayers();
// we do not precaching, but retrieving the indexes
g_spriteid_steam1 = engfunc(EngFunc_PrecacheModel, "sprites/steam1.spr")
//g_eventid_createsmoke = engfunc(EngFunc_PrecacheEvent, 1, "events/createsmoke.sc")
}
public armnade(id){
if(IsPlayer(id) && is_user_alive(id))
client_print(id, print_center, "Mode: %s", modetext[_:mode[id]]);
//changemode(id);
return PLUGIN_CONTINUE;
}
public fw_cmdstart(id, uc_handle, seed){
static bool:key[33] = { false, ... }
if (!IsPlayer(id) || !is_user_alive(id)) return FMRES_IGNORED
static buttons
buttons = get_uc(uc_handle, UC_Buttons)
if ((buttons & IN_ATTACK2))
{
if (!key[id])
{
if (get_user_weapon(id) == CSW_SMOKEGRENADE)
{
changemode(id)
}
}
key[id] = true
}
else
{
key[id] = false
}
return FMRES_IGNORED
}
public changemode(id){
if (!IsPlayer(id) || !is_user_alive(id)) return;
if(cs_get_user_shield(id))
return;
/*if(false)// mode enabled
{
changemode(id)
return
}*/
++mode[id];
switch (mode[id])
{
case GRENADE_NORMAL:
{
client_print(id, print_center, "Smoke grenade")
}
case GRENADE_TELEPORT:
{
client_print(id, print_center, "Teleport Grenade")
}
default:
{
mode[id] = GRENADE_NORMAL
client_print(id, print_center, "Smoke grenade")
}
}
}
public forward_emitsound(ent, channel, const sound[]) {
if (!pev_valid(ent) || !equal(sound, g_sound_explosion) || !is_grenade(ent))
return FMRES_IGNORED;
static id, Float
rigin[3]
id = pev(ent, pev_owner);
if (!IsPlayer(id) || !is_user_alive(id)) return FMRES_IGNORED;
if(mode[id]!=GRENADE_TELEPORT)
return FMRES_IGNORED;
pev(ent, pev_origin, origin)
engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, g_sound_explosion, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
engfunc(EngFunc_SetOrigin, ent, Float:{8191.0, 8191.0, 8191.0})
origin[2] += SMOKE_GROUND_OFFSET
create_smoke(origin)
static Float:mins[3], hull
pev(id, pev_mins, mins)
origin[2] -= mins[2] + SMOKE_GROUND_OFFSET
hull = pev(id, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
if (is_hull_vacant(origin, hull))
engfunc(EngFunc_SetOrigin, id, origin)
else { // close to a solid object, trying to find a vacant spot
static Float:vec[3]
vec[2] = origin[2]
for (new i; i < sizeof g_sign; ++i) {
vec[0] = origin[0] - mins[0] * g_sign[i][0]
vec[1] = origin[1] - mins[1] * g_sign[i][1]
if (is_hull_vacant(vec, hull)) {
engfunc(EngFunc_SetOrigin, id, vec)
break
}
}
}
return FMRES_SUPERCEDE
}
bool:is_grenade(ent) {
if (!pev_valid(ent))
return false
static classname[sizeof g_classname_grenade + 1]
pev(ent, pev_classname, classname, sizeof g_classname_grenade)
if (equal(classname, g_classname_grenade))
return true
return false
}
create_smoke(const Float
rigin[3]) {
// engfunc because origin are float
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
write_byte(TE_SMOKE)
engfunc(EngFunc_WriteCoord, origin[0])
engfunc(EngFunc_WriteCoord, origin[1])
engfunc(EngFunc_WriteCoord, origin[2])
write_short(g_spriteid_steam1)
write_byte(SMOKE_SCALE)
write_byte(SMOKE_FRAMERATE)
message_end()
}
stock bool:is_hull_vacant(const Float
rigin[3], hull) {
new tr = 0
engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, tr)
if (!get_tr2(tr, TR_StartSolid) && !get_tr2(tr, TR_AllSolid) && get_tr2(tr, TR_InOpen))
return true
return false
}