Advertisement
RiccB

Create Job Vehicle

Oct 31st, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1.  
  2. new bool:Admin[MAX_PLAYERS];
  3. new JobVehicle[MAX_VEHICLES];
  4.  
  5. public OnGameModeInit()
  6. {
  7. LoadJobVeh();
  8.  
  9. /// Tolimesni Jūsų veiksmai...
  10.  
  11. return 1;
  12. }
  13.  
  14. CMD:cjv(playerid,params[])
  15. {
  16. new vehtype,vehlcol1,vehcol2,jobid;
  17. if(sscanf(params,"dddd",vehtype,vehlcol1,vehcol2,jobid)) return SendClientMessage(playerid,0xffff00AA,"Sukurti darbo transportą :{ffffff} /cjv [ModelioID][Spalva1][Spalva2][DarboID]");
  18. new Float:posX,Float:posY,Float:posZ,Float:posR;
  19. GetPlayerPos(playerid,posX,posY,posZ);
  20. GetPlayerFacingAngle(playerid,posR);
  21. CreateJobCar(vehtype,posX,posY,posZ,posR,vehlcol1,vehcol2,600,jobid);
  22. new q[224];
  23. format(q,224,"INSERT INTO JobVehicles(pos_x,pos_y,pos_z,pos_r,Color1,Color2,JID,VehID) VALUES('%f','%f','%f','%f','%d','%d','%d','%d')",posX,posY,posZ,posR,vehlcol1,vehcol2,jobid,vehtype);
  24. mysql_query(q);
  25. SendClientMessage(playerid,-1,"* Sėkmgingai sukūrėte transporto priemonę");
  26. return 1;
  27. }
  28.  
  29.  
  30. stock LoadJobVeh()
  31. {
  32. new Float:posX,Float:posY,Float:posZ,Float:posR,color1,color2,jidas,vidas,result[30];
  33. mysql_query("SELECT pos_x,pos_y,pos_z,pos_r,Color1,Color2,JID,VehID FROM JobVehicles");
  34. mysql_store_result();
  35.  
  36. while(mysql_retrieve_row())
  37. {
  38.  
  39. mysql_fetch_field_row( result, "pos_x" );
  40. posX = floatstr( result );
  41.  
  42. mysql_fetch_field_row( result, "pos_y" );
  43. posY = floatstr( result );
  44.  
  45. mysql_fetch_field_row( result, "pos_z" );
  46. posZ = floatstr( result );
  47.  
  48. mysql_fetch_field_row( result, "pos_r" );
  49. posR = floatstr( result );
  50.  
  51.  
  52.  
  53. mysql_fetch_field_row(result,"Color1");
  54. color1 = strval(result);
  55.  
  56. mysql_fetch_field_row(result,"Color2");
  57. color2 = strval(result);
  58.  
  59. mysql_fetch_field_row(result,"JID");
  60. jidas = strval(result);
  61.  
  62. mysql_fetch_field_row(result,"VehID");
  63. vidas = strval(result);
  64.  
  65. CreateJobCar(vidas,posX,posY,posZ,posR,color1,color2,jidas);
  66. }
  67. }
  68.  
  69. stock CreateJobCar(modelid,Float:x,Float:y,Float:z,Float:rotation,color1,color2,jobid)
  70. {
  71. new dtransportas = CreateVehicle(modelid,Float:x,Float:y,Float:z,Float:rotation,color1,color2,600);
  72. JobVehicle[dtransportas] = jobid;
  73. return dtransportas;
  74. }
  75.  
  76.  
  77.  
  78.  
  79. //////////////////////////////////////////// DUOMENŲ BAZĖJE //////////////////////////
  80. /* CREATE TABLE `JobVehicles` (
  81. `pos_x` float NOT NULL,
  82. `pos_y` float NOT NULL,
  83. `pos_z` float NOT NULL,
  84. `pos_r` float NOT NULL,
  85. `Color1` int(4) NOT NULL,
  86. `Color2` int(4) NOT NULL,
  87. `JID` int(3) NOT NULL,
  88. `VehID` int(4) NOT NULL
  89. ) */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement