Advertisement
OtaconEvil

[FS] Taxi Stop! | By OTACON - [SPANISH]

May 18th, 2015
782
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.95 KB | None | 0 0
  1. /*
  2.     * ## LEASE ATENTAMENTE PARA NO CONVERTIRSE EN LAMMER!!.: :D ##
  3.     *
  4.     * Estè Simple FILTERSCRIPT esta hecho especialmente para www.forum.sa-mp.com
  5.     * NO Publicar estè FILTERSCRIPT en Otros foros de SA-MP y hacerse pasar por el creador del CODE.
  6.     *
  7.     * Codigo Creado Por OTACON
  8.     *
  9.     * CREDITOS:
  10.     *     OTACON: Realizacion y Idea de creacion del code.
  11.     *     TÙ: Modificacion libremente respetando lo mencionado ;).
  12.     *
  13.     *    NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  14.     *
  15.     *                Prohibido TOTALMENTE el Robo de Créditos o la
  16.     *                  Publicación de este FILTERSCRIPT sin Mi Permiso.
  17. */
  18. /*
  19.     * ## READ CAREFULLY TO AVOID BECOMING LAMMER!.: :D ##
  20.     *
  21.     * This simple FILTERSCRIPT is made especially for www.forum.sa-mp.com
  22.     * DO NOT Post the FILTERSCRIPT in Other SAMP forums and impersonating the creator of the CODE.
  23.     *
  24.     * Code Created By OTACON
  25.     *
  26.     * CREDITS:
  27.     *     OTACON: Idea Making and code creation.
  28.     *     YOUR: Modification freely respecting the above ;).
  29.     *
  30.     *    NOTE: Less Credits for those who criticize me.. JO'PUTAS! :D xD ;)
  31.     *
  32.     *                        FULLY spaces Theft Credit or
  33.     *                 Publication of this FILTERSCRIPT without my permission.
  34. */
  35.  
  36. #include <a_samp>
  37.  
  38. #define DISTANCE_TAXI          10.0
  39. #define COLOR_A           "{FFE100}"
  40. #define COLOR_B           "{FFFFFF}"
  41. enum taxi{
  42.     cTaxi,
  43.     dDriver,
  44.     bool:cMapa,
  45. };
  46. new InfoTaxista[MAX_PLAYERS][taxi];
  47.  
  48. forward c_taxi(playerid); public c_taxi(playerid)\
  49. ApplyAnimation(playerid, "CARRY","crry_prtial",0.0,0,0,0,0,0,0),
  50. ApplyAnimation(playerid, "CARRY","crry_prtial",0.0,0,0,0,0,0,0),
  51. DisablePlayerCheckpoint(playerid);
  52.  
  53. stock IsVehicleTaxi(vehicleid){
  54.     #define MODEL_TAXI             (420)
  55.     #define MODEL_COBBIE           (438)
  56.     switch(GetVehicleModel(vehicleid)){
  57.         case MODEL_TAXI, MODEL_COBBIE:
  58.             return true;
  59.     }return false;
  60. }
  61.  
  62. stock PlayAudioStreamAll(playerid,Float:distance,url[]){
  63.     new
  64.         Float:pos[3],
  65.         Float:dist;
  66.     GetPlayerPos(playerid, pos[0],pos[1],pos[2]);
  67.     StopAudioStreamForPlayer(playerid);
  68.     PlayAudioStreamForPlayer(playerid, url);
  69.     for(new user=0, player=GetPlayerPoolSize(); user<=player; user++){
  70.         if(user == playerid)
  71.             continue;
  72.         dist = GetPlayerDistanceFromPoint(user, pos[0],pos[1],pos[2]);
  73.         if(dist < distance){
  74.             StopAudioStreamForPlayer(user);
  75.             PlayAudioStreamForPlayer(user, url);
  76.         }
  77.     }return true;
  78. }
  79.  
  80. stock NotDriver(vehicleid){
  81.     for(new user=0, player=GetPlayerPoolSize(); user<=player; user++){
  82.         if(IsPlayerInVehicle(user, vehicleid) && GetPlayerState(user)==PLAYER_STATE_DRIVER)
  83.             return true;
  84.         else return false;
  85.     }return true;
  86. }
  87.  
  88. stock GetIDDriver(vehicleid){
  89.     new id;
  90.     for(new user=0, player=GetPlayerPoolSize(); user<=player; user++){
  91.         if(IsPlayerInVehicle(user, vehicleid) && GetPlayerState(user)==PLAYER_STATE_DRIVER)
  92.             id = user;
  93.     }return id;
  94. }
  95.  
  96. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
  97.  
  98.     if(newkeys & KEY_YES){
  99.         if(!IsPlayerInAnyVehicle(playerid)){
  100.  
  101.             new count_id,
  102.                 count_passenger,
  103.                 vehicle_id,
  104.                 driver_id,
  105.                 Float:dist,
  106.                 Float:pos[2][3];
  107.             GetPlayerPos(playerid, pos[0][0],pos[0][1],pos[0][2]);
  108.  
  109.             for(new veh=1, vehicle=GetVehiclePoolSize(); veh<=vehicle; veh++){
  110.                 if(IsVehicleTaxi(veh)){
  111.                     dist = GetVehicleDistanceFromPoint(veh, pos[0][0],pos[0][1],pos[0][2]);
  112.                     if(dist < DISTANCE_TAXI){
  113.                         vehicle_id = veh;
  114.                         GetVehiclePos(vehicle_id, pos[1][0],pos[1][1],pos[1][2]);
  115.                         for(new user=0, player=GetPlayerPoolSize(); user<=player; user++){
  116.                             if(user==playerid)continue;
  117.                             if(IsPlayerInVehicle(user, vehicle_id)){
  118.                                 switch(GetPlayerState(user)){
  119.                                     case PLAYER_STATE_DRIVER: driver_id = user;
  120.                                     case PLAYER_STATE_PASSENGER: count_passenger++;
  121.                                 }
  122.                             }
  123.                         }
  124.                         count_id++;
  125.                     }
  126.                 }
  127.             }
  128.             switch(count_id){
  129.                 case 1:{
  130.                     switch(count_passenger){
  131.                         case 0:{
  132.                             if(NotDriver(vehicle_id)){
  133.                                 PlayAudioStreamAll(playerid,DISTANCE_TAXI,"");
  134.                                 SetVehicleVelocity(vehicle_id,0,0,0);
  135.                                 ApplyAnimation(playerid, "PED","null",0.0,0,0,0,0,0,0);
  136.                                 ApplyAnimation(playerid, "PED","null",0.0,0,0,0,0,0,0);
  137.                                 ApplyAnimation(playerid, "PED","IDLE_taxi",4.1,0,0,0,1,1,1);
  138.                                 SendClientMessage(playerid, -1,""COLOR_B"INFO: "COLOR_A"haz llamado un taxi desocupado, se ha detenido,");
  139.  
  140.                                 SendClientMessage(playerid, -1,""COLOR_A"se te ha marcado su posicion en el 'mini mapa'"COLOR_B"!.");
  141.                                 GetVehiclePos(vehicle_id, pos[1][0],pos[1][1],pos[1][2]);
  142.                                 SetPlayerCheckpoint(playerid, pos[1][0],pos[1][1],pos[1][2], 5);
  143.                                 SetTimerEx("c_taxi", 5*1000, false, "i", driver_id);
  144.  
  145.                                 SendClientMessage(driver_id, -1,""COLOR_B"INFO: "COLOR_A"tienes un pasajero disponible,");
  146.                                 SendClientMessage(driver_id, -1,""COLOR_A"se te ha marcado su posicion en el 'mini mapa'"COLOR_B"!.");
  147.                                 SetPlayerCheckpoint(driver_id, pos[0][0],pos[0][1],pos[0][2], 2);
  148.                                 SetTimerEx("c_taxi", 5*1000, false, "i", playerid);
  149.                             }else SendClientMessage(playerid, -1,""COLOR_B"INFO: "COLOR_A"el taxi detectado no tiene conductor"COLOR_B"!.");
  150.                         }
  151.                         default:{SendClientMessage(playerid, -1,""COLOR_B"INFO: "COLOR_A"haz llamado un taxi ocupado, lo siento"COLOR_B"!.");}
  152.                     }
  153.                 }
  154.                 case 0:{SendClientMessage(playerid, -1,""COLOR_B"INFO: "COLOR_A"no hay ningun taxi para llamar en su rango"COLOR_B"!.");}
  155.                 default:{SendClientMessage(playerid, -1,""COLOR_B"INFO: "COLOR_A"hay demasiados taxis en su rango"COLOR_B"!.");}
  156.             }
  157.         }
  158.     }
  159.     return true;
  160. }
  161.  
  162. public OnPlayerStateChange(playerid, newstate, oldstate){
  163.  
  164.     new vehicleid,
  165.         driverid,
  166.         Float:angle;
  167.     vehicleid = GetPlayerVehicleID(playerid);
  168.     driverid = GetIDDriver(vehicleid);
  169.     GetPlayerFacingAngle(playerid, angle);
  170.  
  171.     if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_PASSENGER){
  172.         if(IsVehicleTaxi(vehicleid)){
  173.             if(NotDriver(vehicleid)){
  174.                 DestroyPlayerObject(playerid, InfoTaxista[playerid][cTaxi]);
  175.                 InfoTaxista[playerid][cTaxi] = CreatePlayerObject(playerid,19300, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0);
  176.                 AttachCameraToPlayerObject(playerid, InfoTaxista[playerid][cTaxi]);
  177.                 ApplyAnimation(driverid, "WAYFARER","null",0.0,0,0,0,0,0,0);
  178.                 ApplyAnimation(driverid, "WAYFARER","WF_drivebyRHS",4.1,0,0,0,1,1,1);
  179.                 SetPlayerFacingAngle(driverid, angle);
  180.                 TogglePlayerControllable(driverid,false);
  181.                 TogglePlayerControllable(playerid,false);
  182.                 SendClientMessage(playerid, -1,""COLOR_B"INFO: "COLOR_A"selecciona tu ubicacion de destino mediante el 'MAPA,");
  183.                 SendClientMessage(playerid, -1,""COLOR_A"para selecionar tu destino presiona, 'ESC' > opcion 'MAPA'"COLOR_B"!.");
  184.                 SendClientMessage(driverid, -1,""COLOR_B"INFO: "COLOR_A"el pasajero te marcara su destino en el 'mini mapa', espera"COLOR_B"!.");
  185.                 InfoTaxista[playerid][cMapa] = true;
  186.                 InfoTaxista[playerid][dDriver] = driverid;
  187.             }
  188.         }
  189.     }
  190.  
  191.     return true;
  192. }
  193.  
  194. public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ){
  195.  
  196.     new driverid;
  197.     driverid = InfoTaxista[playerid][dDriver];
  198.  
  199.     if(InfoTaxista[playerid][cMapa]){
  200.         DestroyPlayerObject(playerid, InfoTaxista[playerid][cTaxi]);
  201.         SetCameraBehindPlayer(driverid);
  202.         SetCameraBehindPlayer(playerid);
  203.         ApplyAnimation(driverid, "CARRY","crry_prtial",0.0,0,0,0,0,0,0);
  204.         ApplyAnimation(driverid, "CARRY","crry_prtial",0.0,0,0,0,0,0,0);
  205.         TogglePlayerControllable(driverid,true);
  206.         TogglePlayerControllable(playerid,true);
  207.         SendClientMessage(playerid, -1,""COLOR_B"INFO: "COLOR_A"le has marcado tu destino en el 'mini mapa' el conductor, correctamente"COLOR_B"!.");
  208.         SendClientMessage(driverid, -1,""COLOR_B"INFO: "COLOR_A"el pasajero ha seleccionado su destino, se te ha marcado en el 'mini mapa'"COLOR_B"!.");
  209.         SetPlayerCheckpoint(driverid, fX, fY, fZ, 5);
  210.         InfoTaxista[playerid][cMapa] = false;
  211.         driverid = -1;
  212.     }
  213.  
  214.     return true;
  215. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement