RE: Scripting/Variables problem.
void OnStart()
{
AddEntityCollideCallback("Player", "Area_3", "CheckAreas", false, 0);
AddEntityCollideCallback("Player", "Area_4", "CheckAreas", false, 0);
AddEntityCollideCallback("Player", "Area_5", "CheckAreas", false, 0);
AddEntityCollideCallback("Player", "Area_6", "CheckAreas", false, 0);
}
void CheckAreas(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
if(asChild == "Area_3")
{
SetLocalVarInt("Area_3", 1);
}
if(asChild == "Area_4")
{
SetLocalVarInt("Area_4", 1);
}
if(asChild == "Area_5")
{
SetLocalVarInt("Area_5", 1);
}
if(asChild == "Area_6")
{
SetLocalVarInt("Area_6", 1);
}
SetLocalVarInt("InsideArea", 1);
}
if(alState == -1)
{
SetLocalVarInt("InsideArea", 0);
if(asChild == "Area_3")
{
SetLocalVarInt("Area_3", 0);
}
if(asChild == "Area_4")
{
SetLocalVarInt("Area_4", 0);
}
if(asChild == "Area_5")
{
SetLocalVarInt("Area_5", 0);
}
if(asChild == "Area_6")
{
SetLocalVarInt("Area_6", 0);
}
}
}
void Callback2(string &in asEntity, int alState)
{
if(GetLocalVarInt("InsideArea") == 1)
{
if(alState == 1)
{
}
if(alState == 0)
{
if(GetLocalVarInt("Area_3") == 1)
{
//DO STUFF IF INSIDE AREA 3
}
if(GetLocalVarInt("Area_4") == 1)
{
//DO STUFF IF INSIDE AREA 4
}
if(GetLocalVarInt("Area_5") == 5)
{
//DO STUFF IF INSIDE AREA 3
}
if(GetLocalVarInt("Area_6") == 6)
{
//DO STUFF IF INSIDE AREA 3
}
}
}
}
This is how i understood it.
Trying is the first step to success.
|