Advertisement
Guest User

Untitled

a guest
May 16th, 2011
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.25 KB | None | 0 0
  1. forward INV_GetWeaponMaterials(playerid);
  2. forward INV_GetAmmoMaterials(playerid);
  3. forward INV_GetFishWeight(playerid);
  4. forward INV_GetPlayerStatistik(playerid);
  5.  
  6. public INV_GetWeaponMaterials(playerid)
  7. {
  8. new number[MAX_MATERIAL_SLOTS],length=sizeof(GrandCacheString),product=GetPVarInt(playerid,"InventarProduct"); GetPVarString(playerid,"SpielerWeaponRohlinge",StockString,length);
  9. sscanf(StockString,"p<;>a<d>["#MAX_MATERIAL_SLOTS"]",number);
  10. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,length,"%s\n\tWaffenrohlinge f¸r %s: %d%s (%0.fkg)",GrandCacheString,GetMaterialSlotName(x),number[x],InventarInfo[product][invEinheit],floatmul(number[x],InventarInfo[product][invGewicht]));
  11. return true;
  12. }
  13. public INV_GetAmmoMaterials(playerid)
  14. {
  15. new number[MAX_MATERIAL_SLOTS],length=sizeof(GrandCacheString),product=GetPVarInt(playerid,"InventarProduct"); GetPVarString(playerid,"SpielerAmmoMaterials",StockString,length);
  16. sscanf(StockString,"p<;>a<d>["#MAX_MATERIAL_SLOTS"]",number);
  17. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,length,"%s\n\tWaffenmunition f¸r %s: %d%s (%0.fkg)",GrandCacheString,GetMaterialSlotName(x),number[x],InventarInfo[product][invEinheit],floatmul(number[x],InventarInfo[product][invGewicht]));
  18. return true;
  19. }
  20. public INV_GetFishWeight(playerid)
  21. {
  22. new Float:PlayerFish[sizeof(FischInfo)],length=sizeof(GrandCacheString),product=GetPVarInt(playerid,"InventarProduct");
  23. GetPVarString(playerid,"SpielerRohFisch",StockString,sizeof(StockString)); sscanf(StockString,"p<;>A<f>(0)["#MAX_FISCH"]",PlayerFish);
  24. for(new x;x!=sizeof(FischInfo);x++) format(GrandCacheString,length,"%s\n\t%s: %0.f%s",GrandCacheString,FischInfo[x][fscName],PlayerFish[x],InventarInfo[product][invEinheit]);
  25. return true;
  26. }
  27. public INV_GetPlayerStatistik(playerid)
  28. {
  29. new fahrzeuge,length = sizeof(GrandCacheString),cost[2],x,PlayerKeys[MAX_PLAYER_KEYS],show=GetPVarInt(playerid,"InventarProduct")-gSlotBegin[GetPVarInt(playerid,"InventarSlot")];
  30. if(show>=0) //Personalien
  31. {
  32. format(GrandCacheString,length,"%s\n\nInGame Daten:",GrandCacheString);
  33. format(GrandCacheString,length,"%s\n\tNickName: %s\n\tLevel: %d\n\tRespektpunkte: %d",GrandCacheString,GetName(playerid),GetPVarInt(playerid,"SpielerLevel"),GetPVarInt(playerid,"SpielerRespekt"));
  34. if(GetPVarInt(playerid,"SpielerBranche")>0) format(GrandCacheString,length,"%s\n\tMitglied bei %s\n\tRang: %s",GrandCacheString,FInfo[GetPVarInt(playerid,"SpielerBranche")][fName],FInfoRang[GetPVarInt(playerid,"SpielerBranche")][GetPVarInt(playerid,"SpielerStufe")]);
  35. format(GrandCacheString,length,"%s\n\tAdminLevel: %d",GrandCacheString,GetPVarInt(playerid,"SpielerAdmin"));
  36. }
  37. if(show>=1) //Vermˆgen
  38. {
  39. format(GrandCacheString,length,"%s\n\nVermˆgen:",GrandCacheString);
  40. GetPVarString(playerid,"SpielerVehicleKeys",StockString,sizeof(StockString));
  41. sscanf(StockString,"p<,>a<i>["#MAX_PLAYER_KEYS"]",PlayerKeys);
  42. for(x=0;x!=MAX_PLAYER_KEYS;x++)
  43. {
  44. if(PlayerKeys[x]!=-1) {cost[0]+=GetVVarInt(PlayerKeys[x],"VehicleCost"); fahrzeuge++;}
  45. }
  46. if(GetPVarInt(playerid,"SpielerUnterkunft")>-1) cost[1]=HInfo[GetPVarInt(playerid,"SpielerUnterkunft")][hPreis]+HInfo[GetPVarInt(playerid,"SpielerUnterkunft")][hKassa];
  47. format(GrandCacheString,length,"%s\n\tBargeld: %d$\n\tQuick: %d$\n\tUnterkunftswert: %d$\n\tFahrzeugvermˆgen: %d$ (%d Fahrzeuge)",GrandCacheString,GetPlayerMoney(playerid),GetPVarInt(playerid,"SpielerQuick"),cost[1],cost[0],fahrzeuge);
  48. }
  49. return true;
  50. }
  51.  
  52. //Zusatdefines
  53. forward INV_OnGameModeInit();
  54. forward INV_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
  55.  
  56. public OnGameModeInit()
  57. {
  58. print("-> Bereite Inventar vor...");
  59. new oldslot=-1,x;
  60. for(x=0;x!=sizeof(InventarInfo);x++)
  61. {
  62. if(InventarInfo[x][invKategorie]!=oldslot)
  63. {
  64. oldslot=InventarInfo[x][invKategorie]; gSlotBegin[oldslot]=x;
  65. printf("For Slot %d Found Product %d",oldslot,x);
  66. }
  67. }
  68. return CallLocalFunction("INV_OnGameModeInit","");
  69. }
  70.  
  71. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  72. {
  73. DeletePVar(playerid,"PlayerInDialog");
  74. if(dialogid==InventarDialog)
  75. {
  76. switch(GetPVarInt(playerid,"PlayerStep"))
  77. {
  78. case 1:
  79. {
  80. if(!response) return DeletePVar(playerid,"PlayerStep");
  81. switch(listitem)
  82. {
  83. case 0:
  84. {
  85. SetPVarInt(playerid,"PlayerStep",1);
  86. return ShowPlayerDialog(playerid,SchluesselDialog,DIALOG_STYLE_LIST,"Schl¸ssel",SchluesselText,"Fortfahren","Zur¸ck");
  87. }
  88. default:
  89. {
  90. SetPVarInt(playerid,"InventarSlot",listitem); SetPVarInt(playerid,"PlayerStep",2);
  91. for(new x=gSlotBegin[listitem];x!=gSlotBegin[listitem+1];x++)
  92. {
  93. if(x==gSlotBegin[listitem]) format(GrandCacheString,sizeof(GrandCacheString),"%s",InventarInfo[x][invHeader]);
  94. else format(GrandCacheString,sizeof(GrandCacheString),"%s\n%s",GrandCacheString,InventarInfo[x][invHeader]);
  95. }
  96. return ShowPlayerDialog(playerid,InventarDialog,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  97. }
  98. }
  99. }
  100. case 2:
  101. {
  102. if(!response)
  103. {
  104. SetPVarInt(playerid,"PlayerStep",1); DeletePVar(playerid,"InventarSlot");
  105. return ShowPlayerDialog(playerid,InventarDialog,DIALOG_STYLE_LIST,"Inventar",InventarDialogText,"Fortfahren","Zur¸ck");
  106. }
  107. new product = gSlotBegin[GetPVarInt(playerid,"InventarSlot")]+listitem,bool:check; SetPVarInt(playerid,"InventarProduct",product); SetPVarInt(playerid,"PlayerStep",3);
  108. check = (CallLocalFunction(InventarInfo[GetPVarInt(playerid,"InventarProduct")][invSlotName],"d",playerid)==1?true:false);
  109. return CreateProductInfoForPlayer(playerid,GetPVarInt(playerid,"InventarProduct"),check);
  110. }
  111. case 3:
  112. {
  113. new product = GetPVarInt(playerid,"InventarProduct");
  114. if(!response||InventarInfo[product][invEditTyp]==-1)
  115. {
  116. SetPVarInt(playerid,"PlayerStep",2); DeletePVar(playerid,"InventarProduct");
  117. for(new x=gSlotBegin[GetPVarInt(playerid,"InventarSlot")];x!=gSlotBegin[GetPVarInt(playerid,"InventarSlot")+1];x++)
  118. {
  119. if(x==gSlotBegin[GetPVarInt(playerid,"InventarSlot")]) format(GrandCacheString,sizeof(GrandCacheString),"%s",InventarInfo[x][invHeader]);
  120. else format(GrandCacheString,sizeof(GrandCacheString),"%s\n%s",GrandCacheString,InventarInfo[x][invHeader]);
  121. }
  122. return ShowPlayerDialog(playerid,InventarDialog,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  123. }
  124. SetPVarInt(playerid,"PlayerStep",1); SetPVarInt(playerid,"InventarEdit",InventarInfo[product][invEditTyp]);
  125. return ShowInventarEditDialog(playerid);
  126. }
  127. }
  128. return 1;
  129. }
  130. if(dialogid==InventarDialogExt)
  131. {
  132. if(!response&&GetPVarInt(playerid,"PlayerStep")==1)
  133. {
  134. new bool:check = (CallLocalFunction(InventarInfo[GetPVarInt(playerid,"InventarProduct")][invSlotName],"d",playerid)==1?true:false); SetPVarInt(playerid,"PlayerStep",3);
  135. return CreateProductInfoForPlayer(playerid,GetPVarInt(playerid,"InventarProduct"),check);
  136. }
  137. switch(GetPVarInt(playerid,"InventarEdit"))
  138. {
  139. case 0:
  140. {
  141. switch(GetPVarInt(playerid,"PlayerStep"))
  142. {
  143. case 1:
  144. {
  145. switch(listitem)
  146. {
  147. case 0:
  148. {
  149. SetPVarInt(playerid,"PlayerStep",10);
  150. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Rohlinge mˆchten Sie verkaufen?");
  151. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  152. ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  153. }
  154. case 1:
  155. {
  156. SetPVarInt(playerid,"PlayerStep",20);
  157. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Rohlinge mˆchten Sie wegwerfen?");
  158. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  159. ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  160. }
  161. }
  162. return 1;
  163. }
  164. case 10:
  165. {
  166. if(!response)
  167. {
  168. SetPVarInt(playerid,"PlayerStep",1);
  169. return ShowInventarEditDialog(playerid);
  170. }
  171. if(listitem==0)
  172. {
  173. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Rohlinge mˆchten Sie verkaufen?");
  174. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  175. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  176. }
  177. SetPVarInt(playerid,"ChosenRohlingSlot",listitem-1); SetPVarInt(playerid,"PlayerStep",11);
  178. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, an welchen Spieler wieviele Rohlinge um welchen Geldbetrag von %s geben mˆchten.\nDer K‰ufer muss f¸r diesen Gesch‰ftsfall in der N‰he sein.\n\nVERWENDUNG: [Spieler ID/Name] [Menge] [Verkaufspreis]",GetMaterialSlotName(listitem-1));
  179. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Angebot","Zur¸ck");
  180. }
  181. case 11:
  182. {
  183. if(!response)
  184. {
  185. DeletePVar(playerid,"ChosenRohlingSlot"); SetPVarInt(playerid,"PlayerStep",10);
  186. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Rohlinge mˆchten Sie verkaufen?");
  187. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  188. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  189. }
  190. SetPVarInt(playerid,"PlayerStep",12);
  191. new giveplayerid,menge,geld,number[MAX_MATERIAL_SLOTS],Float:PlayerPos[3],slot=GetPVarInt(playerid,"ChosenRohlingSlot");
  192. GetPVarString(playerid,"SpielerWeaponRohlinge",StockString,sizeof(StockString)); GetPlayerPos(playerid,PlayerPos[0],PlayerPos[1],PlayerPos[2]);
  193. sscanf(StockString,"p<;>a<d>["#MAX_MATERIAL_SLOTS"]",number);
  194. if(sscanf(inputtext,"ud",giveplayerid,menge)) format(FormatString,sizeof(FormatString),"‹berpr¸fen Sie Ihre Eingabe...\nINFO: Mˆglich ist es, dass der angegebene Spieler nicht am Server ist!");
  195. else if(!IsPlayerInRangeOfPoint(giveplayerid,5.0,PlayerPos[0],PlayerPos[1],PlayerPos[2])) format(FormatString,sizeof(FormatString),"K‰ufer %s ist nicht in Ihrer N‰he...",GetName(giveplayerid));
  196. else if(menge<1||menge>number[slot]) format(FormatString,sizeof(FormatString),"Sie haben keine %d Rohlinge der %s...",menge,GetMaterialSlotName(slot));
  197. else if(geld<0||geld>999999) format(FormatString,sizeof(FormatString),"Ihr Geldbetrag %d ist unzul‰ssig...",geld);
  198. else
  199. {
  200. DeletePVar(playerid,"ChosenRohlingSlot"); SetPVarInt(playerid,"PlayerStep",1);
  201. SetPVarInt(playerid,"AngebotRohlingeSpieler",giveplayerid); SetPVarInt(playerid,"AngebotRohlingeSlot",slot);
  202. SetPVarInt(playerid,"AngebotRohlingeMenge",menge); SetPVarInt(playerid,"AngebotRohlingeWert",geld);
  203. format(FormatString,sizeof(FormatString),"* Sie bieten %s %d Rohling(e) der %s f¸r %d$ an.",GetName(giveplayerid),menge,GetMaterialSlotName(slot),geld);
  204. SendClientMessage(playerid,COLOR_YELLOW,FormatString);
  205. format(FormatString,sizeof(FormatString),"* %s bietet Ihnen %d Rohling(e) der %s f¸r %d$ an. (/rohlinge munition %d)",GetName(playerid),menge,GetMaterialSlotName(slot),geld,playerid);
  206. SendClientMessage(giveplayerid,COLOR_YELLOW,FormatString);
  207. return ShowInventarEditDialog(playerid);
  208. }
  209. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_MSGBOX,"Inventar",FormatString,"Zur¸ck","");
  210. }
  211. case 12:
  212. {
  213. SetPVarInt(playerid,"PlayerStep",11);
  214. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, an welchen Spieler wieviele Rohlinge um welchen Geldbetrag von %s geben mˆchten.\nDer K‰ufer muss f¸r diesen Gesch‰ftsfall in der N‰he sein.\n\nVERWENDUNG: [Spieler ID/Name] [Menge] [Verkaufspreis]",GetMaterialSlotName(GetPVarInt(playerid,"ChosenRohlingSlot")));
  215. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Angebot","Zur¸ck");
  216. }
  217. case 20:
  218. {
  219. if(!response)
  220. {
  221. SetPVarInt(playerid,"PlayerStep",1);
  222. return ShowInventarEditDialog(playerid);
  223. }
  224. if(listitem==0)
  225. {
  226. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Rohlinge mˆchten Sie wegwerfen?");
  227. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  228. ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  229. }
  230. SetPVarInt(playerid,"ChosenRohlingSlot",listitem-1); SetPVarInt(playerid,"PlayerStep",21);
  231. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, wieviel Munition der %s Sie wegwerfen mˆchten.\n\nVERWENDUNG: [Menge]",GetMaterialSlotName(listitem-1));
  232. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Wegwerfen","Zur¸ck");
  233. }
  234. case 21:
  235. {
  236. if(!response)
  237. {
  238. SetPVarInt(playerid,"PlayerStep",20); DeletePVar(playerid,"ChosenRohlingSlot");
  239. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Rohlinge mˆchten Sie wegwerfen?");
  240. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  241. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  242. }
  243. new number[MAX_MATERIAL_SLOTS],menge,slot=GetPVarInt(playerid,"ChosenRohlingSlot");
  244. GetPVarString(playerid,"SpielerWeaponRohlinge",StockString,sizeof(StockString));
  245. sscanf(StockString,"p<;>a<d>["#MAX_MATERIAL_SLOTS"]",number);
  246. SetPVarInt(playerid,"PlayerStep",22);
  247. if(sscanf(inputtext,"d",menge)) format(FormatString,sizeof(FormatString),"Ihre Eingabe darf nur die Zahl der Menge haben, jene Sie wegwerfen mˆchten...");
  248. else if(menge<1||menge>number[slot]) format(FormatString,sizeof(FormatString),"Sie haben keine %d Rohlinge der %s zum wegwerfen...",menge,GetMaterialSlotName(slot));
  249. else
  250. {
  251. EditWeaponMaterialsForPlayer(playerid,slot,-menge); SetPVarInt(playerid,"PlayerStep",1); DeletePVar(playerid,"ChosenRohlingSlot");
  252. format(FormatString,sizeof(FormatString),"* Sie haben %d Rohlinge der %s weggeworfen.",menge,GetMaterialSlotName(slot));
  253. SendClientMessage(playerid,COLOR_ORANGE,FormatString);
  254. return ShowInventarEditDialog(playerid);
  255. }
  256. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_MSGBOX,"Inventar",FormatString,"Zur¸ck","");
  257. }
  258. case 22:
  259. {
  260. SetPVarInt(playerid,"PlayerStep",21);
  261. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, wieviel Munition der %s Sie wegwerfen mˆchten.\n\nVERWENDUNG: [Menge]",GetMaterialSlotName(GetPVarInt(playerid,"ChosenRohlingSlot")));
  262. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Wegwerfen","Zur¸ck");
  263. }
  264. }
  265. }
  266. case 1:
  267. {
  268. switch(GetPVarInt(playerid,"PlayerStep"))
  269. {
  270. case 1:
  271. {
  272. switch(listitem)
  273. {
  274. case 0:
  275. {
  276. SetPVarInt(playerid,"PlayerStep",10);
  277. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Munition mˆchten Sie verkaufen?");
  278. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  279. ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  280. }
  281. case 1:
  282. {
  283. SetPVarInt(playerid,"PlayerStep",20);
  284. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Munition mˆchten Sie wegwerfen?");
  285. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  286. ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  287. }
  288. }
  289. return 1;
  290. }
  291. case 10:
  292. {
  293. if(!response)
  294. {
  295. SetPVarInt(playerid,"PlayerStep",1);
  296. return ShowInventarEditDialog(playerid);
  297. }
  298. if(listitem==0)
  299. {
  300. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Munition mˆchten Sie verkaufen?");
  301. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  302. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  303. }
  304. SetPVarInt(playerid,"ChosenRohlingSlot",listitem-1); SetPVarInt(playerid,"PlayerStep",11);
  305. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, an welchen Spieler wieviele Munition um welchen Geldbetrag von %s geben mˆchten.\nDer K‰ufer muss f¸r diesen Gesch‰ftsfall in der N‰he sein.\n\nVERWENDUNG: [Spieler ID/Name] [Menge] [Verkaufspreis]",GetMaterialSlotName(listitem-1));
  306. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Angebot","Zur¸ck");
  307. }
  308. case 11:
  309. {
  310. if(!response)
  311. {
  312. DeletePVar(playerid,"ChosenRohlingSlot"); SetPVarInt(playerid,"PlayerStep",10);
  313. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Munition mˆchten Sie verkaufen?");
  314. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  315. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  316. }
  317. SetPVarInt(playerid,"PlayerStep",12);
  318. new giveplayerid,menge,geld,number[MAX_MATERIAL_SLOTS],Float:PlayerPos[3],slot=GetPVarInt(playerid,"ChosenRohlingSlot");
  319. GetPVarString(playerid,"SpielerAmmoMaterials",StockString,sizeof(StockString)); GetPlayerPos(playerid,PlayerPos[0],PlayerPos[1],PlayerPos[2]);
  320. sscanf(StockString,"p<;>a<d>["#MAX_MATERIAL_SLOTS"]",number);
  321. if(sscanf(inputtext,"ud",giveplayerid,menge)) format(FormatString,sizeof(FormatString),"‹berpr¸fen Sie Ihre Eingabe...\nINFO: Mˆglich ist es, dass der angegebene Spieler nicht am Server ist!");
  322. else if(!IsPlayerInRangeOfPoint(giveplayerid,5.0,PlayerPos[0],PlayerPos[1],PlayerPos[2])) format(FormatString,sizeof(FormatString),"K‰ufer %s ist nicht in Ihrer N‰he...",GetName(giveplayerid));
  323. else if(menge<1||menge>number[slot]) format(FormatString,sizeof(FormatString),"Sie haben keine %d Munition der %s...",menge,GetMaterialSlotName(slot));
  324. else if(geld<0||geld>999999) format(FormatString,sizeof(FormatString),"Ihr Geldbetrag %d ist unzul‰ssig...",geld);
  325. else
  326. {
  327. DeletePVar(playerid,"ChosenRohlingSlot"); SetPVarInt(playerid,"PlayerStep",1);
  328. SetPVarInt(playerid,"AngebotMunitionSpieler",giveplayerid); SetPVarInt(playerid,"AngebotMunitionSlot",slot);
  329. SetPVarInt(playerid,"AngebotMunitionMenge",menge); SetPVarInt(playerid,"AngebotMunitionWert",geld);
  330. format(FormatString,sizeof(FormatString),"* Sie bieten %s %d Munition(e) der %s f¸r %d$ an.",GetName(giveplayerid),menge,GetMaterialSlotName(slot),geld);
  331. SendClientMessage(playerid,COLOR_YELLOW,FormatString);
  332. format(FormatString,sizeof(FormatString),"* %s bietet Ihnen %d Munition(e) der %s f¸r %d$ an. (/munition annehmen %d)",GetName(playerid),menge,GetMaterialSlotName(slot),geld,playerid);
  333. SendClientMessage(giveplayerid,COLOR_YELLOW,FormatString);
  334. return ShowInventarEditDialog(playerid);
  335. }
  336. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_MSGBOX,"Inventar",FormatString,"Zur¸ck","");
  337. }
  338. case 12:
  339. {
  340. SetPVarInt(playerid,"PlayerStep",11);
  341. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, an welchen Spieler wieviel Munition um welchen Geldbetrag von %s geben mˆchten.\nDer K‰ufer muss f¸r diesen Gesch‰ftsfall in der N‰he sein.\n\nVERWENDUNG: [Spieler ID/Name] [Menge] [Verkaufspreis]",GetMaterialSlotName(GetPVarInt(playerid,"ChosenRohlingSlot")));
  342. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Angebot","Zur¸ck");
  343. }
  344. case 20:
  345. {
  346. if(!response)
  347. {
  348. SetPVarInt(playerid,"PlayerStep",1);
  349. return ShowInventarEditDialog(playerid);
  350. }
  351. if(listitem==0)
  352. {
  353. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Munition mˆchten Sie wegwerfen?");
  354. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  355. ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  356. }
  357. SetPVarInt(playerid,"ChosenRohlingSlot",listitem-1); SetPVarInt(playerid,"PlayerStep",21);
  358. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, wieviel Munition der %s Sie wegwerfen mˆchten.\n\nVERWENDUNG: [Menge]",GetMaterialSlotName(listitem-1));
  359. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Wegwerfen","Zur¸ck");
  360. }
  361. case 21:
  362. {
  363. if(!response)
  364. {
  365. SetPVarInt(playerid,"PlayerStep",20); DeletePVar(playerid,"ChosenRohlingSlot");
  366. format(GrandCacheString,sizeof(GrandCacheString),"Von welcher Art der Munition mˆchten Sie wegwerfen?");
  367. for(new x;x!=MAX_MATERIAL_SLOTS;x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,GetMaterialSlotName(x));
  368. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  369. }
  370. new number[MAX_MATERIAL_SLOTS],menge,slot=GetPVarInt(playerid,"ChosenRohlingSlot");
  371. GetPVarString(playerid,"SpielerAmmoMaterials",StockString,sizeof(StockString));
  372. sscanf(StockString,"p<;>a<d>["#MAX_MATERIAL_SLOTS"]",number);
  373. SetPVarInt(playerid,"PlayerStep",22);
  374. if(sscanf(inputtext,"d",menge)) format(FormatString,sizeof(FormatString),"Ihre Eingabe darf nur die Zahl der Menge haben, jene Sie wegwerfen mˆchten...");
  375. else if(menge<1||menge>number[slot]) format(FormatString,sizeof(FormatString),"Sie haben keine %d Munition der %s zum wegwerfen...",menge,GetMaterialSlotName(slot));
  376. else
  377. {
  378. EditAmmoMaterialsForPlayer(playerid,slot,-menge); SetPVarInt(playerid,"PlayerStep",1); DeletePVar(playerid,"ChosenRohlingSlot");
  379. format(FormatString,sizeof(FormatString),"* Sie haben %d Munition der %s weggeworfen.",menge,GetMaterialSlotName(slot));
  380. SendClientMessage(playerid,COLOR_ORANGE,FormatString);
  381. return ShowInventarEditDialog(playerid);
  382. }
  383. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_MSGBOX,"Inventar",FormatString,"Zur¸ck","");
  384. }
  385. case 22:
  386. {
  387. SetPVarInt(playerid,"PlayerStep",21);
  388. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, wieviel Munition der %s Sie wegwerfen mˆchten.\n\nVERWENDUNG: [Menge]",GetMaterialSlotName(GetPVarInt(playerid,"ChosenRohlingSlot")));
  389. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_MSGBOX,"Inventar",GrandCacheString,"Wegwerfen","Zur¸ck");
  390. }
  391. }
  392. }
  393. case 2:
  394. {
  395. switch(GetPVarInt(playerid,"PlayerStep"))
  396. {
  397. case 1:
  398. {
  399. switch(listitem)
  400. {
  401. case 0:
  402. {
  403. SetPVarInt(playerid,"PlayerStep",10);
  404. format(GrandCacheString,sizeof(GrandCacheString),"Welche Art von Fisch mˆchten Sie verkaufen?");
  405. for(new x;x!=sizeof(FischInfo);x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,FischInfo[x][fscName]);
  406. ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  407. }
  408. case 1:
  409. {
  410. SetPVarInt(playerid,"PlayerStep",20);
  411. format(GrandCacheString,sizeof(GrandCacheString),"Welche Art von Fisch mˆchten Sie wegwerfen?");
  412. for(new x;x!=sizeof(FischInfo);x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,FischInfo[x][fscName]);
  413. ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  414. }
  415. }
  416. return 1;
  417. }
  418. case 10:
  419. {
  420. if(!response)
  421. {
  422. SetPVarInt(playerid,"PlayerStep",1);
  423. return ShowInventarEditDialog(playerid);
  424. }
  425. if(listitem==0)
  426. {
  427. format(GrandCacheString,sizeof(GrandCacheString),"Welche Art von Fisch mˆchten Sie verkaufen?");
  428. for(new x;x!=sizeof(FischInfo);x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,FischInfo[x][fscName]);
  429. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  430. }
  431. SetPVarInt(playerid,"ChosenFischSlot",listitem-1); SetPVarInt(playerid,"PlayerStep",11);
  432. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, an welchen Spieler wieviele rohen Fisch um welchen Geldbetrag vom %s geben mˆchten.\nDer K‰ufer muss f¸r diesen Gesch‰ftsfall in der N‰he sein.\n\nVERWENDUNG: [Spieler ID/Name] [Menge] [Verkaufspreis]",FischInfo[listitem-1][fscName]);
  433. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Angebot","Zur¸ck");
  434. }
  435. case 11:
  436. {
  437. if(!response)
  438. {
  439. DeletePVar(playerid,"ChosenFischSlot"); SetPVarInt(playerid,"PlayerStep",10);
  440. format(GrandCacheString,sizeof(GrandCacheString),"Welche Art von Fisch mˆchten Sie verkaufen?");
  441. for(new x;x!=sizeof(FischInfo);x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,FischInfo[x][fscName]);
  442. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  443. }
  444. SetPVarInt(playerid,"PlayerStep",12);
  445. new giveplayerid,Float:menge,geld,Float:number[sizeof(FischInfo)],Float:PlayerPos[3],slot=GetPVarInt(playerid,"ChosenFischSlot");
  446. GetPVarString(playerid,"SpielerRohFisch",StockString,sizeof(StockString)); GetPlayerPos(playerid,PlayerPos[0],PlayerPos[1],PlayerPos[2]);
  447. sscanf(StockString,"p<;>A<f>(0)["#MAX_FISCH"]",number);
  448. if(sscanf(inputtext,"ud",giveplayerid,menge)) format(FormatString,sizeof(FormatString),"‹berpr¸fen Sie Ihre Eingabe...\nINFO: Mˆglich ist es, dass der angegebene Spieler nicht am Server ist!");
  449. else if(!IsPlayerInRangeOfPoint(giveplayerid,5.0,PlayerPos[0],PlayerPos[1],PlayerPos[2])) format(FormatString,sizeof(FormatString),"K‰ufer %s ist nicht in Ihrer N‰he...",GetName(giveplayerid));
  450. else if(menge<1||menge>number[slot]) format(FormatString,sizeof(FormatString),"Sie haben keine %0.fkg rohen Fisch vom %s...",menge,FischInfo[slot][fscName]);
  451. else if(geld<0||geld>999999) format(FormatString,sizeof(FormatString),"Ihr Geldbetrag %d ist unzul‰ssig...",geld);
  452. else
  453. {
  454. DeletePVar(playerid,"ChosenFischSlot"); SetPVarInt(playerid,"PlayerStep",1);
  455. SetPVarInt(playerid,"AngebotFischSpieler",giveplayerid); SetPVarInt(playerid,"AngebotFischSlot",slot);
  456. SetPVarFloat(playerid,"AngebotFischMenge",menge); SetPVarInt(playerid,"AngebotFischWert",geld);
  457. format(FormatString,sizeof(FormatString),"* Sie bieten %s %0.fkg rohen Fisch vom %s f¸r %d$ an.",GetName(giveplayerid),menge,FischInfo[slot][fscName],geld);
  458. SendClientMessage(playerid,COLOR_YELLOW,FormatString);
  459. format(FormatString,sizeof(FormatString),"* %s bietet Ihnen %0.f rohen Fisch vom %s f¸r %d$ an. (/munition annehmen %d)",GetName(playerid),menge,FischInfo[slot][fscName],geld,playerid);
  460. SendClientMessage(playerid,COLOR_YELLOW,FormatString);
  461. return ShowInventarEditDialog(playerid);
  462. }
  463. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_MSGBOX,"Inventar",FormatString,"Zur¸ck","");
  464. }
  465. case 12:
  466. {
  467. SetPVarInt(playerid,"PlayerStep",11);
  468. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, an welchen Spieler wieviel rohen Fisch um welchen Geldbetrag vom %s geben mˆchten.\nDer K‰ufer muss f¸r diesen Gesch‰ftsfall in der N‰he sein.\n\nVERWENDUNG: [Spieler ID/Name] [Menge] [Verkaufspreis]",FischInfo[GetPVarInt(playerid,"ChosenFischSlot")][fscName]);
  469. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Angebot","Zur¸ck");
  470. }
  471. case 20:
  472. {
  473. if(!response)
  474. {
  475. SetPVarInt(playerid,"PlayerStep",1);
  476. return ShowInventarEditDialog(playerid);
  477. }
  478. if(listitem==0)
  479. {
  480. format(GrandCacheString,sizeof(GrandCacheString),"Welche Art von Fisch mˆchten Sie wegwerfen?");
  481. for(new x;x!=sizeof(FischInfo);x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,FischInfo[x][fscName]);
  482. ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  483. }
  484. SetPVarInt(playerid,"ChosenFischSlot",listitem-1); SetPVarInt(playerid,"PlayerStep",21);
  485. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, wieviel rohen Fisch vom %s Sie wegwerfen mˆchten.\n\nVERWENDUNG: [Menge]",FischInfo[listitem-1][fscName]);
  486. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_INPUT,"Inventar",GrandCacheString,"Wegwerfen","Zur¸ck");
  487. }
  488. case 21:
  489. {
  490. if(!response)
  491. {
  492. SetPVarInt(playerid,"PlayerStep",20); DeletePVar(playerid,"ChosenFischSlot");
  493. format(GrandCacheString,sizeof(GrandCacheString),"Welche Art von Fisch mˆchten Sie wegwerfen?");
  494. for(new x;x!=sizeof(FischInfo);x++) format(GrandCacheString,sizeof(GrandCacheString),"%s\n-> %s",GrandCacheString,FischInfo[x][fscName]);
  495. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar",GrandCacheString,"Fortfahren","Zur¸ck");
  496. }
  497. new Float:number[sizeof(FischInfo)],Float:menge,slot=GetPVarInt(playerid,"ChosenFischSlot");
  498. GetPVarString(playerid,"SpielerRohFisch",StockString,sizeof(StockString));
  499. sscanf(StockString,"p<;>A<f>(0)["#MAX_FISCH"]",number);
  500. SetPVarInt(playerid,"PlayerStep",22);
  501. if(sscanf(inputtext,"f",menge)) format(FormatString,sizeof(FormatString),"Ihre Eingabe darf nur die Zahl der Menge haben, jene Sie wegwerfen mˆchten...");
  502. else if(menge<0|| menge>number[slot]) format(FormatString,sizeof(FormatString),"Sie haben keine %2.fkg rohen Fisch vom %s zum wegwerfen...",menge,FischInfo[slot][fscName]);
  503. else
  504. {
  505. EditRohFishForPlayer(playerid,slot,-menge); SetPVarInt(playerid,"PlayerStep",1); DeletePVar(playerid,"ChosenFischSlot");
  506. format(FormatString,sizeof(FormatString),"* Sie haben %2.fkg rohen Fisch vom %s weggeworfen.",menge,FischInfo[slot][fscName]);
  507. SendClientMessage(playerid,COLOR_ORANGE,FormatString);
  508. return ShowInventarEditDialog(playerid);
  509. }
  510. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_MSGBOX,"Inventar",FormatString,"Zur¸ck","");
  511. }
  512. case 22:
  513. {
  514. SetPVarInt(playerid,"PlayerStep",21);
  515. format(GrandCacheString,sizeof(GrandCacheString),"Geben Sie nun an, wieviel rohen Fisch vom %s Sie wegwerfen mˆchten.\n\nVERWENDUNG: [Menge]",FischInfo[GetPVarInt(playerid,"ChosenFischSlot")][fscName]);
  516. return ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_MSGBOX,"Inventar",GrandCacheString,"Wegwerfen","Zur¸ck");
  517. }
  518. }
  519. }
  520. }
  521. }
  522. return CallLocalFunction("INV_OnDialogResponse","dddds",playerid, dialogid, response, listitem, inputtext);
  523. }
  524. ShowInventarEditDialog(playerid)
  525. {
  526. switch(GetPVarInt(playerid,"InventarEdit"))
  527. {
  528. //Weapon Materials
  529. case 0: ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar","Rohlinge verkaufen\nRohlinge wegwerfen","Fortfahren","Zur¸ck");
  530. //Ammo Materials
  531. case 1: ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar","Munition verkaufen\nMunition wegwerfen","Fortfahren","Zur¸ck");
  532. //Roher Fisch
  533. case 2: ShowPlayerDialog(playerid,InventarDialogExt,DIALOG_STYLE_LIST,"Inventar","Rohen Fisch verkaufen\nRohen Fisch wegwerfen","Fortfahren","Zur¸ck");
  534. }
  535. return true;
  536. }
  537. CreateProductInfoForPlayer(playerid,product,bool:function)
  538. {
  539. new length = sizeof(GrandCacheString);
  540. format(GrandCacheString,length,"Sie haben folgende(n) %s:\n\n",InventarInfo[product][invHeader]);
  541. if(function) CallLocalFunction(InventarInfo[product][invSlotName],"d",playerid);
  542. else
  543. {
  544. switch(InventarInfo[product][invTyp])
  545. {
  546. case 0: format(GrandCacheString,length,"%s%d%s",GrandCacheString,GetPVarInt(playerid,InventarInfo[product][invVariable]),InventarInfo[product][invEinheit]);
  547. case 1: format(GrandCacheString,length,"%s%f%s",GrandCacheString,GetPVarFloat(playerid,InventarInfo[product][invVariable]),InventarInfo[product][invEinheit]);
  548. }
  549. }
  550. if(InventarInfo[product][invEditTyp]!=-1)
  551. {
  552. format(GrandCacheString,length,"%s\n\nINFO: Klicken Sie auf 'Eigenschaften' um die Produkteigenschaften einzusehen.",GrandCacheString);
  553. ShowPlayerDialog(playerid,InventarDialog,DIALOG_STYLE_MSGBOX,"Inventar",GrandCacheString,"Eigenschaften","Zur¸ck");
  554. }
  555. else ShowPlayerDialog(playerid,InventarDialog,DIALOG_STYLE_MSGBOX,"Inventar",GrandCacheString,"Zur¸ck","");
  556. return 1;
  557. }
  558. GetInventarIDByName(variable[])
  559. {
  560. for(new x;x!=sizeof(InventarInfo);x++)
  561. {
  562. if(!strcmp(InventarInfo[x][invVariable],variable,false)) return x;
  563. }
  564. return -1;
  565. }
  566.  
  567.  
  568. #if defined _ALS_OnGameModeInit
  569. #undef OnGameModeInit
  570. #else
  571. #define _ALS_OnGameModeInit
  572. #endif
  573. #define OnGameModeInit INV_OnGameModeInit
  574.  
  575. #if defined _ALS_OnDialogResponse
  576. #undef OnDialogResponse
  577. #else
  578. #define _ALS_OnDialogResponse
  579. #endif
  580. #define OnDialogResponse INV_OnDialogResponse
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement