Advertisement
DraKiNs

[COD] iCmd V5

Jun 30th, 2011
518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.66 KB | None | 0 0
  1. /*
  2.      _  ____               _
  3.     (_)/ ___|_ __ ___   __| |
  4.     | | |   | '_ ` _ \ / _` |
  5.     | | |___| | | | | | (_| |  
  6.     |_|\____|_| |_| |_|\__,_|  
  7.                                          
  8.     Criado por Bruno da Silva ( brunoemail@r7.com ) (Thanks SlashPT)
  9.          www.ips-team.blogspot.com
  10.  
  11. */
  12.  
  13.  
  14. #define cmd(%1,%2,%3) @%1(%2,%3);  public @%1(%2,%3)
  15.  
  16. //============== [ Processar o Comando ] =====================
  17.  
  18. new
  19.     cmdname[32],
  20.     cmdindex
  21. ;
  22.  
  23. public OnPlayerCommandText(playerid,cmdtext[])
  24. {
  25.     return CallLocalFunction("OnReceivedCommand", "isi", playerid, cmdtext, ((cmdindex = strfind ((cmdtext[0] = 0x40, cmdtext), "\x20")), (cmdindex == -1) ? CallLocalFunction(cmdtext, "is", playerid, "\1") : (strmid(cmdname, cmdtext, 0, cmdindex), CallLocalFunction (cmdname, "is", playerid, !cmdtext[cmdindex + 1] ? '\1' : cmdtext[cmdindex + 1]))));
  26. }
  27.  
  28. //================ [ Gerenciar Comandos ] ======================
  29.  
  30. forward OnReceivedCommand(playerid, cmdtext[], bool:sucess);
  31. public OnReceivedCommand(playerid, cmdtext[], bool:sucess)
  32. {
  33.     if(!sucess)
  34.     {
  35.         SendClientMessage(playerid, 0xFFFFFFF, "[Erro] O comando digitado não existe");
  36.     }
  37.     return true;
  38. }
  39.  
  40. //================ [ Exemplo de Comando ] ======================
  41.  
  42. cmd(me, playerid, params[])
  43. {
  44.     if(strlen(params) < 5) return SendClientMessage(playerid, 0xFFFFFFFF, "[Erro] Por favor utilize algum texto (/me [texto]) (mínimo 5 caracteres)");
  45.        
  46.     static string[128];
  47.     GetPlayerName(playerid, string, MAX_PLAYER_NAME);    
  48.  
  49.     format(string, 128, "O Jogador %s(%d) acaba de falar %s (use /me [texto])", string, playerid, params);        
  50.     return SendClientMessageToAll(0xFFFFFFFF, string), true;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement