forward liftass();
public liftass()
{
if(GetPVarInt(playerid, "liftas") == 1)
{
MoveDynamicObject(liftas, 1481.07, 1744.07, 9.35, 5.0);
SetPVarInt(playerid, "liftas", 0);
}
public OnGameModeInit()
{
SetTimer("liftass", 10000, true);
new timer;
timer = SetTimer("liftass", 10000, true);
KillTimer(timer);
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if( newkeys == KEY_HANDBRAKE )
{
if(IsPlayerInRangeOfPoint(playerid, 20.0 , 1477.21, 1750.11, 9.29))
{
if(GetPVarInt(playerid, "liftas") == 0)
{
MoveDynamicObject(liftas, 1480.31, 1746.09, 96.01, 5.0);
SetPVarInt(playerid, "liftas", 1);
GameTextForPlayer(playerid, "~G~ Keliates Aukstyn!", 2000, 5);
}
}
if(IsPlayerInRangeOfPoint(playerid, 20.0 , 1480.31, 1746.09, 96.01))
{
if(GetPVarInt(playerid, "liftas") == 1)
{
MoveDynamicObject(liftas, 1481.07, 1744.07, 9.35, 5.0);
SetPVarInt(playerid, "liftas", 0);
GameTextForPlayer(playerid, "~R~ Keliates zemyn!", 2000, 5);
}
}
}
CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
new mLift = 0;
public OnGameModeInit()
{
mlift = 0;
SetTimer("liftupdate", 5000, true);
return 1;
}
//Set the mlift to 1 on a command or where the lift gets moved!
forward liftupdate();
public liftupdate()
{
print("Timer works well");
if(mlift == 1)
{
MoveDynamicObject(liftas, 1481.07, 1744.07, 9.35, 5.0); //liftas must be defined.
mlift = 0;
print("Lift got moved!");
}
return 1;
}
|
The problem not in object, but in timer.
liftas = CreateDynamicObject(18769, 1480.31, 1746.09, 9.25, 0.00, 0.00, 0.11); |