BlueX

items esboço.

Jan 19th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. /*----------------------------------------------------------------------------*\
  2. ==============================
  3. system_items.p
  4. ==============================
  5.  
  6. Descrição: Sistema base do jogador, contém comandos e coisas básicas em si.
  7.  
  8. Declaração de callbacks: item_
  9. Declaração de respostas: r@
  10. Declaração de váriaveis: item_
  11.  
  12. Dynamic Roleplay - BlueX (c)
  13. \*----------------------------------------------------------------------------*/
  14.  
  15. #include <bcmd>
  16.  
  17. new item_actual_id = -1;
  18.  
  19. //debug
  20. /*
  21. enum {
  22.  
  23. ITEM_MODEL_TELEVISION = 2312,
  24. ITEM_MODEL_WASHER = 1208,
  25. ITEM_MODEL_SAFE = 1829,
  26. ITEM_MODEL_DEAGLE = 348,
  27. ITEM_MODEL_M4 = 356,
  28. ITEM_MODEL_AMMO = 1477,
  29. ITEM_MODEL_BULLETS = 2061
  30. };
  31. */
  32. isbullet(model){
  33. if(model == 1477 || model == 2061) return 1;
  34. return 0;
  35. }
  36.  
  37. getweapon(model){
  38. if(model == 348) return 24;
  39. else if(model == 356) return 31;
  40. return 0;
  41. }
  42.  
  43. isweapon(model){
  44. if(model == 348 && model == 356) return 1;
  45. return 0;
  46. }
  47.  
  48. getobject(model){
  49. static _string[30];
  50. if(model == 2312)
  51. strins(_string,"ITEM_MODEL_TELEVISION",0);
  52. else if(model == 1208)
  53. strins(_string,"ITEM_MODEL_WASHER",0);
  54. else if(model == 1829)
  55. strins(_string,"ITEM_MODEL_SAFE",0);
  56. else if(model == 348)
  57. strins(_string,"ITEM_MODEL_DEAGLE",0);
  58. else if(model == 356)
  59. strins(_string,"ITEM_MODEL_M4",0);
  60. else if(model == 1477)
  61. strins(_string,"ITEM_MODEL_AMMO",0);
  62. else if(model == 2061)
  63. strins(_string,"ITEM_MODEL_BULLETS",0);
  64. return _string;
  65. }
  66.  
  67. item_CreateItem(playerid,model,Float:X,Float:Y,Float:Z,Float:rX,Float:rY,Float:rZ){
  68. item_actual_id ++;
  69. gItemInfo[item_actual_id][item_x] = X;gItemInfo[item_actual_id][item_y] = Y;gItemInfo[item_actual_id][item_y] = Y;
  70. gItemInfo[item_actual_id][item_rx] = rX;gItemInfo[item_actual_id][item_rx] = rY;gItemInfo[item_actual_id][item_rz] = rZ;
  71. gItemInfo[item_actual_id][item_id] = CreateObject(model, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ);
  72. format(gResult,sizeof(gResult),"[DEBUG]: Object model: %s",getobject(model));
  73. SendClientMessage(playerid,-1,gResult);
  74. EditObject(playerid,gItemInfo[item_actual_id][item_id]);
  75. return 1;
  76. }
  77.  
  78. /*item_GiveItem(playerid,itemid){
  79.  
  80. }*/
  81.  
  82. IsPlayerInObject(playerid,&id){
  83. print("pegar");
  84. for(new i; i<C_MAX_ITEMS; ++i){
  85. if(IsPlayerInRangeOfPoint(playerid,5.0,gItemInfo[i][item_x],gItemInfo[i][item_y],gItemInfo[i][item_z])){
  86. id = i;
  87. return 1;
  88. }
  89. }
  90. return 0;
  91. }
  92.  
  93. cmd(item:playerid,params[],help){
  94. if(help)
  95. return SendClientMessage(playerid,-1,"Este comando é um debug.");
  96. if(isnull(params))
  97. return SendClientMessage(playerid,-1,"USE: /item [modelid]");
  98. static Float:x,Float:y,Float:z;
  99. GetPlayerPos(playerid,x,y,z);
  100. item_CreateItem(playerid,strval(params),x+1.0,y+1.0,z,0,0,0);
  101. return 1;
  102. }
  103.  
  104. cmd(pegar:playerid,params[],help){
  105. static tid;
  106. if(IsPlayerInObject(playerid,tid)){
  107. print("lal");
  108. if(isweapon(gItemInfo[tid][item_model])){
  109. GivePlayerWeapon(playerid,getweapon(gItemInfo[tid][item_model]),1);
  110. }
  111. if(isbullet(gItemInfo[tid][item_model])){
  112. player_bullets[playerid] += gItemInfo[tid][item_quantity];
  113. SendClientMessage(playerid,-1,"Você apanhou balas, use /carregar e coloque a arma.");
  114. }
  115. if(!isweapon(gItemInfo[tid][item_model]) && !isbullet(gItemInfo[tid][item_model])){
  116. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_CARRY);
  117. }
  118. }
  119. return 1;
  120. }
  121.  
  122. cmd(carregar:playerid,params[],help){
  123. if(isnull(params))
  124. SendClientMessage(playerid,-1,"USE: /carregar [quantidade]");
  125. if(strval(params) > player_bullets[playerid])
  126. SendClientMessage(playerid,-1,"Não coloque mais balas do que tem!");
  127. if(GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 31){
  128. SetPlayerAmmo(playerid,GetPlayerWeapon(playerid),strval(params));
  129. player_bullets[playerid] -= strval(params);
  130. }
  131. else
  132. SendClientMessage(playerid,-1,"Coloque as armas.");
  133. return 1;
  134. }
  135.  
  136. cmd(stopanim:playerid,params[],help){
  137. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
  138. return 1;
  139. }
Advertisement
Add Comment
Please, Sign In to add comment