SAMP Gitlab CI Test
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6 KiB

  1. //-------------------------------------------------
  2. // Internet radio example
  3. // (c) 2011 SA-MP Team
  4. //-------------------------------------------------
  5. #pragma tabsize 0
  6. #include <a_samp>
  7. //-------------------------------------------------
  8. public OnFilterScriptInit()
  9. {
  10. return 1;
  11. }
  12. //-------------------------------------------------
  13. public OnPlayerStateChange(playerid, newstate, oldstate)
  14. {
  15. // play an internet radio stream when they are in a vehicle
  16. if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
  17. {
  18. PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls");
  19. }
  20. // stop the internet stream
  21. else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
  22. {
  23. StopAudioStreamForPlayer(playerid);
  24. }
  25. return 0;
  26. }
  27. //-------------------------------------------------
  28. public OnPlayerUpdate(playerid)
  29. {
  30. if(!IsPlayerConnected(playerid)) return 0;
  31. if(IsPlayerNPC(playerid)) return 1;
  32. // Handle playing SomaFM at the alhambra
  33. if(GetPlayerInterior(playerid) == 17) {
  34. if(IsPlayerInRangeOfPoint(playerid,70.0,489.5824,-14.7563,1000.6797)) { // alhambra middle
  35. if(!GetPVarInt(playerid,"alhambra")) {
  36. SetPVarInt(playerid,"alhambra",1);
  37. PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls",480.9575,-3.5402,1002.0781,40.0,true);
  38. }
  39. }
  40. }
  41. else {
  42. if(GetPVarInt(playerid,"alhambra")) {
  43. DeletePVar(playerid,"alhambra");
  44. StopAudioStreamForPlayer(playerid);
  45. }
  46. }
  47. return 1;
  48. }
  49. //-------------------------------------------------