I've run into another problem, when I use the entity, it runs the script just like it should, but I can't interact with it again? What I want to do is to be able to switch song by clicking the radio, but I can only interact with it once. Here's my script, I thought the
SetEntityInteractionDisabled("Radio_1", false); and
ResetProp("Radio_1"); would fix this, but it didn't. >.<
Here's the code so far:
void OnStart()
{
SetLocalVarInt("radio", 0);
SetEntityPlayerInteractCallback("Radio_1", "func1", true);
}
void func1(string &in asEntity)
{
if(GetLocalVarInt("radio") >= 0)
{
AddLocalVarInt("radio", 1);
StopMusic(2, 1);
playmusic();
}
SetEntityInteractionDisabled("Radio_1", false);
ResetProp("Radio_1");
}
void playmusic()
{
if(GetLocalVarInt("radio") == 0)
{
StopMusic(2, 1);
}
if(GetLocalVarInt("radio") == 1)
{
StopMusic(2, 1);
PlayMusic("1.ogg", true, 1, 2, 1, false);
}
if(GetLocalVarInt("radio") == 2)
{
StopMusic(2, 1);
PlayMusic("2.ogg", true, 1, 2, 1, false);
}
if(GetLocalVarInt("radio") == 3)
{
StopMusic(2, 1);
PlayMusic("3.ogg", true, 1, 2, 1, false);
}
if(GetLocalVarInt("radio") == 4)
{
StopMusic(2, 1);
PlayMusic("4.ogg", true, 1, 2, 1, false);
}
if(GetLocalVarInt("radio") == 5)
{
StopMusic(2, 1);
PlayMusic("5.ogg", true, 1, 2, 1, false);
}
}