Advertisement
Guest User

createfcar

a guest
Nov 30th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1.  
  2. ocmd:createfcar(playerid,params[])
  3. {
  4. if(!isAdmin(playerid,1) || ADuty[playerid] == 1) return SendClientMessage(playerid,-1,"Nicht Duty oder Admin");
  5. {
  6. //new query[128];
  7. new mID,pID,color1,color2,frak[128];
  8. print("Car fehlgeschlagen 2");
  9.  
  10. if(sscanf(params,"iiiu",mID,color1,color2,frak)) return SendClientMessage(playerid,-1,"INFO: /createfcar [VehicleID] [Color1] [Color2] [Fraktionsname]");
  11. if(mID <400 || mID > 611) return SendClientMessage(playerid,RED,"Ungültige ID!");
  12. {
  13. new Float:xc,Float:yc,Float:zc,Float:rc;
  14. GetPlayerPos(pID,xc,yc,zc);
  15. GetPlayerFacingAngle(pID,rc);
  16. createFrakCar(pID,mID,xc,yc,zc,rc,color1,color2,frak);
  17. PutPlayerInVehicle(playerid,mID,1);
  18. print("Car erfolgreich");
  19. }
  20. print("Car fehlgeschlagen");
  21.  
  22.  
  23. }
  24. return 1;
  25.  
  26. }
  27.  
  28. forward frakcarSavedToDB(carid);
  29.  
  30. createFrakCar(playerid,modelid,Float:x,Float:y,Float:z,Float:r,color1,color2,frak)
  31. {
  32. print("Createfcar vor schleife");
  33. for(new i=0; i<sizeof(fInfo); i++)
  34. {
  35. print("Create fcar in schleif");
  36. if(cInfo[i][id_x]!=0)continue;
  37. //cInfo[i][besitzer]=fInfo[playerid][f_name];
  38. //GetPlayerName(playerid,cInfo[i][besitzer],MAX_PLAYER_NAME);
  39. fInfo[MAX_FRAKS][c_x]=x;
  40. fInfo[][c_y]=y;
  41. fInfo[][c_z]=z;
  42. fInfo[][c_r]=r;
  43. fInfo[][model]=modelid;
  44. fInfo[][id_x] = CreateVehicle(modelid,x,y,z,r,color1,color2,-1);
  45. new string[256],pIDname[MAX_PLAYER_NAME];
  46. GetPlayerName(playerid,pIDname,sizeof(pIDname));
  47. format(string,sizeof(string),"Das Auto NR[%i] wurde für %s erstellt",i,pIDname);
  48. SendClientMessageToAll(RED,string);
  49. saveCarToDB(playerid,i);
  50. print("Createfcar in schleife ende");
  51. return 1;
  52. }
  53. return 1;
  54. }
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. public frakcarSavedToDB(carid)
  62. {
  63. cInfo[carid][db_id]= cache_insert_id(dbhandle);
  64. return 1;
  65. }
  66.  
  67. saveFrakCarToDB(playerid,carid)
  68. {
  69. new query[512];
  70. format(query,sizeof(query),"INSERT INTO frakcars (fraktion,model,x,y,z,r,color1,color2) VALUES ('%s','%i','%f','%f','%f','%f','%i','%i')",fInfo[][f_name],fInfo[carid][model],cInfo[carid][c_x],cInfo[carid][c_y],cInfo[carid][c_z],cInfo[carid][c_r],cInfo[playerid][kmstand]);
  71. print(query); // <--- diese Zeile
  72. print("Fcar Speicherung");
  73. mysql_function_query(dbhandle,query,true,"FrakcarSavedToDB","i",carid);
  74. return 1;
  75.  
  76. }
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91. //ERROR ZEILEN
  92.  
  93.  
  94. fInfo[MAX_FRAKS][c_x]=x;
  95. fInfo[][c_y]=y;
  96. fInfo[][c_z]=z;
  97. fInfo[][c_r]=r;
  98. fInfo[][model]=modelid;
  99. fInfo[][id_x] = CreateVehicle(modelid,x,y,z,r,color1,color2,-1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement