Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #define HORN_DIALOG (16234)
- #define HORNKEY KEY_SUBMISSION
- new horns[9][2][64] = {
- {"http://sampsounds.site40.net/1.mp3","horn 1"},
- {"http://sampsounds.site40.net/2.mp3","horn 2"},
- {"http://sampsounds.site40.net/3.mp3","horn 3"},
- {"http://sampsounds.site40.net/4.mp3","horn 4"},
- {"http://sampsounds.site40.net/5.mp3","horn 5"},
- {"http://sampsounds.site40.net/6.mp3","horn 6"},
- {"http://sampsounds.site40.net/7.mp3","horn 7"},
- {"http://sampsounds.site40.net/8.mp3","horn 8"},
- {"http://sampsounds.site40.net/9.mp3","horn 9"}
- };
- new HornsStr[256];
- new Horn[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Custom Horn Sounds.");
- print("--------------------------------------\n");
- for(new i; i<sizeof(horns);i++)
- {
- if(i<sizeof(horns)-1)
- {
- format(HornsStr,sizeof(HornsStr),"%s%s\n",HornsStr, horns[i][1]);
- }
- else
- {
- format(HornsStr,sizeof(HornsStr),"%s%s",HornsStr, horns[i][1]);
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/horn", cmdtext, true, 10) == 0)
- {
- ShowPlayerDialog(playerid,HORN_DIALOG,DIALOG_STYLE_LIST,"Válaszd ki a dudád hangját",HornsStr,"Választ","Meghallgat");
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid==HORN_DIALOG)
- {
- if(!response)
- {
- PlayAudioStreamForPlayer(playerid, horns[listitem][0]);
- ShowPlayerDialog(playerid,HORN_DIALOG,DIALOG_STYLE_LIST,"Válaszd ki a dudád hangját",HornsStr,"Választ","Meghallgat");
- }
- else
- {
- Horn[playerid]=listitem;
- }
- }
- return 1;
- }
- #define RELEASED(%0) \
- (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if (RELEASED(HORNKEY))
- {
- new Float:p[3];
- GetPlayerPos(playerid,p[0],p[1],p[2]);
- for(new i;i<MAX_PLAYERS;i++)
- {
- if(IsPlayerInRangeOfPoint(i,35,p[0],p[1],p[2]))
- {
- PlayAudioStreamForPlayer(i, horns[Horn[playerid]][0]);
- }
- }
- PlayAudioStreamForPlayer(playerid, horns[Horn[playerid]][0]);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement