Advertisement
Guest User

Untitled

a guest
May 31st, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.65 KB | None | 0 0
  1. public Action Command_Vehicle(client, iArgs){
  2.  
  3.     float vecEyePosition[3];
  4.  
  5.     GetGazingPosition(client, vecEyePosition);
  6.  
  7.     g_iVehicle = CreateEntityByName("prop_vehicle_driveable");
  8.  
  9.     DispatchKeyValue(g_iVehicle, "vehiclescript", "scripts/vehicles/natalyas_mustang.txt");
  10.     DispatchKeyValue(g_iVehicle, "model", VEHICLE_PATH);
  11.     DispatchKeyValue(g_iVehicle, "targetname", "VEHICLEEEEEEEEEEEEEEEEEEEEEEEEEEe");
  12.     DispatchKeyValue(g_iVehicle, "solid","6");
  13.     DispatchKeyValue(g_iVehicle, "skin", "0");
  14.     DispatchKeyValue(g_iVehicle, "actionScale","1");
  15.     DispatchKeyValue(g_iVehicle, "EnableGun","0");
  16.     DispatchKeyValue(g_iVehicle, "ignorenormals","0");
  17.     DispatchKeyValue(g_iVehicle, "fadescale","1");
  18.     DispatchKeyValue(g_iVehicle, "fademindist","-1");
  19.     DispatchKeyValue(g_iVehicle, "VehicleLocked","0");
  20.     DispatchKeyValue(g_iVehicle, "screenspacefade","0");
  21.     DispatchKeyValue(g_iVehicle, "spawnflags", "256" );
  22.  
  23. //  SetEntProp(g_iVehicle, Prop_Send, "m_nSolidType", 6);
  24.     DispatchSpawn(g_iVehicle);
  25.     AcceptEntityInput(g_iVehicle, "TurnOn");
  26.     ActivateEntity(g_iVehicle);
  27.     AcceptEntityInput(g_iVehicle, "HandBrakeOff");
  28.     AcceptEntityInput(g_iVehicle, "TurnOn");
  29.  
  30.     SetEntProp(g_iVehicle, Prop_Data, "m_nNextThinkTick", -1);
  31.     SDKHook(g_iVehicle, SDKHook_Think, OnVehicleThink);
  32.     SetEntProp(g_iVehicle, Prop_Send, "m_nSolidType", 2);
  33.  
  34.    
  35. //  SetEntProp(g_iVehicle, Prop_Send, "m_nSolidType", 6);
  36.  
  37.     TeleportEntity(g_iVehicle, vecEyePosition, NULL_VECTOR, NULL_VECTOR);
  38. }
  39.  
  40. public OnVehicleThink(iEntity){
  41.  
  42.     int iDriver = GetEntPropEnt(iEntity, Prop_Send, "m_hPlayer");
  43.  
  44.     if(iDriver > 0 && IsPlayerAlive(iDriver)){
  45.  
  46.         SetEntProp(iEntity, Prop_Data, "m_nNextThinkTick", 1);
  47.         SetEntPropFloat(iEntity, Prop_Data, "m_flTurnOffKeepUpright", 1.0);
  48.         AcceptEntityInput(iEntity, "TurnOn");
  49.         AcceptEntityInput(iEntity, "HandBrakeOff");
  50.     }
  51. }
  52.  
  53. bool LeaveVehicle(client){
  54.  
  55.     int iVehicleIndex = GetEntPropEnt(client, Prop_Send, "m_hVehicle");
  56.  
  57.     if(!iVehicleIndex || !IsValidEntity(iVehicleIndex))
  58.         return false;
  59.  
  60.     SetVariantString("VEHICLEEEEEEEEEEEEEEEEEEEEEEEEEEe");
  61.     AcceptEntityInput(client, "SetParent");
  62.     SetVariantString("vehicle_driver_exit");
  63.     AcceptEntityInput(client, "SetParentAttachment");
  64.     AcceptEntityInput(client, "ClearParent");
  65.     SetEntProp(client, Prop_Send, "m_CollisionGroup", COLLISION_GROUP_PLAYER)
  66.  
  67.     // client
  68.     SetEntityMoveType(client, MOVETYPE_WALK);
  69.     SetEntPropEnt(client, Prop_Send, "m_hVehicle", -1);
  70.  
  71.     // vehicles
  72.     SetEntProp(iVehicleIndex, Prop_Send, "m_nSpeed", 0);
  73.     SetEntPropEnt(iVehicleIndex, Prop_Send, "m_hPlayer", -1);
  74.     SetEntPropFloat(iVehicleIndex, Prop_Send, "m_flThrottle", 0.0);
  75.     AcceptEntityInput(iVehicleIndex, "TurnOff");
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement