Guest User

Sistema de Sequestro - Samp zNx

a guest
May 13th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.94 KB | None | 0 0
  1. //- FS criado por ToxiSkill_. Porfavor não retire os creditos! - //
  2. //- Contato: [email protected] -//
  3. //- FS criado por ToxiSkill_. Porfavor não retire os creditos! - //
  4.  
  5. //Includes
  6. #include <a_samp>
  7.  
  8. //Defines
  9. #define FILTERSCRIPT
  10. #if defined FILTERSCRIPT
  11. #define MAXPLAYERS 100
  12. #define COR_CINZA 0xBFC0C2FF
  13. #define COR_AMARELO 0xF5DEB3AA
  14. #define COR_AZULZINHO 0x00A5FFFF
  15. #define COR_BRANCO 0xFAFAFAFF
  16. #define COR_VERMELHOCLARO 0xFF6347AA
  17. #define COR_AZUL 0x005FFFFF
  18. //NEWS
  19. new Sequestrado[MAXPLAYERS];
  20. new Amarrado[MAXPLAYERS];
  21. new nome[MAX_PLAYER_NAME];
  22. new nome2[MAX_PLAYER_NAME];
  23. new SaiuSeq[MAXPLAYERS];
  24. new FitaNele[MAXPLAYERS];
  25.  
  26. forward ProxDetectorS(Float:radi, playerid, targetid);
  27. public ProxDetectorS(Float:radi, playerid, targetid)
  28. {
  29. if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
  30. {
  31. new Float:posx, Float:posy, Float:posz;
  32. new Float:oldposx, Float:oldposy, Float:oldposz;
  33. new Float:tempposx, Float:tempposy, Float:tempposz;
  34. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  35. GetPlayerPos(targetid, posx, posy, posz);
  36. tempposx = (oldposx -posx);
  37. tempposy = (oldposy -posy);
  38. tempposz = (oldposz -posz);
  39. if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  40. {
  41. return 1;
  42. }
  43. }
  44. return 0;
  45. }
  46.  
  47. //Public's
  48. public OnFilterScriptInit()
  49. {
  50. print("||| Sistema de sequestro carregado! |||");
  51. print("||| By ToxiSkill_ |||");
  52. return 1;
  53. }
  54.  
  55. public OnFilterScriptExit()
  56. {
  57. print("||| Sistema de sequestro descarregado. |||");
  58. print("||| By ToxiSkill_ |||");
  59.  
  60. return 1;
  61. }
  62. #endif
  63.  
  64. public OnPlayerConnect(playerid)//-- Quando alguem conecta no server aparece isso \/
  65. {
  66. new string[128];
  67. if(SaiuSeq[playerid] == 1)
  68. {
  69. GetPlayerName(playerid, nome, sizeof(nome));
  70. format(string, sizeof(string), "[AVISO] A vitima %s ID:[%d] que deu /q no sequestro está online!",nome, playerid);
  71. SendClientMessageToAll(COR_VERMELHOCLARO, string);
  72. }
  73. return 1;
  74. }
  75. public OnPlayerDisconnect(playerid, reason)//-- Quando alguem sai do server aparece isso \/
  76. {
  77. new string[128];
  78. if(Sequestrado[playerid] == 1)
  79. {
  80. GetPlayerName(playerid, nome, sizeof(nome));
  81. format(string, sizeof(string), "[SEQUESTRO]: A Vítima de Sequestro %s deu /q em pleno sequestro D:",nome);
  82. SendClientMessageToAll(COR_AZUL, string);
  83. Sequestrado[playerid] = 0;
  84. Amarrado[playerid] = 0;
  85. SaiuSeq[playerid] = 1;
  86. TogglePlayerControllable(playerid, 1);
  87. }
  88. return 1;
  89. }
  90. public OnPlayerText(playerid, text[])
  91. {
  92. if(FitaNele[playerid] == 1)
  93. {
  94. SendClientMessage(playerid, COR_VERMELHOCLARO, "Você não pode falar porque está com fita na boca!");
  95. return 0;
  96. }
  97. return 1;
  98. }
  99. public OnPlayerCommandText(playerid, cmdtext[])
  100. {
  101. new cmd[256], idx;
  102. new tmp[256];
  103. cmd = strtok(cmdtext, idx);
  104. new string[128];
  105. if(strcmp(cmd, "/sequestrar", true) == 0)
  106. {
  107. new id;
  108. new preco;
  109. tmp = strtok(cmdtext, idx);
  110. if(!strlen(tmp)) return SendClientMessage(playerid, COR_CINZA,"USE: /sequestrar [id player]");
  111. id = strval(tmp);
  112. tmp = strtok(cmdtext, idx);
  113. if(!strlen(tmp)) return SendClientMessage(playerid, COR_CINZA,"USE: /sequestrar [id player] [preco]");
  114. preco = strval(tmp);
  115. if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COR_CINZA,"Jogador está OffLine");
  116. if(Sequestrado[id] == 1)
  117. {
  118. SendClientMessage(playerid, COR_CINZA, " Esse jogador ja está sendo sequestrado ");
  119. return 1;
  120. }
  121. if(preco < 1||preco > 100000)
  122. {
  123. SendClientMessage(playerid, COR_CINZA, " O preço do resgate deve estar entre R$1 e R$ 100000!. ");
  124. return 1;
  125. }
  126. if(GetPlayerState(playerid) != 2 || !IsPlayerInVehicle(id, GetPlayerVehicleID(playerid)))
  127. return SendClientMessage(playerid, COR_CINZA, " Você não é o motorista ou o jogador não está no seu carro ");
  128. {
  129. GetPlayerName(playerid, nome, sizeof(nome));
  130. GetPlayerName(id, nome2, sizeof(nome2));
  131. format(string, sizeof(string), "Você está sequestrando o %s e está pedindo R$ %d pelo resgate!",nome2, preco);
  132. SendClientMessage(playerid, COR_AMARELO, string);
  133. format(string, sizeof(string), "[SEQUESTRO] O sequestrador %s esta sequestrando o %s e está pedindo R$ %d pelo resgate!",nome, nome2, preco);
  134. SendClientMessageToAll(COR_VERMELHOCLARO, string);
  135. format(string, sizeof(string), "O jogador %s te sequestro",nome);
  136. SendClientMessage(id, COR_BRANCO, string);
  137. TogglePlayerControllable(id, 0);
  138. SetPlayerWantedLevel(playerid, 3);
  139. SendClientMessage(playerid, COR_VERMELHOCLARO, "Agora você está com 3 niveis de procura por sequestrar :)!");
  140. Sequestrado[id] = 1;
  141. Amarrado[id] = 1;
  142. }
  143. return 1;
  144. }
  145. if(strcmp(cmd, "/soltarrefem", true) == 0)
  146. {
  147. new id;
  148. tmp = strtok(cmdtext, idx);
  149. if(!strlen(tmp)) return SendClientMessage(playerid, COR_CINZA,"USE: /soltarrefem [id do jogador]");
  150. id = strval(tmp);
  151. if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COR_CINZA,"Jogador está OffLine");
  152. if(Sequestrado[id] == 0)
  153. {
  154. SendClientMessage(playerid, COR_CINZA, " Esse jogador não está sequestrado ");
  155. return 1;
  156. }
  157. if(!ProxDetectorS(10.0, playerid, id))
  158. {
  159. SendClientMessage(playerid,COR_BRANCO," Você está longe do refém para poder soltar ele!");
  160. return 1;
  161. }
  162. TogglePlayerControllable(id, 1);
  163. GetPlayerName(playerid, nome, sizeof(nome));
  164. GetPlayerName(id, nome2, sizeof(nome2));
  165. format(string, sizeof(string), "Você soltou o refem %s",id);
  166. SendClientMessage(playerid, COR_AMARELO, string);
  167. format(string, sizeof(string), "[SEQUESTRO] O sequestrador %s soltou o ex-refém %s",nome, nome2);
  168. SendClientMessageToAll(COR_VERMELHOCLARO, string);
  169. format(string, sizeof(string), "O jogador %s te libertou",nome);
  170. SendClientMessage(id, COR_VERMELHOCLARO, string);
  171. Sequestrado[id] = 0;
  172. Amarrado[id] = 0;
  173. return 1;
  174. }
  175. if(strcmp(cmd, "/passarfita", true) == 0)
  176. {
  177. new id;
  178. tmp = strtok(cmdtext, idx);
  179. if(!strlen(tmp)) return SendClientMessage(playerid, COR_CINZA,"USE: /passarfita [id do player]");
  180. id = strval(tmp);
  181. if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COR_CINZA,"Jogador está OffLine");
  182. if(Sequestrado[id] == 0)
  183. {
  184. SendClientMessage(playerid, COR_CINZA, " Esse jogador não está sequestrado ");
  185. return 1;
  186. }
  187. if(FitaNele[id] == 1)
  188. {
  189. SendClientMessage(playerid, COR_CINZA, " Esse jogador ja está mudo ");
  190. return 1;
  191. }
  192. if(!ProxDetectorS(10.0, playerid, id))
  193. {
  194. SendClientMessage(playerid,COR_BRANCO," Você está longe do refém para poder colocar a fita nele!");
  195. return 1;
  196. }
  197. GetPlayerName(playerid, nome, sizeof(nome));
  198. GetPlayerName(id, nome2, sizeof(nome2));
  199. format(string, sizeof(string), "Você passou a fita no refem %s",id);
  200. SendClientMessage(playerid, COR_AMARELO, string);
  201. format(string, sizeof(string), "O sequestrador %s te passou a fita!",nome);
  202. SendClientMessage(id, COR_VERMELHOCLARO, string);
  203. FitaNele[id] = 1;
  204. return 1;
  205. }
  206. if(strcmp(cmd, "/tirarfita", true) == 0)
  207. {
  208. new id;
  209. tmp = strtok(cmdtext, idx);
  210. if(!strlen(tmp)) return SendClientMessage(playerid, COR_CINZA,"USE: /tirarfita [id do player]");
  211. id = strval(tmp);
  212. if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COR_CINZA,"Jogador está OffLine");
  213. if(Sequestrado[id] == 0)
  214. {
  215. SendClientMessage(playerid, COR_CINZA, " Esse jogador não está sequestrado ");
  216. return 1;
  217. }
  218. if(FitaNele[id] == 0)
  219. {
  220. SendClientMessage(playerid, COR_CINZA, " Esse jogador não está mudo! ");
  221. return 1;
  222. }
  223. if(!ProxDetectorS(15.0, playerid, id))
  224. {
  225. SendClientMessage(playerid,COR_BRANCO," Você está longe do refém para poder tirar a fita dele!");
  226. return 1;
  227. }
  228. GetPlayerName(playerid, nome, sizeof(nome));
  229. GetPlayerName(id, nome2, sizeof(nome2));
  230. format(string, sizeof(string), "Você tirou a fita no refem %s",id);
  231. SendClientMessage(playerid, COR_AMARELO, string);
  232. format(string, sizeof(string), "O sequestrador %s tirou a sua fita agora você pode falar.!",nome);
  233. SendClientMessage(id, COR_VERMELHOCLARO, string);
  234. FitaNele[id] = 0;
  235. return 1;
  236. }
  237. if(strcmp(cmd, "/desamarrar", true) == 0)
  238. {
  239. new id;
  240. tmp = strtok(cmdtext, idx);
  241. if(!strlen(tmp)) return SendClientMessage(playerid, COR_CINZA,"USE: /desamarrar [id player]");
  242. id = strval(tmp);
  243. if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COR_CINZA,"Jogador está OffLine");
  244. if(Amarrado[id] == 0)
  245. {
  246. SendClientMessage(playerid, COR_CINZA, " Esse jogador não está amarrado ");
  247. return 1;
  248. }
  249. if(Sequestrado[id] == 0)
  250. {
  251. SendClientMessage(playerid, COR_CINZA, " Esse jogador não está sequestrado. ");
  252. return 1;
  253. }
  254. if(!ProxDetectorS(15.0, playerid, id))
  255. {
  256. SendClientMessage(playerid,COR_BRANCO," Você está longe do refém para poder desamarrar ele!");
  257. return 1;
  258. }
  259. new carro = GetPlayerVehicleID(playerid);
  260. if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2 && IsPlayerInVehicle(id, carro)) return SendClientMessage(playerid, COR_CINZA, " Você não é o motorista ou o jogador não está no seu carro ");
  261. {
  262. TogglePlayerControllable(id, 1);
  263. GetPlayerName(playerid, nome, sizeof(nome));
  264. GetPlayerName(id, nome2, sizeof(nome2));
  265. format(string, sizeof(string), "O jogador %s te desamarrou",nome);
  266. SendClientMessage(playerid, COR_AMARELO, string);
  267. format(string, sizeof(string), "Você desamarrou o %s",nome2);
  268. SendClientMessage(playerid, COR_AMARELO, string);
  269. Amarrado[id] = 0;
  270. }
  271. return 1;
  272. }
  273. if(strcmp(cmd, "/amarrar", true) == 0)
  274. {
  275. new id;
  276. tmp = strtok(cmdtext, idx);
  277. if(!strlen(tmp)) return SendClientMessage(playerid, COR_CINZA,"USE: /amarrar [id player]");
  278. id = strval(tmp);
  279. if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COR_CINZA,"Jogador está OffLine");
  280. if(Amarrado[id] == 1)
  281. {
  282. SendClientMessage(playerid, COR_CINZA, " Esse jogador ja está amarrado ");
  283. return 1;
  284. }
  285. if(Sequestrado[id] == 0)
  286. {
  287. SendClientMessage(playerid, COR_CINZA, " Esse jogador não está sequestrado. ");
  288. return 1;
  289. }
  290. if(!ProxDetectorS(10.0, playerid, id))
  291. {
  292. SendClientMessage(playerid,COR_BRANCO," Você está longe do refém para poder amarrar ele!");
  293. return 1;
  294. }
  295. new carro = GetPlayerVehicleID(playerid);
  296. if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2 && IsPlayerInVehicle(id, carro)) return SendClientMessage(playerid, COR_CINZA, " Você não é o motorista ou o jogador não está no seu carro ");
  297. {
  298. TogglePlayerControllable(id, 0);
  299. GetPlayerName(playerid, nome, sizeof(nome));
  300. GetPlayerName(id, nome2, sizeof(nome2));
  301. format(string, sizeof(string), "O sequestrador %s te amarrou",nome);
  302. SendClientMessage(playerid, COR_AMARELO, string);
  303. format(string, sizeof(string), "Você amarrou o %s",nome2);
  304. SendClientMessage(playerid, COR_AMARELO, string);
  305. Amarrado[id] = 1;
  306. }
  307. return 1;
  308. }
  309. return 0;
  310. }
  311.  
  312. public OnPlayerDeath(playerid, killerid, reason)
  313. {
  314. new string[128];
  315. if(Sequestrado[playerid] == 1)
  316. {
  317. GetPlayerName(playerid, nome, sizeof(nome));
  318. format(string, sizeof(string), "[SEQUESTRO]: A vítima do sequestro, %s[ID:%d] morreu, sequestro finalizado!",nome);
  319. SendClientMessageToAll(COR_VERMELHOCLARO, string);
  320. format(string, sizeof(string), "[LUTO] Está declarado luto por 2 minutos por a morte do %s", nome);
  321. SendClientMessageToAll(COR_VERMELHOCLARO, string);
  322. Sequestrado[playerid] = 0;
  323. Amarrado[playerid] = 0;
  324. TogglePlayerControllable(playerid, 1);
  325. }
  326. return 1;
  327. }
  328.  
  329. strtok(const string[], &index)
  330. {
  331. new length = strlen(string);
  332. while ((index < length) && (string[index] <= ' '))
  333. {
  334. index++;
  335. }
  336.  
  337. new offset = index;
  338. new result[20];
  339. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  340. {
  341. result[index - offset] = string[index];
  342. index++;
  343. }
  344. result[index - offset] = EOS;
  345. return result;
  346. }
  347. //- FS criado por ToxiSkill_. Porfavor não retire os creditos! - //
  348. //- Contato: [email protected] -//
  349. //- FS criado por ToxiSkill_. Porfavor não retire os creditos! - //
Advertisement
Add Comment
Please, Sign In to add comment