Advertisement
Deaderik

Untitled

Feb 5th, 2024
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.53 KB | Gaming | 0 0
  1. // Rádio systém od SuperGrand
  2. // radio_system.pwn
  3.  
  4. #include <a_samp>
  5. #include <sscanf2>
  6.  
  7. #define MAX_PLAYERS 50 // Príklad, nastavte podľa potreby
  8.  
  9. new PlayerRadio[MAX_PLAYERS];
  10.  
  11. public OnPlayerCommandText(playerid, cmdtext[]) {
  12.     if (strcmp(cmdtext, "/radio", true) == 0) {
  13.         if (IsPlayerInAnyVehicle(playerid)) {
  14.             new vehicleid = GetPlayerVehicleID(playerid);
  15.  
  16.             // Kontrola, či hráč nie je na bicykli (bicykle majú ID 509 a 510)
  17.             if (!IsBike(vehicleid)) {
  18.                 new url[256];
  19.                 sscanf(cmdtext, "s[256]", url);
  20.  
  21.                 if (strlen(url) > 0) {
  22.                     // Nastavenie URL rádia pre konkrétnyho hráča
  23.                     PlayerRadio[playerid] = url;
  24.                     SendClientMessage(playerid, -1, "Rádiový stream bol aktualizovaný.");
  25.                 } else {
  26.                     // Hráč chce vypnúť svoje rádio
  27.                     PlayerRadio[playerid] = "";
  28.                     SendClientMessage(playerid, -1, "Rádio bolo vypnuté.");
  29.                 }
  30.             } else {
  31.                 SendClientMessage(playerid, -1, "Nemôžete používať rádio na bicykli.");
  32.             }
  33.         } else {
  34.             SendClientMessage(playerid, -1, "Musíte byť v aute, aby ste mohli používať rádio.");
  35.         }
  36.         return 1;
  37.     }
  38.     return 0;
  39. }
  40.  
  41. // Nová funkcia pre kontrolu typu vozidla
  42. public IsBike(vehicleid) {
  43.     return (GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement