How do I get vehicle speed? [READ WHOLE]
#1

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.
Reply
#2

Search for GetPlayerSpeed/GetPlayerVelocity
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)