[HELP]actor's name

Non-platform specific questions.

[HELP]actor's name

Postby KILILIMAN » Fri Jun 03, 2011 4:21 am

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
KILILIMAN
 
Posts: 6
Joined: Sat May 07, 2011 7:24 am
Score: 0 Give a positive score

Re: [HELP]actor's name

Postby skydereign » Fri Jun 03, 2011 5:19 am

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);
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest