Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Do what ever you want with it, except: releasing it as your own.
- #define FILTERSCRIPT
- #define DialogIDChangeOnProblems 1928 // Change the ammount if it messes up with other dialogs
- #include <a_samp>
- new string[128];
- forward NearbyMessageForPlayers( playerid, stringcolour, text[]);
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Accent system by playbox loaded");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SetPVarString(playerid,"Accent","Unknown"); // Sets the accent to 'unknown' untill the player chooses his players accent
- SendClientMessage(playerid, 0xFFFFFFAA, "This server runs 'playbox's SimpleAccents', type /accent to set your players accent"); // You can delete this I don't care
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- new playername[MAX_PLAYER_NAME], PlayersAccent[12];
- GetPlayerName(playerid, playername, sizeof(playername));
- GetPVarString(playerid, "Accent", PlayersAccent, 12);
- format(string, sizeof(string), "[%s accent] %s: %s", PlayersAccent, playername, text);
- NearbyMessageForPlayers(playerid, 0xFFFFFFAA, string);
- return 0;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/accent", cmdtext, true, 10) == 0)
- {
- ShowPlayerDialog(playerid, DialogIDChangeOnProblems, DIALOG_STYLE_LIST, "Accent selection", "American\nRussian\nBritish\nItalian\nDutch\nFrance\nAustralian\nAfrican\nChinese\nRomanian", "Select", "Quit");
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DialogIDChangeOnProblems)
- {
- switch( listitem )
- {
- case 0:
- {
- SetPVarString(playerid,"Accent", "American");
- }
- case 1:
- {
- SetPVarString(playerid,"Accent", "Russian");
- }
- case 2:
- {
- SetPVarString(playerid,"Accent","British");
- }
- case 3:
- {
- SetPVarString(playerid,"Accent","Italian");
- }
- case 4:
- {
- SetPVarString(playerid,"Accent","Dutch");
- }
- case 5:
- {
- SetPVarString(playerid,"Accent","France");
- }
- case 6:
- {
- SetPVarString(playerid,"Accent","Australian");
- }
- case 7:
- {
- SetPVarString(playerid,"Accent","African");
- }
- case 8:
- {
- SetPVarString(playerid,"Accent","Chinese");
- }
- case 9:
- {
- SetPVarString(playerid,"Accent","Romanian");
- }
- }
- }
- }
- public NearbyMessageForPlayers( playerid, stringcolour, text[]) // Credits to whoever made this, it saves me alot of time.
- {
- new Float:PosX, Float:PosY, Float:PosZ;
- for(new p = 0; p < MAX_PLAYERS; p++)
- {
- if(IsPlayerConnected( p ))
- {
- GetPlayerPos( playerid, PosX, PosY, PosZ );
- if(IsPlayerInRangeOfPoint(p, 12, PosX, PosY, PosZ) )
- {
- if(GetPlayerInterior( playerid ) == GetPlayerInterior( p ) && GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( p ) )
- {
- SendClientMessage(p, stringcolour, text);
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment