Smoother, slower MoveObject speed
#1

Hello there,

I have this code for moving barriers, however they're opening and closing very fast, in fact quite instantly in a matter of a second or less. I don't know where I am going wrong with this, the speed is set to 0.0001 and I've read somewhere that any values below 10 should make it move smooth. Anyway, I'd appreciate any tips on where I could have gone wrong, cheers.

Код:
if(dialogid == 3206){
	    if(response == 0){
	        SendClientMessage(playerid,COLOR_ADMIN, "*** Please clear the way for the next vehicle!");
	        SetTimerEx("gate6", 5000, false, "i", playerid);
		}
		if(response == 1){
		    pmoney = GetPlayerMoney(playerid);
		    if(pmoney >= 20)
		    {
		        MoveObject(barriergate6, 1556.021362, -439.513275+0.0001, 34.171135, 0.0001);
		        SetObjectRot(barriergate6, 1.178097, 0.000000, 0.000000);
		        SendClientMessage(playerid,COLOR_YELLOW, "*** You have paid for the M1 Toll Motorway. Enjoy the drive.");
		        SendClientMessage(playerid,COLOR_LIGHTGREEN, "*** Please drive through the toll within 5 seconds!");
				SetTimerEx("gate6", 4000, false, "i", playerid);
				return 3;
			}else{
			    SendClientMessage(playerid,COLOR_ADMIN, "*** You donґt have enough money. Please clear the way for other vehicles.");
			    SetTimerEx("gate6", 4000, false, "i", playerid);
			}
		}
	}
	return 0;
}
Reply
#2

Change this:
pawn Код:
MoveObject(barriergate6, 1556.021362, -439.513275+0.0001, 34.171135, 0.0001);
SetObjectRot(barriergate6, 1.178097, 0.000000, 0.000000);
To this:
pawn Код:
MoveObject(barriergate6, 1556.021362, -439.513275+0.0001, 34.171135, 4/*change speed here*/,1.178097, 0.000000, 0.000000);
Reply
#3

maybe it doesnt allow floats? try 1 instead of 0.00000000001
Reply
#4

Thank you, it works. However, when the speed is "1" it's still quite fast, and it seems like it doesn't accept floats indeed, since when I input "0.0001", the barrier remains closed. Any suggestions?
Reply
#5

Quote:
Originally Posted by jamesbond007
Посмотреть сообщение
maybe it doesnt allow floats? try 1 instead of 0.00000000001
well the wiki says


Float:Speed The speed at which to move the object (In units per second).



so it infact is a float..

try a higher value like say 0.1
Reply
#6

I tried 0.15 and it works like a charm. Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)