Playing a sound from speech.rpf is rather simple, if you know how to, but it took me some hours till I found out, too
Here is how to (I guess you write in C#):
Player.Character.Voice = "NIKO";
GTA.Native.Function.Call("SAY_AMBIENT_SPEECH", Player.Character, "GENERIC_BUY", 1, 1, 1);
1) At first, you have to define your Players voice. Do the same for any ped you like. List of possible voices --> http://www.gtaforums.com/index.php?showtopic=426464
2) Use GTA.Native.Function.Call("SAY_AMBIENT_SPEECH", the ped/player you want to say the sound, "The_string_name_of_the_sound", Parameters);
Find some info about the possible parameters and what they do here --> http://www.gtamodding.com/index.php?title=SAY_AMBIENT_SPEECH
I would recommend you to use SparkIV, go to audio/sfx/speech.rpf/SPEECH . There you find all possible voices and by clicking on them, you can see the possible sounds to play.
Attention: The name of the voice in SparkIV doesn't resemble the name you have to use in the script. "NIKO_NORMAL_1" for example ist just "NIKO". For "NIKO_ANGRY_1" and "NIKO_ANGRY_2", write "NIKO_ANGRY". Same goes for the sounds, "GENERIC_BUY_1" and "GENERIC_BUY_2" just go as "GENERIC_BUY". The game will pick on of the sounds and play it, so Niko won't always say the same sentence.
Just play arround and you will find out!
To check the ingame time, just define a variable to check the current time. If you want the time to be checked every second for example, use a tick-event.
void timecheck_Tick(object sender, EventArgs e)
hours = World.CurrentDate.TimeOfDay.Hours;
if (hours >= 21)
Hope that helped! This post has been edited by DonSalami on Tuesday, Aug 7 2012, 10:28