Advertisement
Guest User

Problema

a guest
Mar 30th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.88 KB | None | 0 0
  1. #include a_samp
  2. #include dini
  3. #define Cor_PMilitar 0x4169E199
  4. #define Cor_Groove 0x00FF0099
  5. #define Cor_Ballas 0xA020F099
  6. #define Branco 0xFFFFFFFF
  7. enum Info
  8. {
  9. PMilitar,
  10. Groove,
  11. Ballas
  12. };
  13.  
  14. new PlayerInfo[MAX_PLAYERS][Info];
  15. new VPMilitar[5];
  16. public OnGameModeInit()
  17. {
  18. VPMilitar[0] = CreateVehicle(400, 1469.9976, -1722.6470, 22.0803, 0, 1, 1, -1); //Veiculo numero 0
  19. VPMilitar[1] = CreateVehicle(400, 1469.9976, -1722.6470, 22.0803, 0, 1, 1, -1); //Veiculo numero 1
  20. VPMilitar[2] = CreateVehicle(400, 1469.9976, -1722.6470, 22.0803, 0, 1, 1, -1); //Veiculo numero 2
  21. VPMilitar[3] = CreateVehicle(400, 1469.9976, -1722.6470, 22.0803, 0, 1, 1, -1); //Veiculo numero 3
  22. }
  23.  
  24. public OnPlayerCommandText(playerid, cmd[])
  25. {
  26. new tmp[128];
  27. if(strcmp(cmd, "/convidar", true) == 0)
  28. {
  29. tmp = strtok(cmd, idx);
  30. new PlayerB;
  31. if(!strlen(tmp)) return SendClientMessage(playerid, Branco, "Uso correto: /convidar [id]");
  32. PlayerB = strval(tmp);
  33. if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, Branco, "Este jogador não está conectado");
  34. if(PlayerInfo[playerid][PMilitar] >= 6)
  35. {
  36. PlayerInfo[PlayerB][PMilitar] = 1;
  37. SendClientMessage(PlayerB, Branco, "Você entrou à Polícia Militar");
  38. SetPlayerColor(PlayerB, Cor_PMilitar);
  39. return 1;
  40. }
  41. else if(PlayerInfo[playerid][Groove] >= 6)
  42. {
  43. PlayerInfo[PlayerB][Groove] = 1;
  44. SendClientMessage(PlayerB, Branco, "Você entrou à Groove");
  45. SetPlayerColor(PlayerB, Cor_Groove);
  46. return 1;
  47. }
  48. else if(PlayerInfo[playerid][Ballas] >= 6)
  49. {
  50. PlayerInfo[PlayerB][Ballas] = 1;
  51. SendClientMessage(PlayerB, Branco, "Você entrou aos Ballas");
  52. SetPlayerColor(PlayerB, Cor_Ballas);
  53. return 1;
  54. }
  55. return 0;
  56. }
  57. if(strcmp(cmd, "/promover", true) == 0)
  58. {
  59. tmp = strtok(cmdtext, idx);
  60. new PlayerB, level;
  61. if(!strlen(tmp)) return SendClientMessage(playerid, Branco, "Uso correto: /promover [id] [cargo]");
  62. PlayerB = strval(tmp);
  63. if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, Branco, "Este jogador não está conectado");
  64. tmp = strtok(cmdtext, idx);
  65. if(!strlen(tmp)) return SendClientMessage(playerid, Branco, "Uso correto: /promover [id] [cargo]");
  66. level = strval(tmp);
  67. if(level < 1 || level > 6) return SendClientMessage(playerid, Branco, "O level deve ser maior que 0 e menor que 7");
  68. new string[128], promovedor[MAX_PLAYER_NAME];
  69. GetPlayerName(playerid, promovedor, sizeof(promovedor));
  70. if(PlayerInfo[playerid][PMilitar] >= 6)
  71. {
  72. if(PlayerInfo[PlayerB][PMilitar] < 1) return SendClientMessage(playerid, Branco, "Este jogador não é da sua org");
  73. PlayerInfo[PlayerB][PMilitar] = level;
  74. format(string, sizeof(string), "Você foi promovido a level %d por %s", level, promovedor););
  75. SendClientMessage(PlayerB, Branco, string);
  76. return 1;
  77. }
  78. else if(PlayerInfo[playerid][Groove] >= 6)
  79. {
  80. if(PlayerInfo[PlayerB][Groove] < 1) return SendClientMessage(playerid, Branco, "Este jogador não é da sua org");
  81. PlayerInfo[PlayerB][Groove] = level;
  82. format(string, sizeof(string), "Você foi promovido a level %d por %s", level, promovedor););
  83. SendClientMessage(PlayerB, Branco, string);
  84. return 1;
  85. }
  86. else if(PlayerInfo[playerid][Ballas] >= 6)
  87. {
  88. if(PlayerInfo[PlayerB][Ballas] < 1) return SendClientMessage(playerid, Branco, "Este jogador não é da sua org");
  89. PlayerInfo[PlayerB][Ballas] = level;
  90. format(string, sizeof(string), "Você foi promovido a level %d por %s", level, promovedor););
  91. SendClientMessage(PlayerB, Branco, string);
  92. return 1;
  93. }
  94. return 0;
  95. }
  96. if(strcmp(cmd, "/demitir", true) == 0)
  97. {
  98. tmp = strtok(cmdtext, idx);
  99. new PlayerB, string[128], demitidor[MAX_PLAYER_NAME];
  100. if(!strlen(tmp)) return SendClientMessage(playerid, Branco, "Uso correto: /demitir [id]");
  101. PlayerB = strval(tmp);
  102. GetPlayerName(playerid, demitidor, sizeof(demitidor));
  103. if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, Branco, "Este jogador não está conectado");
  104. if(PlayerInfo[playerid][PMilitar] >= 6)
  105. {
  106. if(PlayerInfo[PlayerB][PMilitar] < 1) return SendClientMessage(playerid, Branco, "Este jogador não é da sua organização");
  107. PlayerInfo[PlayerB][PMilitar] = 0;
  108. format(string, sizeof(string), "Você foi demitido por %s", demitidor);
  109. SendClientMessage(PlayerB, Branco, string);
  110. return 1;
  111. }
  112. else if(PlayerInfo[playerid][Groove] >= 6)
  113. {
  114. if(PlayerInfo[PlayerB][Groove] < 1) return SendClientMessage(playerid, Branco, "Este jogador não é da sua organização");
  115. PlayerInfo[PlayerB][Groove] = 0;
  116. format(string, sizeof(string), "Você foi demitido por %s", demitidor);
  117. SendClientMessage(PlayerB, Branco, string);
  118. return 1;
  119. }
  120. else if(PlayerInfo[playerid][Ballas] >= 6)
  121. {
  122. if(PlayerInfo[PlayerB][Ballas] < 1) return SendClientMessage(playerid, Branco, "Este jogador não é da sua organização");
  123. PlayerInfo[PlayerB][Ballas] = 0;
  124. format(string, sizeof(string), "Você foi demitido por %s", demitidor);
  125. SendClientMessage(PlayerB, Branco, string);
  126. }
  127. return 1;
  128. {
  129. return 0;
  130. }
  131.  
  132. public OnPlayerStateChange(playerid, newstate, oldstate)
  133. {
  134. if(newstate == PLAYER_STATE_DRIVER) VerificarVeiculo(playerid);
  135. {
  136. }
  137. return 1;
  138. }
  139. forward VerificarVeiculo(playerid);
  140. public VerificarVeiculo(playerid)
  141. {
  142. for(new c = 0; c <= 4; c++)
  143. {
  144. if(IsPlayerInVehicle(playerid, VPMilitar[c]) && PlayerInfo[playerid][PMilitar] < 1)
  145. {
  146. SendClientMessage(playerid, Branco, "Você não é da Policia Militar");
  147. RemovePlayerFromVehicle(playerid);
  148. return 1;
  149. }
  150. forward SalvarOrg(playerid);
  151. public SalvarOrg(playerid)
  152. {
  153. new arquivo[60], nome[MAX_PLAYER_NAME];
  154. GetPlayerName(playerid, nome, sizeof(nome));
  155. format(arquivo, sizeof(arquivo), "Contas\%s.ini", nome);
  156. }
  157. if(!dini_Exists(arquivo))
  158. {
  159. dini_Create(arquivo);
  160. }
  161. if(PlayerInfo[playerid][PMilitar] > 0) dini_IntSet(arquivo, "PMilitar", PlayerInfo[playerid][PMilitar]);
  162. if(PlayerInfo[playerid][Groove] > 0) dini_IntSet(arquivo, "Groove", PlayerInfo[playerid][Groove]);
  163. if(PlayerInfo[playerid][Ballas] > 0) dini_IntSet(arquivo, "Ballas", PlayerInfo[playerid][Ballas]);
  164. return 1;
  165. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement