I was trying to make a plugin a complement to the Hide and Seek
for the players has transformed into objects
The idea came from the super hero mod morph
I created a menu is not know if it worked
I'm new to create plugins do not know much
The mistake he made was that
[IMG]http://img100.**************/img100/5271/dasdasz.jpg[/IMG]
And there is the contents of my plugin
Code:
#include <amxmod>
#include <Vexd_Utilities>
{
register_plugin("Box","1.0"
register_clcmd("say teste", "display_menu")
}
// GLOBAL VARIABLES
new gWoodSound[3][] = {
"debris/wood1.wav",
"debris/wood2.wav",
"debris/wood3.wav"
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
precache_model("models/player/box/box.mdl")
precache_sound("debris/bustcrate1.wav")
precache_sound("debris/bustcrate2.wav")
// TBD - SOUNDS!
for (new x = 0; x < 3; x++) {
precache_sound(gWoodSound[x])
}
}
}
public display_menu(id) {
new menuBody[512]
add(menuBody, 511, "\rObjetos\w^n^n")
add(menuBody, 511, "1. Box \y(Tranformar em caixa)\w^n")
add(menuBody, 511, "0. Exit^n")
new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )
show_menu(id, keys, menuBody, -1, "Objetos")
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
gPlayerUltimateUsed[id] = false
}
//----------------------------------------------------------------------------------------------
// RESPOND TO KEYDOWN
public morph_kd()
{
// First Argument is an id
new temp[6]
read_argv(1,temp,5)
new id = str_to_num(temp)
if ( !is_user_alive(id) ) return
if ( get_cvar_num("morph_toggle") && gMorphed[id] && !gPlayerUltimateUsed[id] ) {
morph_unmorph(id)
return
}
// Let them know they already used their ultimate if they have
if ( gPlayerUltimateUsed[id] || gMorphed[id] ) {
playSoundDenySelect(id)
return
}
morph_morph(id)
new Float:morphMaxTime = get_cvar_float("morph_maxtime")
if (morphMaxTime > 0.0) set_task(morphMaxTime, "forceUnmorph", id)
}
//----------------------------------------------------------------------------------------------
public morph_morph(id)
{
if ( !is_user_alive(id) || gMorphed[id] ) return
#if defined AMXX_VERSION
cs_set_user_model(id, "box")
#else
CS_SetModel(id, "box")
#endif
switchmodel(id)
emit_sound(id, CHAN_AUTO, "debris/bustcrate2.wav", 0.4, ATTN_NORM, 0, PITCH_NORM)
gMorphed[id] = true
// Message
set_hudmessage(200, 200, 0, -1.0, 0.45, 2, 0.02, 3.0, 0.01, 0.1, 86)
show_hudmessage(id, "Morph - YOU SHAPESHIFTED INTO A CRATE")
}
//----------------------------------------------------------------------------------------------
public morph_unmorph(id)
{
if ( gMorphed[id] ) {
#if defined AMXX_VERSION
cs_reset_user_model(id)
#else
CS_ClearModel(id)
#endif
switchmodel(id)
emit_sound(id, CHAN_AUTO, "debris/bustcrate1.wav", 0.8, ATTN_NORM, 0, PITCH_NORM)
set_hudmessage(200, 200, 0, -1.0, 0.45, 2, 0.02, 3.0, 0.01, 0.1, 86)
show_hudmessage(id, "Morph - RETURNED TO SELF")
gMorphed[id] = false
new Float:MorphCooldown = get_cvar_float("morph_cooldown")
if ( MorphCooldown > 0.0 ) ultimateTimer(id, MorphCooldown)
remove_task(id)
}
}
//----------------------------------------------------------------------------------------------
public switchmodel(id)
{
if ( !is_user_alive(id) || !gHasMorphPower[id] ) return
if ( gMorphed[id] ) {
//remove p_weapon model since you are a crate
//if another hero sets a custom p_ model this may not remove it
Entvars_Set_String(id, EV_SZ_weaponmodel, "")
}
else {
//reset the p_weapon model, best way to change it bug free by checking weapon name
//custom p_ models will replace default model after first shot fired
new wpn[32], p_mdl[40], v_mdl[32]
new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
if (wpnid > 0) {
if (wpnid == 19) {
//set p_ model back if mp5
Entvars_Set_String(id, EV_SZ_weaponmodel, "models/p_mp5.mdl")
}
else {
//need to check for a shield
Entvars_Get_String(id, EV_SZ_viewmodel, v_mdl, 31)
if ( containi(v_mdl, "v_shield_") != -1 && wpnid != 10 ) {
get_weaponname(wpnid, wpn, 31)
replace(wpn, 31, "weapon", "p_shield")
format(p_mdl, 39, "models/shield/%s.mdl", wpn)
}
else {
get_weaponname(wpnid, wpn, 31)
replace(wpn, 31, "weapon", "p")
format(p_mdl, 39, "models/%s.mdl", wpn)
}
//set p_ model back
Entvars_Set_String(id, EV_SZ_weaponmodel, p_mdl)
}
}
}
}
//----------------------------------------------------------------------------------------------
public weaponChange(id)
{
if ( !gHasMorphPower[id] || !shModActive() || !is_user_alive(id) || !gMorphed[id] ) return
switchmodel(id)
}
//----------------------------------------------------------------------------------------------
public morph_death()
{
new id = read_data(2)
if( !gHasMorphPower[id] ) return
morph_unmorph(id)
}
//----------------------------------------------------------------------------------------------
public forceUnmorph(id)
{
if ( !is_user_connected(id) ) return
client_print(id, print_chat, "[SH](Morph) Shapeshifting power has worn out")
morph_unmorph(id)
}
//----------------------------------------------------------------------------------------------
public morph_damage(id)
{
if (!shModActive() || !is_user_alive(id) || !gMorphed[id] ) return
new attacker = get_user_attacker(id)
if ( attacker <= 0 || attacker > SH_MAXSLOTS ) return
if ( is_user_alive(id) && id != attacker && gMorphed[id] ) {
new num = random_num(0, 2)
playSound(id, num)
}
}
//----------------------------------------------------------------------------------------------
public playSound(id, num)
{
emit_sound(id, CHAN_STATIC, gWoodSound[num], 1.0, ATTN_NORM, 0, PITCH_HIGH)
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
gMorphed[id] = false
}
//----------------------------------------------------------------------------------------------
If there is anything wrong forgive me
If possible tell me oque is wrong
If you want to continue the plugin can give, if possible
And sorry for bad english
I am Brazilian and I do not know very well the english
I used Google translator to help m