Timer doesn't work
#1

Код:
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);
I want to make that, if lift is high, it backs on the ground, but its not work..
Reply
#2

the lift does not move ? or the timer doesnt run ?
if the timer doesnt run. you must add variable to the timer
pawn Код:
new timer;
timer = SetTimer("liftass", 10000, true);
to stop the timer you can use
pawn Код:
KillTimer(timer);
Reply
#3

The lift doesn't back on the ground, here is problem..
Reply
#4

Quote:
Originally Posted by Louris
Посмотреть сообщение
The lift doesn't back on the ground, here is problem..
where is the cordinate for ground and for top ?
Reply
#5

Here all code..

Код:
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);
}
}
}
Reply
#6

where is the create object function ?
pawn Код:
CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
Reply
#7

The problem not in object, but in timer.

liftas = CreateDynamicObject(18769, 1480.31, 1746.09, 9.25, 0.00, 0.00, 0.11);
Reply
#8

OMG people please help, i waiting for a help all day..
Reply
#9

You could create normal variables for the lift and set it to '1' when lift moves, and then set it to '0' when it stops.

Example:
pawn Код:
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;
}
Reply
#10

Quote:
Originally Posted by Louris
Посмотреть сообщение
OMG people please help, i waiting for a help all day..
Quote:
Originally Posted by Louris
Посмотреть сообщение
The problem not in object, but in timer.

liftas = CreateDynamicObject(18769, 1480.31, 1746.09, 9.25, 0.00, 0.00, 0.11);
Of course the problem is from the object why ? It because it has same variable with pvar so.. What you have to do now is change the variable of the create object function.. And BTW I don't see any code say "settimer" so it means you don't use any timer
Reply
#11

#define liftas
forward liftass();
public liftass()
{
if(mLift == 1)
MoveDynamicObject(liftas, 1481.07, 1744.07, 9.35, 5.0);
}

I remaked, but nothing happens..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)