Guest User

SimpleAccents by playbox12

a guest
Sep 20th, 2010
1,168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.99 KB | None | 0 0
  1. // Do what ever you want with it, except: releasing it as your own.
  2.  
  3. #define FILTERSCRIPT
  4. #define DialogIDChangeOnProblems 1928 // Change the ammount if it messes up with other dialogs
  5.  
  6. #include <a_samp>
  7.  
  8. new string[128];
  9.  
  10. forward NearbyMessageForPlayers( playerid, stringcolour, text[]);
  11.  
  12. public OnFilterScriptInit()
  13. {
  14.     print("\n--------------------------------------");
  15.     print(" Accent system by playbox loaded");
  16.     print("--------------------------------------\n");
  17.     return 1;
  18. }
  19.  
  20. public OnPlayerConnect(playerid)
  21. {
  22.     SetPVarString(playerid,"Accent","Unknown"); // Sets the accent to 'unknown' untill the player chooses his players accent
  23.     SendClientMessage(playerid, 0xFFFFFFAA, "This server runs 'playbox's SimpleAccents', type /accent to set your players accent"); // You can delete this I don't care
  24.     return 1;
  25. }
  26.  
  27. public OnPlayerText(playerid, text[])
  28. {
  29.     new playername[MAX_PLAYER_NAME], PlayersAccent[12];
  30.     GetPlayerName(playerid, playername, sizeof(playername));
  31.     GetPVarString(playerid, "Accent", PlayersAccent, 12);
  32.     format(string, sizeof(string), "[%s accent] %s: %s", PlayersAccent, playername, text);
  33.     NearbyMessageForPlayers(playerid, 0xFFFFFFAA, string);
  34.     return 0;
  35. }
  36.  
  37. public OnPlayerCommandText(playerid, cmdtext[])
  38. {
  39.     if (strcmp("/accent", cmdtext, true, 10) == 0)
  40.     {
  41.         ShowPlayerDialog(playerid, DialogIDChangeOnProblems, DIALOG_STYLE_LIST, "Accent selection", "American\nRussian\nBritish\nItalian\nDutch\nFrance\nAustralian\nAfrican\nChinese", "Select", "Quit");
  42.         return 1;
  43.     }
  44.     return 0;
  45. }
  46.  
  47. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  48. {
  49.     if(dialogid == DialogIDChangeOnProblems)
  50.     {
  51.         switch( listitem )
  52.         {
  53.             case 0:
  54.             {
  55.                 SetPVarString(playerid,"Accent", "American");
  56.             }
  57.             case 1:
  58.             {
  59.                 SetPVarString(playerid,"Accent", "Russian");
  60.             }
  61.             case 2:
  62.             {
  63.                 SetPVarString(playerid,"Accent","British");
  64.             }
  65.             case 3:
  66.             {
  67.                 SetPVarString(playerid,"Accent","Italian");
  68.             }
  69.             case 4:
  70.             {
  71.                 SetPVarString(playerid,"Accent","Dutch");
  72.             }
  73.             case 5:
  74.             {
  75.                 SetPVarString(playerid,"Accent","France");
  76.             }
  77.             case 6:
  78.             {
  79.                 SetPVarString(playerid,"Accent","Australian");
  80.             }
  81.             case 7:
  82.             {
  83.                 SetPVarString(playerid,"Accent","African");
  84.             }
  85.             case 8:
  86.             {
  87.                 SetPVarString(playerid,"Accent","Chinese");
  88.             }
  89.         }
  90.     }
  91. }
  92.  
  93. public NearbyMessageForPlayers( playerid, stringcolour, text[]) // Credits to whoever made this, it saves me alot of time.
  94. {
  95.     new Float:PosX, Float:PosY, Float:PosZ;
  96.     for(new p = 0; p < MAX_PLAYERS; p++)
  97.     {
  98.         if(IsPlayerConnected( p ))
  99.         {
  100.             GetPlayerPos( playerid, PosX, PosY, PosZ );
  101.             if(IsPlayerInRangeOfPoint(p, 12, PosX, PosY, PosZ) )
  102.             {
  103.                 if(GetPlayerInterior( playerid ) == GetPlayerInterior( p ) && GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( p ) )
  104.                 {
  105.                     SendClientMessage(p, stringcolour, text);
  106.                 }
  107.             }
  108.         }
  109.     }
  110.     return 1;
  111. }
Advertisement
Add Comment
Please, Sign In to add comment