AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Please Help, New Plugin for headshot sounds (https://forums.alliedmods.net/showthread.php?t=47284)

Nyyuu 11-14-2006 03:51

Please Help, New Plugin for headshot sounds
 
Im Trying to make a plugin that instead of just playing the same file over and over when you get a headshot, it randomly pics one so it brings out some fun to the plain old repetitive boringness and has an easy ini file to update to add more sounds or takeaway in the future. Im stuck in a few areas of this however These are some errors i get

Code:

/home/groups/amxmodx/tmp3/text7K5hPl.sma(53) : warning 213: tag mismatch
/home/groups/amxmodx/tmp3/text7K5hPl.sma(56) : error 088: number of arguments does not match definition
/home/groups/amxmodx/tmp3/text7K5hPl.sma(57) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/text7K5hPl.sma(57 -- 58) : error 001: expected token: "]", but found "new"
/home/groups/amxmodx/tmp3/text7K5hPl.sma(58) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/text7K5hPl.sma(58) : fatal error 107: too many error messages on one line

Compilation aborted.
5 Errors.

The Warnning on line 53 is fine, i started with just a simple plugin withthat to test if it worked and it did
Then on line 56 57 and 58 i dont kno how to rewrite those any other way. .but it could be cuz there values arent finished yet
I also have no clue on how to finish off the list to have the randoms to choose from and how to randomly pic them once the list is done

ALOT of the code is from the headshot_delux, loadingsongsadvance and hlmp
Any help on how to fix any parts up and/or referance/tutorial sites to learn up on (besides the defalt basic documentation)
will be greatly appreciated, Thanks in advance
Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Super HeadShot"
#define VERSION "0.1"
#define AUTHOR "Nyyuu"
#define VIC_MAX 20

new Killer
new Victom
new Headshot
   
//Victom
new listVicWav[20] [200]
new vicfiledir[200]
new vicsong[VIC_MAX][200]

    public viclist(){
        get_configsdir(vicfiledir,199)
        format(vicfiledir,199,"%s/shsVictom.ini",vicfiledir)
        new trash
        for(new i=0;i<VIC_MAX;i++)
    {   
    read_file(vicfiledir,i,vicsong[i],63,trash)
    // need to find a way to put listVicWav[i][vicsong[i]
    }
        }



// Killer
new listKilWav[20] [200]
new kilfiledir[200]
new kilsong[VIC_MAX][200]

    public killist(){
        get_configsdir(kilfiledir,199)
        format(kilfiledir,199,"%s/shsKiller.ini",kilfiledir)
        new trash
        for(new i=0;i<VIC_MAX;i++)
    {   
    read_file(kilfiledir,i,kilsong[i],63,trash)
    // need to find a way to put listkilWav[i][kilsong[i]
    }
        }

   
    public head_shot() {
    Killer = read_data(1) //get the guy that killed someone
    Victom = read_data(2) //get the guy who died
    Headshot = read_data(3) //was a headshot?
   
    if (Headshot == true) {
       
        //Tempfiles for random song pic
        new temp3 = random(0,20)
        new temp1 = listKilWav[temp3][]
        new temp2 = listVicWav[temp3][]
       
        // plays a random file from killers
        client_cmd(Killer, "spk temp1")
        //plays a random file from victoms
        client_cmd(Victom, "spk temp2")
}
}


  public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_event  ("DeathMsg","head_shot","a")   
}

ps, i kno i havent even gotten to the precache yet, the way i was thinking of doing it was similar to the list

The Specialist 11-14-2006 04:36

Re: Please Help, New Plugin for headshot sounds
 
here you go , there was a problem with the way you used random, random only has 1 paramter (max). I beleive it starts at 0 . on line 65 and 66 the arrays wernt indexed properly or something . Note i onlygot it to compile the rest is up to you :wink:
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Super HeadShot" #define VERSION "0.1" #define AUTHOR "Nyyuu" #define VIC_MAX 20 new Killer new Victom new Headshot //Victom new listVicWav[20] [200] new vicfiledir[200] new vicsong[VIC_MAX][200] public viclist() {  get_configsdir(vicfiledir,199)  format(vicfiledir,199,"%s/shsVictom.ini",vicfiledir)  new trash  for(new i=0;i<VIC_MAX;i++)  {       read_file(vicfiledir,i,vicsong[i],63,trash)   // need to find a way to put listVicWav[i][vicsong[i]  } }   // Killer new listKilWav[20] [200] new kilfiledir[200] new kilsong[VIC_MAX][200] public killist() {  get_configsdir(kilfiledir,199)  format(kilfiledir,199,"%s/shsKiller.ini",kilfiledir)  new trash  for(new i=0;i<VIC_MAX;i++)  {       read_file(kilfiledir,i,kilsong[i],63,trash)   // need to find a way to put listkilWav[i][kilsong[i]  } } public head_shot() {  Killer = read_data(1) //get the guy that killed someone  Victom = read_data(2) //get the guy who died  Headshot = read_data(3) //was a headshot?    if (Headshot == true)  {     //Tempfiles for random song pic     new temp3 = random(20)     //  Random only has one paramater , the max number to go to (starts at 0)     new temp1 = listKilWav[temp3][199]   new temp2 = listVicWav[temp3][199]     // you have to figure out what value you want your multi-diminesional arrays to hold     // plays a random file from killers   client_cmd(Killer, "spk temp1")   //plays a random file from victoms   client_cmd(Victom, "spk temp2")  } } public plugin_init()  {  register_plugin(PLUGIN, VERSION, AUTHOR)  register_event   ("DeathMsg","head_shot","a")     }
Theres only a couple warning left , you never used the symbols. Hope this helps you somewhat :up:

dutchmeat 11-14-2006 04:37

Re: Please Help, New Plugin for headshot sounds
 
First of all, use random_num(0,20) instead of random.
But i can't help you with ini files.

The Specialist 11-14-2006 04:47

Re: Please Help, New Plugin for headshot sounds
 
well yes if he was looking to generate a random number between a certain number and another you could use
Code:
random_num(min,max);
but since he only wants to generate a random playing of a file , theres no need to do it that way . with this
Code:
random(20);
he can generate a random number between 0(first file) and 20(last file) so in this case random is the best choice IMO.:wink:

Nyyuu 11-14-2006 06:16

Re: Please Help, New Plugin for headshot sounds
 
Thank You, The Specialist and dutchmeat so just the hard parts left :)

dutchmeat 11-14-2006 07:31

Re: Please Help, New Plugin for headshot sounds
 
You're welcome (this is the part where i start whining for karma ;), but i'll leave it be.)

jim_yang 11-14-2006 07:40

Re: Please Help, New Plugin for headshot sounds
 
register the event like this
Code:

register_event("DeathMsg","head_shot","a","3=1")
then you don't need to read_data(3) to see if it was a headshot.

Nyyuu 11-14-2006 09:35

Re: Please Help, New Plugin for headshot sounds
 
cool so the 3=1 is basicly param3 eqipils true so itll go to the head_shot only when thats true? Thanks :) (and can a new user do karma? dunno if i did it right >_<)

VEN 11-14-2006 14:01

Re: Please Help, New Plugin for headshot sounds
 
Quote:

random(20);
he can generate a random number between 0(first file) and 20(last file)
That's incorrect, it will generate the integer in range 0 ... 19.

The Specialist 11-14-2006 16:04

Re: Please Help, New Plugin for headshot sounds
 
so if 20 is max it will only generate to number 19? :|


All times are GMT -4. The time now is 06:55.

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