AlliedModders

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

stigma 10-05-2006 08:07

precaching error -
 
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #define PLUGIN "Annoucement messages" #define VERSION "1.0" #define AUTHOR "stigma" new iKill[33] = 0 new bool:FirstBlood new const WickedSickSound[] = "Announce/WhickedSick.wav" new const UnStoppableSound[] = "Announce/Unstoppable.wav" new const UltraKillSound[] = "Announce/UltraKill.wav" new const TripleKillSound[] = "Announce/Triple_kill.wav" new const TeamKillerSound[] = "Announce/Team_Killer.wav" new const SpawnKillerSound[] = "Announce/Spawn_killer.wav" new const ScoreSound[] = "Announce/Score.wav" new const RedDominateSound[] = "Announce/red_team_dominating.wav" new const RampageSound[] = "Announce/Rampage.wav" new const OwnageSound[] = "Announce/Ownage.wav" new const MultiKillSound[] = "Announce/MultiKill.wav" new const MonsterKillSound[] = "Announce/monster_kill.wav" new const KillingSpreeSound[] = "Announce/Killing_Spree.wav" new const HolyShitSound[] = "Announce/HolyShit_F.wav" new const HeadShotSound[] = "Announce/HeadShot.wav" new const HeadHunterSound[] = "Announce/HeadHunter.wav" new const GodLikeSound[] = "Announce/GodLike.wav" new const FirstBloodSound[] = "Announce/first_blood.wav" new const EagleEyeSound[] = "Announce/EagleEye.wav" new const DoubleKillSound[] = "Announce/Double_Kill.wav" new const DominatingSound[] = "Announce/Dominating.wav" new const BlueDominateSound[] = "Announce/blue_team_dominating.wav" public plugin_precache() {     precache_sound(DoubleKillSound) // Sound 2     precache_sound(TripleKillSound) // Sound 3     precache_sound(MultiKillSound) // Sound 5     precache_sound(KillingSpreeSound) // Sound 7     precache_sound(UltraKillSound) // Sound 9     precache_sound(MonsterKillSound) // Sound 10     precache_sound(DominatingSound) // Sound 12     precache_sound(GodLikeSound) // Sound 13     precache_sound(RampageSound) // Sound 15     precache_sound(WickedSickSound) // Sound 17     precache_sound(TeamKillerSound) // Team Mate killed     precache_sound(SpawnKillerSound) // Someone killed within 10 secs     precache_sound(ScoreSound) // Task     precache_sound(RedDominateSound) // Terroists is dominating     precache_sound(OwnageSound) // Team Owning     precache_sound(HolyShitSound) // 1 shot, 2 kill     precache_sound(HeadShotSound) // HeadShot     precache_sound(HeadHunterSound) // AWM Headshot     precache_sound(FirstBloodSound) // First Kill     precache_sound(EagleEyeSound) // Deagle Face     precache_sound(BlueDominateSound) // Counter-Terroists is dominating     precache_sound(UnStoppableSound) } public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("HLTV", "NewRound", "a", "1=0", "2=0")     register_event("DeathMsg","Death","a")     } public NewRound(id) {     FirstBlood = false     client_print(0,print_chat,"%d", iKill[id]) }     public Death(id) {     set_hudmessage(0, 100, 155, 0.00, 0.35, 3, 1.0, 4.0, 0.5, 0.05, 1)         new killer = read_data(1)     new victim = read_data(2)     new headshot = read_data(3)         new WeaponName[20]     new WeaponID = get_weaponid(WeaponName)     read_data(4,WeaponName,19)         new vicname[33]     get_user_name(victim,vicname,32)     new killername[33]     get_user_name(killer,killername,32)         if (get_user_team(killer) == get_user_team(victim)) {         client_cmd(0,"play %s", TeamKillerSound)         show_hudmessage(0,"%s killed a team mate!", killername)         iKill[killer] = 0                 return PLUGIN_HANDLED     }     if (get_user_team(killer) != get_user_team(victim)) {                 if (FirstBlood = false) {             client_cmd(0,"play %s", FirstBloodSound)             FirstBlood = true             iKill[killer] += 1                         set_task(0.1, "HudEvent", id)             return PLUGIN_HANDLED         }         if (headshot) {             client_cmd(0,"play %s", HeadShotSound)             show_hudmessage(id,"Headshot!")             iKill[killer] += 1             set_task(0.1, "HudEvent", id)             return PLUGIN_HANDLED         }         if (WeaponID = CSW_DEAGLE && headshot) {             client_cmd(0,"play %s", EagleEyeSound)             show_hudmessage(id,"%s has an Eagle eye!")             iKill[killer] += 1             set_task(0.1, "HudEvent", id)                         return PLUGIN_HANDLED         }                 iKill[killer] += 1             } } public HudEvent(id) {         set_hudmessage(0, 100, 155, 0.00, 0.40, 3, 1.0, 4.0, 0.5, 0.05, 2)         new killer = read_data(1)         new killername[33]     get_user_name(killer,killername,32)     if (iKill[killer] = 2) {         client_cmd(id,"play %s",DoubleKillSound)         show_hudmessage(id,"Double Kill!")     } else if (iKill[killer] = 3) {         client_cmd(id,"play %s",TripleKillSound)         show_hudmessage(id,"Triple Kill!")     } else if (iKill[killer] = 5) {         client_cmd(id,"play %s",MultiKillSound)         show_hudmessage(id,"Multi Kill!")     } else if (iKill[killer] = 7) {         client_cmd(0,"play %s",KillingSpreeSound)         show_hudmessage(0,"%s is on a Killing Spree!", killername)     } else if (iKill[killer] = 9) {         client_cmd(id,"play %s",UltraKillSound)         show_hudmessage(id,"Ultra Kill!")     } else if (iKill[killer] = 10) {         client_cmd(0,"play %s",MonsterKillSound)         show_hudmessage(0,"M-M-M-MONSTER KILL!!!")     } else if (iKill[killer] = 11) {         client_cmd(0,"play %s",DominatingSound)         show_hudmessage(0,"%s is Dominating!", killername)     } else if (iKill[killer] = 12) {         client_cmd(0,"play %s",GodLikeSound)         show_hudmessage(0,"%s is Godlike!", killername)     } else if (iKill[killer] = 14) {         client_cmd(0,"play %s",RampageSound)         show_hudmessage(0,"%s is on a Rampage!", killername)     } else if (iKill[killer] = 15) {         client_cmd(0,"play %s",WickedSickSound)         show_hudmessage(0,"WHICKED SICK!!!^n%s has killed 15 without dying!", killername)     }     return PLUGIN_CONTINUE }

Greenberet 10-05-2006 08:54

Re: precaching error -
 
use precache_sound instead of generic

but you have to remove the "sound\" part inside of the strings

VEN 10-05-2006 09:02

Re: precaching error -
 
Not if (x = a) but if (x == a)

stigma 10-05-2006 09:14

Re: precaching error -
 
Yea i found out..

But why does it say double when im killling a teammate now then?

every time i kill one it keep saying double kill. It's like it wont increase the vars. :S

teame06 10-05-2006 09:37

Re: precaching error -
 
Also for your Death event function
Code:
public Death(id) { to public Death() { // Since id will be always 0 no matter what. Since no data is sent through that.

Code:
public HudEvent(id) {         set_hudmessage(0, 100, 155, 0.00, 0.40, 3, 1.0, 4.0, 0.5, 0.05, 2)         new killer = read_data(1) // You can't do this here. You only can do it in the event function itself. So you need to pass that data along with set task.

Rolnaaba 10-05-2006 09:47

Re: precaching error -
 
if you use set task to move to the HudEvent, the read_data ID's are passed along to the task set? does all variables declared move along the set_task or do just the ability to use read_data to reset a variable with the correct information?

teame06 10-05-2006 12:31

Re: precaching error -
 
@ Rolnaaba

No. You need to use the availble part of set_task to pass the argument through.. Since he need to pass more than 1 arugment. He can't use the taskid slot to pass it through.

Code:
     new Oranges[3];      Oranges[0] = killer;      Oranges[1] = victim;      set_task(0.1, "HudEvent", _, Oranges, 3); // Then his function would look like this      public HudEvent(param[])      {           //           new killer = param[0];           new victim = param[1];      }

stigma 10-05-2006 13:21

Re: precaching error -
 
Why wont the HUD messages appear? :S

teame06 10-05-2006 14:53

Re: precaching error -
 
Code:
public HudEvent(id) {         set_hudmessage(0, 100, 155, 0.00, 0.40, 3, 1.0, 4.0, 0.5, 0.05, 2)         new killer = read_data(1) // Will be 0 no matter waht.         new killername[33]     get_user_name(killer,killername,32)     // Since you do not understand that i'm telling you. You are passing the id of zero to the HudEvent Function.     //So since killer is 0 ... then iKill[0] is zero. Your not passing no player real id. Your passing the server id which is 0.     if (iKill[killer] = 2) {     // So your IF statements are always failing

stigma 10-05-2006 16:29

Re: precaching error -
 
Okay..

Well i've changed it to this:

Code:
public Death() {     set_hudmessage(0, 100, 155, 0.05, 0.35, 3, 1.0, 4.0, 0.5, 0.05, -1)         new killer = read_data(1)     new victim = read_data(2)         new WeaponName[20]     new WeaponID = get_weaponid(WeaponName)     read_data(4,WeaponName,19)         new vicname[33]     get_user_name(victim,vicname,32)     new killername[33]     get_user_name(killer,killername,32)         if (get_user_team(killer) == get_user_team(victim)) {         client_cmd(0,"play %s", TeamKillerSound)         show_hudmessage(0,"%s killed a team mate!", killername)         iKill[killer] = 0                 return PLUGIN_HANDLED     }     if (get_user_team(killer) != get_user_team(victim)) {                 if (read_data(3) && FirstBlood == true && WeaponID != CSW_DEAGLE) {             client_cmd(0,"play %s", HeadShotSound)             show_hudmessage(killer,"Headshot!")         }         if (WeaponID == CSW_DEAGLE && read_data(3) && FirstBlood == true) {             client_cmd(0,"play %s", EagleEyeSound)             show_hudmessage(killer,"%s has an Eagle eye!")         }                 if (FirstBlood == false) {             client_cmd(0,"play %s", FirstBloodSound)             show_hudmessage(0,"%s drew First Blood!", killername)             FirstBlood = true         }             iKill[killer] += 1     }     if (iKill[killer] == 2) {         client_cmd(killer,"play %s",DoubleKillSound)         show_hudmessage(killer,"Double Kill!")     } else if (iKill[killer] == 3) {         client_cmd(killer,"play %s",TripleKillSound)         show_hudmessage(killer,"Triple Kill!")     } else if (iKill[killer] == 5) {         client_cmd(killer,"play %s",MultiKillSound)         show_hudmessage(killer,"Multi Kill!")     } else if (iKill[killer] == 7) {         client_cmd(0,"play %s",KillingSpreeSound)         show_hudmessage(0,"%s is on a Killing Spree!", killername)     } else if (iKill[killer] == 9) {         client_cmd(killer,"play %s",UltraKillSound)         show_hudmessage(killer,"Ultra Kill!")     } else if (iKill[killer] == 10) {         client_cmd(0,"play %s",MonsterKillSound)         show_hudmessage(0,"M-M-M-MONSTER KILL!!!")     } else if (iKill[killer] == 11) {         client_cmd(0,"play %s",DominatingSound)         show_hudmessage(0,"%s is Dominating!", killername)     } else if (iKill[killer] == 12) {         client_cmd(0,"play %s",GodLikeSound)         show_hudmessage(0,"%s is Godlike!", killername)     } else if (iKill[killer] == 14) {         client_cmd(0,"play %s",RampageSound)         show_hudmessage(0,"%s is on a Rampage!", killername)     } else if (iKill[killer] == 15) {         client_cmd(0,"play %s",WickedSickSound)         show_hudmessage(0,"WHICKED SICK!!!^n%s has killed 15 without dying!", killername)     }     return PLUGIN_HANDLED }

The messages aint appearing anyway.. And no other HUD messages aint shown at the same time..


By the way, i noticed nightsreem's plugin called "Player wanted", han can he make his own native "getMostKills(team)", and then return the user who have killed most people?


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

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