Advertisement
mobiliz

mzLove [v1.1]

Sep 16th, 2012
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.87 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4. #include <dini>
  5.  
  6. #define COLOR_YELLOW 0xFFFF00FF
  7. #define COLOR_RED 0xFF0000AA
  8. #define COLOR_BEIGE 0xFFF8DCAA
  9. #define COLOR_GREY 0xAFAFAFAA
  10.  
  11. #define PlayerSave "mzLove/%s.ini"
  12.  
  13. enum pInfo
  14. {
  15. Love
  16. };
  17. new PlayerInfo[MAX_PLAYERS][pInfo];
  18. new LoveCar[MAX_PLAYERS];
  19. new LoveBike[MAX_PLAYERS];
  20.  
  21.  
  22. public OnFilterScriptInit()
  23. {
  24. print("\n--------------------------------------");
  25. print(" mzLove by mobiliz");
  26. print("--------------------------------------\n");
  27. return 1;
  28. }
  29.  
  30. public OnFilterScriptExit()
  31. {
  32. return 1;
  33. }
  34.  
  35. public OnPlayerConnect(playerid)
  36. {
  37. new file[100],Name[MAX_PLAYER_NAME],Ip[16];
  38. GetPlayerName(playerid,Name,sizeof(Name));
  39. GetPlayerIp(playerid,Ip,sizeof(Ip));
  40. format(file,sizeof(file),PlayerSave,Name);
  41. if(!dini_Exists(file)) {
  42. dini_Create(file);
  43. dini_IntSet(file,"Love", PlayerInfo[playerid][Love]);
  44. }
  45. else if(dini_Exists(file))
  46. {
  47. PlayerInfo[playerid][Love] = dini_Int(file,"Love");
  48. }
  49. return 1;
  50. }
  51.  
  52. public OnPlayerDisconnect(playerid, reason)
  53. {
  54. new file[100],Name[MAX_PLAYER_NAME],Ip[16];
  55. GetPlayerName(playerid,Name,sizeof(Name));
  56. GetPlayerIp(playerid,Ip,sizeof(Ip));
  57. format(file,sizeof(file),PlayerSave,Name);
  58. dini_IntSet(file,"Love", PlayerInfo[playerid][Love]);
  59. return 1;
  60. }
  61.  
  62. CMD:lcmds(playerid,params[])
  63. {
  64. SendClientMessage(playerid, COLOR_YELLOW,"/mylove, /givelove, /lcar (50 love), lbike (45 love), /ldeagle (12 love), /lheal (8 love), /lnos (5 love)");
  65. SendClientMessage(playerid, COLOR_YELLOW,"/lfix (5 love)");
  66. return 1;
  67. }
  68.  
  69. CMD:givelove(playerid, params[])
  70. {
  71. new str[128], id, amount;
  72. if(sscanf(params, "ui", id, amount)) return SendClientMessage(playerid, COLOR_RED, "Usage: /givelove [id] [love]");
  73. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED,"Invaild ID");
  74. if(id == playerid) return SendClientMessage(playerid, COLOR_RED,"You can't give your self love");
  75. if(PlayerInfo[playerid][Love] < 1) return SendClientMessage(playerid, COLOR_RED,"Invaild ammount");
  76. if(PlayerInfo[playerid][Love] < amount) return SendClientMessage(playerid, COLOR_RED, "You need more love to give that much away.");
  77. PlayerInfo[playerid][Love] -= amount;
  78. PlayerInfo[id][Love] += amount;
  79. format(str, sizeof(str), "You gave %i love to %s", amount, GetName(id));
  80. SendClientMessage(playerid, COLOR_RED, str);
  81. format(str, sizeof(str), "%s gave you %i love", GetName(playerid), amount);
  82. SendClientMessage(id, COLOR_YELLOW, str);
  83. SendClientMessage(id, COLOR_YELLOW, "You can spend love or give your love away!");
  84. return 1;
  85. }
  86.  
  87. CMD:mylove(playerid, params[])
  88. {
  89. new string[128];
  90. format(string, sizeof(string), "Love: %i", PlayerInfo[playerid][Love]);
  91. SendClientMessage(playerid ,COLOR_YELLOW, string);
  92. return 1;
  93. }
  94.  
  95. CMD:lcar(playerid, params[])
  96. {
  97. if(PlayerInfo[playerid][Love] >= 50)
  98. {
  99. new Float:x, Float:y, Float:z, Float:angle;
  100. GetPlayerPos(playerid, x, y, z);
  101. GetPlayerFacingAngle(playerid, angle);
  102. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Error: You already have a vehicle!");
  103. LoveCar[playerid] = AddStaticVehicle(451, x, y, z, angle, -1, -1);
  104. PlayerInfo[playerid][Love] -= 50;
  105. PutPlayerInVehicle(playerid, LoveCar[playerid], 0);
  106. SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought a Turismo!");
  107. }
  108. else SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
  109. return 1;
  110. }
  111.  
  112. CMD:lbike(playerid, params[])
  113. {
  114. if(PlayerInfo[playerid][Love] >= 45)
  115. {
  116. new Float:x, Float:y, Float:z, Float:angle;
  117. GetPlayerPos(playerid, x, y, z);
  118. GetPlayerFacingAngle(playerid, angle);
  119. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Error: You already have a vehicle!");
  120. LoveBike[playerid] = AddStaticVehicle(522, x, y, z, angle, -1, -1);
  121. PlayerInfo[playerid][Love] -= 45;
  122. PutPlayerInVehicle(playerid, LoveBike[playerid], 0);
  123. SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought a NRG-500!");
  124. }
  125. else SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
  126. return 1;
  127. }
  128.  
  129. CMD:ldeagle(playerid, params[])
  130. {
  131. if(PlayerInfo[playerid][Love] >= 12)
  132. {
  133. GivePlayerWeapon(playerid, 24, 500);
  134. PlayerInfo[playerid][Love] -= 12;
  135. SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought a Deagle!");
  136. }
  137. else SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
  138. return 1;
  139. }
  140.  
  141. CMD:lheal(playerid, params[])
  142. {
  143. if(PlayerInfo[playerid][Love] >= 8)
  144. {
  145. SetPlayerHealth(playerid, 100.0);
  146. SetPlayerArmour(playerid, 100.0);
  147. PlayerInfo[playerid][Love] -= 8;
  148. SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought Health + Armour!");
  149. }
  150. else SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
  151. return 1;
  152. }
  153.  
  154. CMD:lnos(playerid, params[])
  155. {
  156. if(PlayerInfo[playerid][Love] >= 5)
  157. {
  158. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must in vehicle to use this command");
  159. switch(GetVehicleModel( GetPlayerVehicleID(playerid) ))
  160. {
  161. case 448,461,462,463,468,471,509,510,521,522,523,581,586,449:
  162. return SendClientMessage(playerid,COLOR_RED,"You can't tune this vehicle!");
  163. }
  164. AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  165. PlayerInfo[playerid][Love] -= 5;
  166. SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought Nos!");
  167. }
  168. else SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
  169. return 1;
  170. }
  171.  
  172. CMD:lfix(playerid, params[])
  173. {
  174. if(PlayerInfo[playerid][Love] >= 5)
  175. {
  176. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED,"You must in vehicle to use this command");
  177. new VehicleID = GetPlayerVehicleID(playerid);
  178. RepairVehicle(VehicleID);
  179. SetVehicleHealth(VehicleID, 1000);
  180. PlayerInfo[playerid][Love] -= 5;
  181. SendClientMessage(playerid, COLOR_BEIGE, "[Server] You bought Vehicle Fix!");
  182. }
  183. else return SendClientMessage(playerid, COLOR_RED,"You don't have enough love to get this");
  184. return 1;
  185. }
  186.  
  187. CMD:setlove(playerid, params[])
  188. {
  189. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not authorized for use this command!");
  190. new str[128], id, amount2;
  191. if(sscanf(params, "ui", id, amount2)) return SendClientMessage(playerid, COLOR_RED, "Usage: /setlove [id] [amount]");
  192. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invaild ID");
  193. PlayerInfo[id][Love] = amount2;
  194. format(str, sizeof(str), "You set %s's love to %i", GetName(id), amount2);
  195. SendClientMessage(playerid, COLOR_YELLOW, str);
  196. format(str, sizeof(str), "%s has set your love to %i", GetName(playerid), amount2);
  197. SendClientMessage(id, COLOR_YELLOW, str);
  198. return 1;
  199. }
  200.  
  201.  
  202. stock GetName(playerid)
  203. {
  204. new pName[MAX_PLAYER_NAME];
  205. GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  206. return pName;
  207. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement