The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random sound at random time script help
Gamemakingdude Offline
Senior Member

Posts: 470
Threads: 82
Joined: Nov 2010
Reputation: 9
#1
Random sound at random time script help

PHP Code: (Select All)
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"falsefalse);
        
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.

Rep if like me or im helpful or you love my stories!
Stephanos house
12-06-2011, 06:09 AM
Find


Messages In This Thread
Random sound at random time script help - by Gamemakingdude - 12-06-2011, 06:09 AM



Users browsing this thread: 1 Guest(s)