12-06-2011, 06:09 AM
PHP Code:
void OnStart()
{
SetGlobalVarInt("Globalvar1", 0);
AddTimer("GlobalCheck", 0, "DoorCheck");
Addtimer("RandomSound",1.0f,"StartTiming");
}
void StartTiming(string &in asTimer) {
int Time = RandInt(1,5);
string TimeName = "";
if(Time == 1) {
TimeName = "1";
}
if(Time == 2) {
TimeName = "2";
}
if(Time == 3) {
TimeName = "3";
}
if(Time == 4) {
TimeName = "4";
}
if(Time == 5) {
TimeName = "5";
}
AddTimer(TimeName,RandFloat(0,60),"SoundTime");
}
void SoundTime(string &in asTimer) {
string x = asTimer;
if(x=="1") {
Addtimer("RandomSound",1.0f,"StartTiming");
PlaySoundAtEntity("","walkandgrunt.snt","Player",0,false);
}
if(x=="2") {
Addtimer("RandomSound",1.0f,"StartTiming");
PlaySoundAtEntity("","walkandgrunt.snt","Player",0,false);
}
if(x=="3") {
Addtimer("RandomSound",1.0f,"StartTiming");
PlaySoundAtEntity("","walkandgrunt.snt","Player",0,false);
}
if(x=="4") {
Addtimer("RandomSound",1.0f,"StartTiming");
PlaySoundAtEntity("","walkandgrunt.snt","Player",0,false);
}
if(x=="5") {
Addtimer("RandomSound",1.0f,"StartTiming");
PlaySoundAtEntity("","walkandgrunt.snt","Player",0,false);
}
}
void DoorCheck(string &in asTimer)
{
if(GetGlobalVarInt("Globalvar1") == 1)
{
SetSwingDoorLocked("elevator_door_1", false, false);
RemoveTimer("GlobalCheck");
}
else
{
AddTimer("GlobalCheck", 0, "DoorCheck");
}
}
I get signature matching errors at the AddTimer parts. If there's an simplier way then please go ahead and suggest.