AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Why error? (https://forums.alliedmods.net/showthread.php?t=45732)

Rolnaaba 10-10-2006 10:17

Why error?
 
I am getting this error
Code:

Welcome to the AMX Mod X 1.75-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
Error: Invalid expression, assumed zero on line 23
Error: Invalid expression, assumed zero on line 24
Error: Invalid expression, assumed zero on line 25
Error: Invalid expression, assumed zero on line 26
Error: Invalid expression, assumed zero on line 27
Error: Invalid expression, assumed zero on line 28
Error: Invalid expression, assumed zero on line 29
Error: Invalid expression, assumed zero on line 30
Error: Expected token: ",", but found "}" on line 83
Error: Expected token: ",", but found "}" on line 89
10 Errors.
Could not locate output file C:\Documents and Settings\bakerstudent\Desktop\sounds.amx (compile failed).

with this code:
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> //Un-conment for FirstDamaSound to work //new bool:DamageDone new bool:FirstDeathDone // Un-conment for FirstDamageSound to work (need your own sound file) //new const FirstDamageSound[] = "sounds/YourSoundFile.mp3" new const KnifeDeathSound[] = "sounds/idiotsong.mp3" new const AdminDieSound[] = "sounds/wtf.mp3" new const FreezeTimeEndSound[] = "sounds/nam1.mp3" new const DisconnectSound[] = "sounds/thanks.mp3" new const FirstDeathSound[] = "sounds/kenny1.mp3" new const AdminDieSound3[] = "sounds/pray.mp3" new const AdminDieSound5[] = "sounds/bendover.mp3" new const Kill3Sound[] = "sounds/kickass1.mp3" public plugin_precache() {  // Un-conment for FirstDamageSound  //precache_generic(szFirstDamageSound[])  precache_generic(KnifeDeathSound)  precache_generic(AdminDieSound)  precache_generic(FreezeTimeEndSound)  precache_generic(DisconnectSound)  precache_generic(FirstDeathSound)  precache_generic(AdminDieSound3)  precache_generic(AdminDieSound5)  precache_generic(Kill3Sound) } public plugin_init() {  register_plugin("Sounds", "1.0", "Rolnaaba")    register_event("HLTV", "newround", "a", "1=0", "2=0")  // Un-conment for FirstDamageSound  //register_event("Damage", "FirstDamage", "a")  register_event("DeathMsg", "Death", "a", "1>0")  register_logevent("logevent_round_start", 2, "1=Round_Start") } public newround(id) { //sets variables that control first_damage, and first_death sounds to false  // Un-conment for FirstDamageSound  //DamageDone = false  FirstDeathDone = false } // Un-conment for FirstDamageSound: //public FirstDamage(id) { //is called whenever dmaage is dealt // if (DamageDone == false) {//checks if damage has been done already //  client_cmd(0, "mp3 play %s", FirstDamageSound) //plays first damage sound //  DamageDone = true //makes sure this only happens on first damage (per round) // } //} public Death() { //is called upon death of anyone  new WeaponName[20]  new WeaponID = get_weaponid(WeaponName)    new killer = read_data(1)  new victim = read_data(2)      read_data(4, WeaponName, 19)      if(WeaponID == CSW_KNIFE) { //checks if Death was result of knife   client_cmd(0, "mp3 play %s", KnifeDeathSound) //plays knife death sound     set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)   show_hudmessage(0, "Someone has died by the KNIFE!!")  }  else if(FirstDeathDone == false) { //if death wasnt result of knife, and is first death continues   client_cmd(0, "mp3 play %s", FirstDeathSound) //plays First death sound     FirstDeathDone = true //makes sure only plays first death sound once per round     set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)   show_hudmessage(0, "The first death has taken place!")  }  else if(access(victim, ADMIN_LEVEL_B) && get_user_deaths(victim) == 1) { //checks access level of the victim   client_cmd(0, "mp3 play %s", AdminDieSound) //plays Admin death sound     set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)   show_hudmessage(0, "The Admin has Died!!"  }  else if(access(victim, ADMIN_LEVEL_B) && get_user_deaths(victim) == 3) {   client_cmd(0, "mp3 play %s", AdminDieSound3)     set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)   show_hudmessage(0, "The Admin has Died for the Third TIME!!"  }  else if(access(victim, ADMIN_LEVEL_B) && get_user_deaths(victim) == 5) {   client_cmd(0, "mp3 play %s", AdminDieSound5)     set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)   show_hudmessage(0, "The Admin has died for the Fifth TIME!!")  }  else if(get_user_frags(killer) == 3) {   client_cmd(0, "mp3 play %s", Kill3Sound)  } } public logevent_round_start() { //is called at end of freeze time  client_cmd(0, "mp3 play %s", FreezeTimeEndSound) //plays freeze time end sound } public client_disconnect(id) { //is called when someone disconnects  client_cmd(0, "mp3 play %s", DisconnectSound) //plays disconnect sound }

Error is on precache_generic lines (all of them) it is not coments, absence of the arrays or anything I can find so why am I getting this error?

teame06 10-10-2006 10:21

Re: Why error?
 
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> //Un-conment for FirstDamaSound to work //new bool:DamageDone new bool:FirstDeathDone // Un-conment for FirstDamageSound to work (need your own sound file) //new const FirstDamageSound[] = "sounds/YourSoundFile.mp3" new KnifeDeathSound[] = "sounds/idiotsong.mp3" new AdminDieSound[] = "sounds/wtf.mp3" new FreezeTimeEndSound[] = "sounds/nam1.mp3" new DisconnectSound[] = "sounds/thanks.mp3" new FirstDeathSound[] = "sounds/kenny1.mp3" new AdminDieSound3[] = "sounds/pray.mp3" new AdminDieSound5[] = "sounds/bendover.mp3" new Kill3Sound[] = "sounds/kickass1.mp3" public plugin_precache() {  // Un-conment for FirstDamageSound  //precache_generic(szFirstDamageSound[])  precache_generic(KnifeDeathSound)  precache_generic(AdminDieSound)  precache_generic(FreezeTimeEndSound)  precache_generic(DisconnectSound)  precache_generic(FirstDeathSound)  precache_generic(AdminDieSound3)  precache_generic(AdminDieSound5)  precache_generic(Kill3Sound) } public plugin_init() {  register_plugin("Sounds", "1.0", "Rolnaaba")  register_event("HLTV", "newround", "a", "1=0", "2=0")  // Un-conment for FirstDamageSound  //register_event("Damage", "FirstDamage", "a")  register_event("DeathMsg", "Death", "a", "1>0")  register_logevent("logevent_round_start", 2, "1=Round_Start") } public newround(id) { //sets variables that control first_damage, and first_death sounds to false  // Un-conment for FirstDamageSound  //DamageDone = false  FirstDeathDone = false } // Un-conment for FirstDamageSound: //public FirstDamage(id) { //is called whenever dmaage is dealt // if (DamageDone == false) {//checks if damage has been done already //  client_cmd(0, "mp3 play %s", FirstDamageSound) //plays first damage sound //  DamageDone = true //makes sure this only happens on first damage (per round) // } //} public Death() { //is called upon death of anyone  new WeaponName[20]  new WeaponID = get_weaponid(WeaponName)  new killer = read_data(1)  new victim = read_data(2)  read_data(4, WeaponName, 19)  if(WeaponID == CSW_KNIFE) { //checks if Death was result of knife   client_cmd(0, "mp3 play %s", KnifeDeathSound) //plays knife death sound   set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)   show_hudmessage(0, "Someone has died by the KNIFE!!")  }  else if(FirstDeathDone == false) { //if death wasnt result of knife, and is first death continues   client_cmd(0, "mp3 play %s", FirstDeathSound) //plays First death sound   FirstDeathDone = true //makes sure only plays first death sound once per round   set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)   show_hudmessage(0, "The first death has taken place!")  }  else if(access(victim, ADMIN_LEVEL_B) && get_user_deaths(victim) == 1) { //checks access level of the victim   client_cmd(0, "mp3 play %s", AdminDieSound) //plays Admin death sound   set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)   show_hudmessage(0, "The Admin has Died!!")  }  else if(access(victim, ADMIN_LEVEL_B) && get_user_deaths(victim) == 3) {   client_cmd(0, "mp3 play %s", AdminDieSound3)   set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)   show_hudmessage(0, "The Admin has Died for the Third TIME!!")  }  else if(access(victim, ADMIN_LEVEL_B) && get_user_deaths(victim) == 5) {   client_cmd(0, "mp3 play %s", AdminDieSound5)   set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)   show_hudmessage(0, "The Admin has died for the Fifth TIME!!")  }  else if(get_user_frags(killer) == 3) {   client_cmd(0, "mp3 play %s", Kill3Sound)  } } public logevent_round_start() { //is called at end of freeze time  client_cmd(0, "mp3 play %s", FreezeTimeEndSound) //plays freeze time end sound } public client_disconnect(id) { //is called when someone disconnects  client_cmd(0, "mp3 play %s", DisconnectSound) //plays disconnect sound }

I'm not sure why it doesn't like new const ... but once I took that out it compile fine

Rolnaaba 10-10-2006 10:22

Re: Why error?
 
*sigh* i thought so, the variables would remain global since they are outside all functions right?

ty teame06 :)


All times are GMT -4. The time now is 04:53.

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