Page 1 of 1

[HELP]actor's name

PostPosted: Fri Jun 03, 2011 4:21 am
by KILILIMAN
hello i need to make what a sound take the name of a actor for play the sound but i can't do it.
Example:
actor's name is "player"
the function for sound will be:
Code: Select all
PlaySound2("data/player.wav", 1.000000, 1, 0.000000);

but how make what in place of actor's name are a variable with the valor "player"
i tried this but give error:
Code: Select all
char actorname[32];
char sounds[32];
getclone(actorname);
sprintf(sounds, "/data/%d.wav",actorname);
PlaySound2("sounds", 1.000000, 1, 0.000000);

I wait what you understand my english bad..
chaoooooooooooo

Re: [HELP]actor's name

PostPosted: Fri Jun 03, 2011 5:19 am
by skydereign
The reason you get an error is that you are using actorname which isn't a variable. The variable you are looking for the name variable. Also you need to not use "sounds" as that will try to play the sounds file. You want to use the variable sounds, so remove the double quotes.
Code: Select all
char actorname[32];
char sounds[32];
getclone(actorname);
sprintf(sounds, "/data/%d.wav",name);
PlaySound2(sounds, 1.000000, 1, 0.000000);