SA-MP Forums Archive
Smoother, slower MoveObject speed - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Smoother, slower MoveObject speed (/showthread.php?tid=319290)



Smoother, slower MoveObject speed - HighFlyer - 18.02.2012

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;
}



Re: Smoother, slower MoveObject speed - FireCat - 18.02.2012

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);



Re: Smoother, slower MoveObject speed - jamesbond007 - 18.02.2012

maybe it doesnt allow floats? try 1 instead of 0.00000000001


Re: Smoother, slower MoveObject speed - HighFlyer - 18.02.2012

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?


Re: Smoother, slower MoveObject speed - Madd Kat - 18.02.2012

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


Re: Smoother, slower MoveObject speed - HighFlyer - 18.02.2012

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