#include <a_samp>forward SetPlayerSpeedCap( playerid, Float:value );forward DisablePlayerSpeedCap( playerid );newFloat:g_fSpeedCap[ MAX_PLAYERS ] = { 0.0, ... };new Kocsi[4];public OnGameModeInit(){ Kocsi[0] = AddStaticVehicleEx(400,2062.4780,-1904.0059,13.2523,0.1147,1,1, 7200000); Kocsi[1] = AddStaticVehicleEx(400,2052.3628,-1903.9910,13.2523,359.7091,1,1, 7200000); Kocsi[2] = AddStaticVehicleEx(400,2056.1294,-1903.9355,13.2517,359.9152,1,1, 7200000); Kocsi[3] = AddStaticVehicleEx(400,2059.1633,-1903.9895,13.2516,359.8265,1,1, 7200000); return 1;}public OnPlayerUpdate(playerid){statics_iVehicle;if ( g_fSpeedCap[ playerid ] != 0.0 && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ){s_iVehicle = GetPlayerVehicleID( playerid );if ( s_iVehicle ){ static Float:s_fX, Float:s_fY, Float:s_fZ, Float:s_fVX, Float:s_fVY, Float:s_fVZ ; GetVehiclePos( s_iVehicle, s_fX, s_fY, s_fZ ); GetVehicleVelocity( s_iVehicle, s_fVX, s_fVY, s_fVZ ); if ( !IsPlayerInRangeOfPoint( playerid, g_fSpeedCap[ playerid ] + 0.05, s_fX + s_fVX, s_fY + s_fVY, s_fZ + s_fVZ ) ) { static Float:s_fLength ; s_fLength = floatsqroot( ( s_fVX * s_fVX ) + ( s_fVY * s_fVY ) + ( s_fVZ * s_fVZ ) ); s_fVX = ( s_fVX / s_fLength ) * g_fSpeedCap[ playerid ]; s_fVY = ( s_fVY / s_fLength ) * g_fSpeedCap[ playerid ]; s_fVZ = ( s_fVZ / s_fLength ) * g_fSpeedCap[ playerid ]; if ( s_iVehicle ) SetVehicleVelocity( s_iVehicle, s_fVX, s_fVY, s_fVZ ); else SetPlayerVelocity( playerid, s_fVX, s_fVY, s_fVZ ); }}}return 1;}public OnPlayerEnterVehicle( playerid, vehicleid, ispassenger ){ //new modelid = GetVehicleModel( vehicleid ); //if ( modelid == 522 ) // 522 - NRG-500 if(GetPlayerVehicleID(playerid) >= Kocsi[0] && GetPlayerVehicleID(playerid) <= Kocsi[3]) SetPlayerSpeedCap( playerid, 0.4 ); else DisablePlayerSpeedCap( playerid );}public SetPlayerSpeedCap(playerid, Float:value){if ( 0 <= playerid < sizeof( g_fSpeedCap ) )g_fSpeedCap[ playerid ] = value;}public DisablePlayerSpeedCap( playerid ){if ( 0 <= playerid < sizeof( g_fSpeedCap ) )g_fSpeedCap[ playerid ] = 0.0;}
new Kocsi[4];
GetPlayerVehicleID(playerid) <= Kocsi[3]
Kocsi[4] = GetVehicleModel( vehicleid );if(Kocsi[4] == GetPlayerVehicleID(playerid))
if(Kocsi[0] == GetPlayerVehicleID(playerid) || Kocsi[1] == GetPlayerVehicleID(playerid) || Kocsi[2] == GetPlayerVehicleID(playerid) || Kocsi[3] == GetPlayerVehicleID(playerid))