Raised This Month: $ Target: $400
 0% 

cant compile simple code ..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
avril-lavigne
Banned
Join Date: Apr 2009
Old 09-03-2012 , 18:15   cant compile simple code ..
Reply With Quote #1

PHP Code:
 #include <amxmodx> 
#include <hamsandwich>
#include <cstrike>
#include <fakemeta> 
#include <engine>


new const oldknife_sounds[][] =
{
"weapons/knife_deploy1.wav",    // Deploy Sound
"weapons/knife_hit1.wav",    // Hit 1
"weapons/knife_hit2.wav",    // Hit 2
"weapons/knife_hit3.wav",    // Hit 3
"weapons/knife_hit4.wav",    // Hit 4
"weapons/knife_hitwall1.wav",    // Hit Wall
"weapons/knife_slash1.wav",    // Slash 1
"weapons/knife_slash2.wav",    // Slash 2
"weapons/knife_stab.wav",
"common/wpn_select.wav" 
}


const 
m_pPlayer 41

public plugin_init()
{
register_plugin("Defibrilator""1.0""skype lemishev")
register_event("CurWeapon","switchweapon","be ","1=1","2!29"
register_forward(FM_EmitSound"fw_EmitSound"
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fw_Knife_PrimaryAttack_Post"1)
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_knife""fw_Knife_SecondaryAttack_Post"1)
}

public 
plugin_precache()
{
precache_model("models/knf_new2.mdl"
precache_sound("defibrilator/knife_hit1.wav"
precache_sound("defibrilator/knife_slash1.wav" )
precache_sound("defibrilator/knife_deploy1.wav" 
}

public 
switchweapon(id)

if( 
read_data(2) == CSW_KNIFE) {
set_pev(id,pev_viewmodel2,"models/knf_new2.mdl"
client_cmd(id,"speak defibrilator/knife_deploy1.wav"
}



public 
fw_EmitSound(idchannel, const sound[])
{

if(!
is_user_alive(id))
return 
FMRES_IGNORED 



// Check sound
for(new 0sizeof oldknife_soundsi++)
{
if(
equal(soundoldknife_sounds[i]))


return 
FMRES_SUPERCEDE
}
}

return 
FMRES_IGNORED
}



public 
fw_Knife_PrimaryAttack_Post(knife)
{    

static 
id
id 
get_pdata_cbase(knifem_pPlayer4)    

if(
is_user_connected(id))
emit_sound(idCHAN_WEAPON"defibrilator/knife_hit1"VOL_NORMATTN_NORM0PITCH_NORM



}

public 
fw_Knife_SecondaryAttack_Post(knife)
{    

static 
id
id 
get_pdata_cbase(knifem_pPlayer4)


if(
is_user_connected(id))
emit_sound(idCHAN_WEAPON"defibrilator/knife_slash1"VOL_NORMATTN_NORM0PITCH_NORM




amxx studio shows me problem in FW emit sound.
i took this part from my another plugin. and it works there fine. but after removing some code I cant compile plugin
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by YamiKaitou; 09-04-2012 at 13:40.
avril-lavigne is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 09-03-2012 , 18:51   Re: cant compile simple code ..
Reply With Quote #2

I changed it a bit
Code:
#include < amxmodx >    #include < hamsandwich > #include < fakemeta >   new const oldknife_sounds[][] = {     "weapons/knife_deploy1.wav",    // Deploy Sound     "weapons/knife_hit1.wav",   // Hit 1     "weapons/knife_hit2.wav",   // Hit 2     "weapons/knife_hit3.wav",   // Hit 3     "weapons/knife_hit4.wav",   // Hit 4     "weapons/knife_hitwall1.wav",   // Hit Wall     "weapons/knife_slash1.wav", // Slash 1     "weapons/knife_slash2.wav", // Slash 2     "weapons/knife_stab.wav",     "common/wpn_select.wav"   } const m_pPlayer =    41 new Trie:g_tSounds     public plugin_init( ) {     register_plugin( "Defibrilator", "1.0", "skype lemishev" )         register_event( "CurWeapon", "switchweapon", "be", "1=1", "2!29" )      register_forward( FM_EmitSound, "forward_EmitSound" )         RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_knife", "fw_Knife_PrimaryAttack_Post", true )     RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_knife", "fw_Knife_SecondaryAttack_Post", true )         for( new i = 0; i < sizeof oldknife_sounds; i++ )         TrieSetCell( g_tSounds, oldknife_sounds[ i ], 1 ); } public plugin_precache( ) {     precache_model( "models/knf_new2.mdl" )           precache_sound( "defibrilator/knife_hit1.wav" )             precache_sound( "defibrilator/knife_slash1.wav" )     precache_sound( "defibrilator/knife_deploy1.wav" )   } public switchweapon( id ) {       if( read_data( 2 ) == CSW_KNIFE )     {         set_pev( id, pev_viewmodel2, "models/knf_new2.mdl" )           client_cmd( id, "speak defibrilator/knife_deploy1.wav" )        } } public forward_EmitSound( id, iChannel, const szSound[ ], Float:flVol, Float:flAttn, iFlags, iPitch ) {     if( TrieKeyExists( g_tSounds, szSound ) )     {         if( is_user_alive( id ) )             return FMRES_SUPERCEDE     }     return FMRES_IGNORED; } public fw_Knife_PrimaryAttack_Post( iKnife ) {         static id     id = get_pdata_cbase( iKnife, m_pPlayer, 4 )                if( is_user_connected( id ) )         emit_sound( id, CHAN_WEAPON, "defibrilator/knife_hit1", VOL_NORM, ATTN_NORM, 0, PITCH_NORM )            } public fw_Knife_SecondaryAttack_Post( iKnife ) {     static id     id = get_pdata_cbase( iKnife, m_pPlayer, 4 )     if( is_user_connected( id ) )         emit_sound( id, CHAN_WEAPON, "defibrilator/knife_slash1", VOL_NORM, ATTN_NORM, 0, PITCH_NORM )      }

Anyway your mistake was in
switchweapon(id)
You are missing some }
OvidiuS is offline
Send a message via Skype™ to OvidiuS
avril-lavigne
Banned
Join Date: Apr 2009
Old 09-03-2012 , 18:57   Re: cant compile simple code ..
Reply With Quote #3

thanks
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 09-03-2012 , 22:39   Re: cant compile simple code ..
Reply With Quote #4

your code didnt work dont know why. I replaced it with old one.
so the result is here

defibrillator
http://www.youtube.com/watch?v=qHoC0IvEfI8
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-03-2012 , 23:41   Re: cant compile simple code ..
Reply With Quote #5

Your first post says the thread has been solved . . .
__________________
fysiks is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 09-04-2012 , 13:38   Re: cant compile simple code ..
Reply With Quote #6

Ive changed 1st post after ovidius reply
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 09-04-2012 , 13:41   Re: cant compile simple code ..
Reply With Quote #7

Post restored, do not delete your posts when your issue has been resolved.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode