Advertisement
Guest User

Untitled

a guest
Aug 24th, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.82 KB | None | 0 0
  1. #define DIALOG_FRAKTIONSLISTE 13 //<- vllt für die Frakliste? KP
  2.  
  3.  
  4. enum playerInfo{
  5. eingeloggt,
  6. level,
  7. db_id,
  8. alevel,
  9. fraktion,
  10. rang,
  11. spawnchange,
  12. perso,
  13. job,
  14. busskill,
  15. busskilllevel,
  16. pilotskill,
  17. pilotskilllevel,
  18. pRadio,
  19. pSkin
  20. }
  21.  
  22. new MedicCar[10];
  23. new LSPDcar[30];
  24.  
  25. public OnGameModeInit()
  26. {
  27. dbhandle = mysql_connect(db_host,db_user,db_db,db_pass);
  28. //Fraktionsautos
  29. MedicCar[0] = CreateVehicle(596,365.3164,-2045.9447,7.2711,357.8807,6,6,-1); // MedicCar1
  30. LSPDcar[0] = CreateVehicle(596,819.0999800,-1182.9000000,16.8000000,180.0000000,1,2,-1);
  31.  
  32. for(new mcars=0; mcars<sizeof(MedicCar); mcars++)
  33. {
  34. new kennzeichen[11];
  35. format(kennzeichen,11,"SA-%d",MedicCar[mcars]);
  36. SetVehicleNumberPlate(MedicCar[mcars],kennzeichen);
  37. SetVehicleToRespawn(MedicCar[mcars]);
  38. }
  39. for(new mcars=0; mcars<sizeof(LSPDcar); mcars++)
  40. {
  41. new kennzeichen[11];
  42. format(kennzeichen,11,"SA-%d",LSPDcar[mcars]);
  43. SetVehicleNumberPlate(LSPDcar[mcars],kennzeichen);
  44. SetVehicleToRespawn(LSPDcar[mcars]);
  45. }
  46. }
  47.  
  48. savePlayer(playerid)
  49. {
  50. if(sInfo[playerid][eingeloggt]==0)return 1;
  51. //Speichern Level,geld
  52. sInfo[playerid][pSkin] = GetPlayerSkin(playerid);
  53. new query[256];
  54. format(query,sizeof(query),"UPDATE user SET level = '%i', money = '%i', alevel = '%i', fraktion = '%i', rang = '%i', spawnchange = '%i', perso = '%i', job = '%i', busskill = '%i', busskilllevel = '%i', pilotskill = '%i', pilotskilllevel = '%i', pRadio = '%i', pSkin = '%i' WHERE id='%i'",
  55. sInfo[playerid][level],
  56. GetPlayerMoney(playerid),
  57. sInfo[playerid][alevel],
  58. sInfo[playerid][fraktion],
  59. sInfo[playerid][rang],
  60. sInfo[playerid][spawnchange],
  61. sInfo[playerid][perso],
  62. sInfo[playerid][job],
  63. sInfo[playerid][busskill],
  64. sInfo[playerid][busskilllevel],
  65. sInfo[playerid][pilotskill],
  66. sInfo[playerid][pilotskilllevel],
  67. sInfo[playerid][pRadio],
  68. sInfo[playerid][pSkin],
  69. sInfo[playerid][db_id]);
  70. mysql_function_query(dbhandle,query,false,"","");
  71. return 1;
  72. }
  73.  
  74. public OnPlayerSpawn(playerid)
  75. {
  76. TogglePlayerControllable(playerid, 1);
  77. if(IstSpielerInFraktion(playerid, 0))
  78. {
  79. SetPlayerPos(playerid, 377.3560,-2047.6115,7.8301); //Zivi Spawn
  80. TextDrawShowForPlayer(playerid, Infobackground);
  81. TextDrawShowForPlayer(playerid, Infologo);
  82. TextDrawShowForPlayer(playerid, Infoteamspeakip);
  83. TextDrawShowForPlayer(playerid, Infoforumadresse);
  84. TextDrawShowForPlayer(playerid, Infotrennstrich);
  85. TextDrawShowForPlayer(playerid, Infotrennstrich2);
  86. TextDrawShowForPlayer(playerid, Infoserverinfo);
  87. TextDrawShowForPlayer(playerid, Infoversion);
  88. SetPlayerSkin(playerid,sInfo[playerid][pSkin]);
  89. return 1;
  90. }
  91. //FRAKTIONEN!!!!!!!!!!!!!!!!!!!!!!!
  92. if(IstSpielerInFraktion(playerid, 1))//Medic
  93. {
  94. SetPlayerPos(playerid, 377.3560,-2047.6115,7.8301); //Medic Spawn
  95. GivePlayerWeapon(playerid,31,500);
  96. SetPlayerSkin(playerid,280);
  97. }
  98. if(IstSpielerInFraktion(playerid, 2))//LSPD
  99. {
  100. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); //LSPD Spawn
  101. GivePlayerWeapon(playerid,31,500);
  102. SetPlayerSkin(playerid,227);
  103. }
  104. if(IstSpielerInFraktion(playerid, 3))//SWAT
  105. {
  106. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); //SWAT Spawn
  107. GivePlayerWeapon(playerid,31,500);
  108. }
  109. return 1;
  110. }
  111.  
  112. ocmd:makeleader(playerid,params[])
  113. {
  114. if(sInfo[playerid][alevel] >= 5)
  115. {
  116. new pID, fID, str[128];
  117. if(sscanf(params,"ui",pID,fID))return SendClientMessage(playerid, COLOR_WHITE, "Benutzung: /makeleader [Spieler-ID/Name] [FraktionsID]");
  118. if(pID == INVALID_PLAYER_ID)return ErrorID(playerid);
  119. if(fID >= 12)return SendClientMessage(playerid, COLOR_RED, "Diese Fraktion exesitiert nicht!");
  120. sInfo[pID][fraktion] = fID;
  121. sInfo[pID][rang] = 6;
  122. format(str,128,"Admin %s hat Spieler %s zur Fraktion %i gemacht!",getPlayerName(playerid), getPlayerName(pID), fID);
  123. SendClientMessageToAll(COLOR_HELLBLAU, str);
  124. //pInfo[pID][spawn] = 1;
  125. SpawnPlayer(pID);
  126. }
  127. else
  128. {
  129. ErrorAdmin(playerid);
  130. }
  131. return 1;
  132. }
  133.  
  134. ocmd:invite(playerid,params[])
  135. {
  136. if(IstSpielerInFraktion(playerid, 0))return SendClientMessage(playerid,COLOR_RED,"Du bist in keiner Fraktion.");
  137. if(sInfo[playerid][rang] < 5)return SendClientMessage(playerid,COLOR_TUERKIS,"Dein Rang ist zu niedrig.");
  138. new pID, fID;
  139. fID = sInfo[playerid][fraktion];
  140. if(sscanf(params, "u", pID))return SendClientMessage(playerid,COLOR_TUERKIS,"Info: /invite SpielerID");
  141. if(!IstSpielerInFraktion(pID, 0))return SendClientMessage(playerid,COLOR_TUERKIS,"Spieler ist kein Zivilist.");
  142. new string[128];
  143. format(string,sizeof(string), "%s hat dich in die Fraktion eingeladen.", getPlayerName(playerid));
  144. SendClientMessage(pID, COLOR_TUERKIS, string);
  145. printf("%s hat %s in eine Fraktion eingeladen.",playerid,pID);
  146. SendClientMessage(pID, COLOR_TUERKIS,"Zum akzeptieren gebe /accept invite ein.");
  147. SetPVarInt(pID, "inv_fraktid", fID);
  148. SetPVarInt(pID, "inv_inviter", playerid);
  149. return 1;
  150. }
  151.  
  152. ocmd:uninvite(playerid,params[])
  153. {
  154. if(IstSpielerInFraktion(playerid, 0))return SendClientMessage(playerid,COLOR_RED,"Du bist in keiner Fraktion.");
  155. if(sInfo[playerid][rang] < 5)return SendClientMessage(playerid,COLOR_TUERKIS,"Dein Rang ist zu niedrig.");
  156. new pID;
  157. if(sscanf(params, "u", pID))return SendClientMessage(playerid,COLOR_TUERKIS,"Info: /uninvite SpielerID");
  158. if(!IstSpielerInFraktion(pID, sInfo[playerid][fraktion]))return SendClientMessage(playerid,COLOR_TUERKIS,"Spieler ist nicht in deiner Fraktion.");
  159. sInfo[pID][fraktion] = 0;
  160. sInfo[pID][rang] = 0;
  161. new string[128];
  162. format(string,sizeof(string),"Du wurdest von %s aus der Fraktion geworfen.",getPlayerName(playerid));
  163. SendClientMessage(playerid,COLOR_TUERKIS,string);
  164. format(string,sizeof(string),"Du hast %s aus deiner Fraktion geworfen.",getPlayerName(pID));
  165. SendClientMessage(playerid,COLOR_TUERKIS,string);
  166. return 1;
  167. }
  168.  
  169. public OnPasswordResponse(playerid)
  170. {
  171. new num_fields,num_rows;
  172. cache_get_data(num_rows,num_fields,dbhandle);
  173. if(num_rows==1)
  174. {
  175. //Passwort richtig //Spieler laden
  176. sInfo[playerid][eingeloggt] = 1;
  177. sInfo[playerid][level] = cache_get_field_content_int(0,"level",dbhandle);
  178. SetPlayerScore(playerid,sInfo[playerid][level]);
  179. sInfo[playerid][db_id] = cache_get_field_content_int(0,"id",dbhandle);
  180. SetPlayerMoney(playerid,cache_get_field_content_int(0,"money",dbhandle));
  181. sInfo[playerid][alevel] = cache_get_field_content_int(0,"alevel",dbhandle);
  182. sInfo[playerid][fraktion] = cache_get_field_content_int(0,"fraktion",dbhandle);
  183. sInfo[playerid][rang] = cache_get_field_content_int(0,"rang",dbhandle);
  184. sInfo[playerid][spawnchange] = cache_get_field_content_int(0,"spawnchange",dbhandle);
  185. sInfo[playerid][perso] = cache_get_field_content_int(0,"perso",dbhandle);
  186. sInfo[playerid][job] = cache_get_field_content_int(0,"job",dbhandle);
  187. sInfo[playerid][busskill] = cache_get_field_content_int(0,"busskill",dbhandle);
  188. sInfo[playerid][busskilllevel] = cache_get_field_content_int(0,"busskilllevel",dbhandle);
  189. sInfo[playerid][pilotskill] = cache_get_field_content_int(0,"pilotskill",dbhandle);
  190. sInfo[playerid][pilotskilllevel] = cache_get_field_content_int(0,"pilotskilllevel",dbhandle);
  191. sInfo[playerid][pRadio] = cache_get_field_content_int(0,"pRadio",dbhandle);
  192. sInfo[playerid][pSkin] = cache_get_field_content_int(0,"pSkin",dbhandle);
  193. SetPlayerSkin(playerid,sInfo[playerid][pSkin]);
  194. loadSpielerAutos(playerid);
  195. SpawnPlayer(playerid);
  196. }
  197. else
  198. {
  199. //Passwort falsch
  200. SendClientMessage(playerid,COLOR_RED,"Das eingegebene Passwort ist falsch.");
  201. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Okay","Abbrechen");
  202. }
  203. return 1;
  204. }
  205.  
  206. stock IstSpielerInFraktion(playerid, fraktionsid)
  207. {
  208. if(sInfo[playerid][fraktion] == fraktionsid) return 1;
  209. return 0;
  210. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement