Advertisement
Guest User

[TCL]Evrim

a guest
Apr 9th, 2010
565
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.39 KB | None | 0 0
  1. #include <a_samp>
  2. #include <core>
  3. #include <float>
  4.  
  5. #define MESSAGE_COLOR         0xEEEEEEFF
  6. #define ECHO_COLOR            0xEEEEEEFF
  7. #define ACTION_COLOR          0xEE66EEFF
  8. #define AD_COLOR              0xFF6600FF
  9. #define DICE_COLOR            0x33FF00FF
  10.  
  11. public OnFilterScriptInit()
  12. {
  13.     print("\n--Chat Commands loaded! - By [TCL]Evrim\n");
  14.     return 1;
  15. }
  16.  
  17. public OnPlayerCommandText(playerid, cmdtext[])
  18. {
  19.     new cmd[256];
  20.     new Message[256];
  21.     new AdMessage[256];
  22.     new Dice;
  23.     new idx;
  24.     new actiontext[MAX_CHATBUBBLE_LENGTH+1];
  25.     new talktext[MAX_CHATBUBBLE_LENGTH+1];
  26.     new gambletext[MAX_CHATBUBBLE_LENGTH+1];
  27.     new adtext[256];
  28.  
  29.     cmd = strtok(cmdtext, idx);
  30.  
  31.     if(strcmp("/me", cmd, true) == 0)
  32.     {
  33.         Message = strrest(cmdtext,idx);
  34.         new Playername[MAX_PLAYER_NAME];
  35.         GetPlayerName(playerid, Playername, 24);
  36.         format(actiontext,MAX_CHATBUBBLE_LENGTH,"*%s %s*",Playername, Message);
  37.         SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,15.0,10000);
  38.         SendClientMessage(playerid,ACTION_COLOR,actiontext);
  39.         return 1;
  40.     }
  41.  
  42.     if(strcmp("/l", cmd, true) == 0)
  43.     {
  44.         Message = strrest(cmdtext,idx);
  45.         new Playername[MAX_PLAYER_NAME];
  46.         GetPlayerName(playerid, Playername, 24);
  47.         format(talktext,MAX_CHATBUBBLE_LENGTH,"%s says: %s",Playername, Message);
  48.         SetPlayerChatBubble(playerid,talktext,MESSAGE_COLOR,20.0,10000);
  49.         SendClientMessage(playerid,MESSAGE_COLOR,talktext);
  50.         return 1;
  51.     }
  52.  
  53.     if(strcmp("/dice", cmd, true) == 0)
  54.     {
  55.         new Playername[MAX_PLAYER_NAME];
  56.         GetPlayerName(playerid, Playername, 24);
  57.         Dice = random(6);
  58.         format(gambletext,MAX_CHATBUBBLE_LENGTH,"*%s rolled a %d with his/her dice*",Playername, Dice);
  59.         SetPlayerChatBubble(playerid,gambletext,DICE_COLOR,15.0,10000);
  60.         SendClientMessage(playerid,DICE_COLOR,gambletext);
  61.         return 1;
  62.     }
  63.  
  64.     if(strcmp("/ad", cmd, true) == 0)
  65.     {
  66.         AdMessage = strrest(cmdtext,idx);
  67.         new Playername[MAX_PLAYER_NAME];
  68.         GetPlayerName(playerid, Playername, 24);
  69.         format(adtext,256,"[Advertise] %s , contact %s",AdMessage, Playername);
  70.         SendClientMessageToAll(AD_COLOR,adtext);
  71.         GivePlayerMoney(playerid, -10);
  72.         return 1;
  73.     }
  74.  
  75.     if(strcmp("/creds", cmd, true) == 0)
  76.     {
  77.         SendClientMessage(playerid,ECHO_COLOR,"Chat Commands made by [TCL]Evrim");
  78.         return 1;
  79.     }
  80.  
  81.     if(strcmp("/smoke", cmd, true) == 0)
  82.     {
  83.         new Playername[MAX_PLAYER_NAME];
  84.         GetPlayerName(playerid, Playername, 24);
  85.         SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
  86.         format(actiontext,MAX_CHATBUBBLE_LENGTH,"*%s takes out a cigarette and lights it*",Playername);
  87.         SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,15.0,10000);
  88.         SendClientMessage(playerid,ACTION_COLOR,actiontext);
  89.         return 1;
  90.     }
  91.    
  92.     if(strcmp("/beer", cmd, true) == 0)
  93.     {
  94.         new Playername[MAX_PLAYER_NAME];
  95.         GetPlayerName(playerid, Playername, 24);
  96.         SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
  97.         format(actiontext,MAX_CHATBUBBLE_LENGTH,"*%s takes out a bottle of beer from his pocket*",Playername);
  98.         SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,15.0,10000);
  99.         SendClientMessage(playerid,ACTION_COLOR,actiontext);
  100.         return 1;
  101.     }
  102.    
  103.     if(strcmp("/sprunk", cmd, true) == 0)
  104.     {
  105.         new Playername[MAX_PLAYER_NAME];
  106.         GetPlayerName(playerid, Playername, 24);
  107.         SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
  108.         format(actiontext,MAX_CHATBUBBLE_LENGTH,"*%s takes out a can of sprunk from his pocket*",Playername);
  109.         SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,15.0,10000);
  110.         SendClientMessage(playerid,ACTION_COLOR,actiontext);
  111.         return 1;
  112.     }
  113.  
  114.     return 0;
  115. }
  116.  
  117. stock strrest(const string[], &index)
  118. {
  119.     new length = strlen(string);
  120.     while ((index < length) && (string[index] <= ' '))
  121.     {
  122.         index++;
  123.     }
  124.     new offset = index;
  125.     new result[128];
  126.     while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
  127.     {
  128.         result[index - offset] = string[index];
  129.         index++;
  130.     }
  131.     result[index - offset] = EOS;
  132.     return result;
  133. }
  134.  
  135. stock strtok(const string[], &index)
  136. {
  137.     new length = strlen(string);
  138.     while ((index < length) && (string[index] <= ' '))
  139.     {
  140.         index++;
  141.     }
  142.  
  143.     new offset = index;
  144.     new result[20];
  145.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  146.     {
  147.         result[index - offset] = string[index];
  148.         index++;
  149.     }
  150.     result[index - offset] = EOS;
  151.     return result;
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement