SA-MP Forums Archive
How do I get vehicle speed? [READ WHOLE] - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How do I get vehicle speed? [READ WHOLE] (/showthread.php?tid=195164)



How do I get vehicle speed? [READ WHOLE] - blackwave - 01.12.2010

I want to get vehicle speed. I made an radar, which if a player would be at least 100m from this radar with an certain speed, he'd be removed from the vehicle. Dont tell me to go to wiki, cuz I already tried and used search. I used IsPlayerInRangeOfPoint and GetPlayerVehicleID, but didn't work. So, if anyone tell me how to return the speed value on OnPlayerStateChange, and detect if is player with an certain speed, please tell me. Thanks.


Re: How do I get vehicle speed? [READ WHOLE] - dice7 - 01.12.2010

Search for GetPlayerSpeed/GetPlayerVelocity


Re: How do I get vehicle speed? [READ WHOLE] - blackwave - 01.12.2010

nvm, worked. Was funny :P

Код:
if(IsPlayerInAnyVehicle(playerid))
	{
        for(new i = 0; i < MAX_PLAYERS; i++)
	    {
		    if(IsPlayerInRangeOfPoint(playerid, 50, 2046.52, 1302.56, 18.83))
		    {
          if(speed_limit_is_actived[i]==1)
		  {
        new str[128];
		new v; v = GetPlayerVehicleID(playerid);
      	new sp; sp = GetPlayerSpeed(playerid);
      	format(str,sizeof(str),"KM/H: %d", sp);

      	if(sp >= 50)
		{
		 GameTextForPlayer(playerid, "~g~Limite maximo antigido ~r~@", 1000, 5);
		 RemovePlayerFromVehicle(playerid);
		}
		 

    }
    }
    }
    return 1;
    }