Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #define Dialog_Control 999999
- #define Dialog_Radio5 999998
- forward TimerBaterie(playerid);
- forward RadioUpdate(vehicleid, station);
- forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
- new Baterie[MAX_VEHICLES];
- new motor[MAX_VEHICLES], lumini[MAX_VEHICLES], alarma[MAX_VEHICLES], capota[MAX_VEHICLES], portbagaj[MAX_VEHICLES], radiostation[MAX_VEHICLES];
- new Menu:RadioMenu;
- new engine,lights,alarm,doors,bonnet,boot,objective;
- new updatebaterie;
- #pragma tabsize 0
- public OnFilterScriptInit()
- {
- ManualVehicleEngineAndLights();
- RadioMenu = CreateMenu("RadioMenu", 2, 200.0, 100.0, 150.0, 150.0);
- AddMenuItem(RadioMenu, 0, "1");
- AddMenuItem(RadioMenu, 0, "2");
- AddMenuItem(RadioMenu, 0, "3");
- AddMenuItem(RadioMenu, 0, "4");
- AddMenuItem(RadioMenu, 0, "5");
- AddMenuItem(RadioMenu, 0, "6");
- AddMenuItem(RadioMenu, 1, "Radio Hit");
- AddMenuItem(RadioMenu, 1, "Radio Wish");
- AddMenuItem(RadioMenu, 1, "Contact FM");
- AddMenuItem(RadioMenu, 1, "R Hip-Hop");
- AddMenuItem(RadioMenu, 1, "R Populara");
- AddMenuItem(RadioMenu, 1, "Stop");
- for(new carid=0;carid<MAX_VEHICLES;carid++)
- {
- Baterie[carid] = 200;
- motor[carid] = 0;
- lumini[carid] = 0;
- alarma[carid] = 0;
- capota[carid] = 0;
- portbagaj[carid] = 0;
- }
- updatebaterie = SetTimer("TimerBaterie", 30000, 1);
- print("\n--------------------------------------");
- print(" Baterie Vehicul by Gireada");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- KillTimer(updatebaterie);
- return 1;
- }
- CMD:baterie(playerid, params[])
- {
- new carid = GetPlayerVehicleID(playerid), string[256];
- format(string, sizeof(string), "* {FF0000}%d %{C2A2DA} Baterie.", Baterie[carid]);
- ProxDetector(30.0, playerid, string, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
- return 1;
- }
- CMD:controlv(playerid, params[])
- {
- if(!IsPlayerInAnyVehicle(playerid))
- {
- SendClientMessage(playerid, 0xCC0000FF, "EROARE : Trebuie sa fii intr-un vehicul pentru a folosi aceasta comanda.");
- }
- else
- {
- SendClientMessage(playerid, 0xCC0000FF, "Comenzi : /alarma /motor /lumini /radio /portbagaj /capota.");
- }
- return 1;
- }
- CMD:radio(playerid, params[])
- {
- if(!IsPlayerInAnyVehicle(playerid))
- {
- SendClientMessage(playerid, 0xCC0000FF, "EROARE : Trebuie sa fii intr-un vehicul pentru a folosi aceasta comanda.");
- }
- else
- {
- ShowMenuForPlayer(RadioMenu, playerid);
- }
- return 1;
- }
- CMD:motor(playerid, params[])
- {
- new veh = GetPlayerVehicleID(playerid);
- if(motor[veh] == 0)
- {
- GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(veh,true,lights,alarm,doors,bonnet,boot,objective);
- motor[veh] = 1;
- }
- else if(motor[veh] == 1)
- {
- GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(veh,false,lights,alarm,doors,bonnet,boot,objective);
- motor[veh] = 0;
- }
- return 1;
- }
- CMD:lumini(playerid, params[])
- {
- new veh = GetPlayerVehicleID(playerid);
- if(lumini[veh] == 0)
- {
- GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(veh,engine,true,alarm,doors,bonnet,boot,objective);
- lumini[veh] = 1;
- }
- else if(lumini[veh] == 1)
- {
- GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(veh,engine,false,alarm,doors,bonnet,boot,objective);
- lumini[veh] = 0;
- }
- return 1;
- }
- CMD:capota(playerid, params[])
- {
- new veh = GetPlayerVehicleID(playerid);
- if(capota[veh] == 0)
- {
- GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(veh,engine,lights,alarm,doors,true,boot,objective);
- capota[veh] = 1;
- }
- else if(capota[veh] == 1)
- {
- GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(veh,engine,lights,alarm,doors,false,boot,objective);
- capota[veh] = 0;
- }
- return 1;
- }
- CMD:portbagaj(playerid, params[])
- {
- new veh = GetPlayerVehicleID(playerid);
- if(portbagaj[veh] == 0)
- {
- GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,true,objective);
- portbagaj[veh] = 1;
- }
- else if(portbagaj[veh] == 1)
- {
- GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,false,objective);
- portbagaj[veh] = 0;
- }
- return 1;
- }
- CMD:alarma(playerid, params[])
- {
- new veh = GetPlayerVehicleID(playerid);
- if(alarma[veh] == 0)
- {
- GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(veh,engine,lights,true,doors,bonnet,boot,objective);
- alarma[veh] = 1;
- }
- else if(alarma[veh] == 1)
- {
- GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(veh,engine,lights,false,doors,bonnet,boot,objective);
- alarma[veh] = 0;
- }
- return 1;
- }
- public RadioUpdate(vehicleid, station)
- {
- for(new p=0; p<MAX_PLAYERS; p++)
- {
- if(IsPlayerInVehicle(p, vehicleid))
- {
- if(station == 0)
- {
- StopAudioStreamForPlayer(p);
- }
- if(station == 1)
- {
- PlayAudioStreamForPlayer(p, "http://www.radio-hit.ro/asculta.m3u");
- }
- if(station == 2)
- {
- PlayAudioStreamForPlayer(p, "http://www.radiowish.ro/live.m3u");
- }
- if(station == 3)
- {
- PlayAudioStreamForPlayer(p, "http://www.contactfm.ro/listen.pls");
- }
- if(station == 4)
- {
- PlayAudioStreamForPlayer(p, "http://radioromanian.net/hiphop.pls");
- }
- if(station == 5)
- {
- PlayAudioStreamForPlayer(p, "http://radioromanian.net/popular.pls");
- }
- }
- return 1;
- }
- return 1;
- }
- public TimerBaterie(playerid)
- {
- new veh = GetPlayerVehicleID(playerid);
- // new engine,lights,alarm,doors,bonnet,boot,objective;
- GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
- for(new carid=0;carid<MAX_VEHICLES;carid++)
- {
- if(motor[carid] == 1)
- {
- Baterie[veh] += 1;
- }
- else if(lumini[carid] == 1 && motor[carid] == 1)
- {
- Baterie[veh] -= 4;Baterie[veh] += 1;
- }
- }
- return 1;
- }
- stock IsVehicleOccupied(vehicleid)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
- return 1;
- return 0;
- }
- public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:posx, Float:posy, Float:posz;
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
- {
- if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- SendClientMessage(i, col5, string);
- }
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- if(radiostation[vehicleid] == 1)
- {
- PlayAudioStreamForPlayer(playerid, "http://www.radio-hit.ro/asculta.m3u");
- }
- if(radiostation[vehicleid] == 2)
- {
- PlayAudioStreamForPlayer(playerid, "http://www.radiowish.ro/live.m3u");
- }
- if(radiostation[vehicleid] == 3)
- {
- PlayAudioStreamForPlayer(playerid, "http://www.contactfm.ro/listen.pls");
- }
- if(radiostation[vehicleid] == 4)
- {
- PlayAudioStreamForPlayer(playerid, "http://radioromanian.net/hiphop.pls");
- }
- if(radiostation[vehicleid] == 5)
- {
- PlayAudioStreamForPlayer(playerid, "http://radioromanian.net/popular.pls");
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- StopAudioStreamForPlayer(playerid);
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- radiostation[vehicleid] = 0;
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- StopAudioStreamForPlayer(playerid);
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- new veh = GetPlayerVehicleID(playerid), sendername[50], string[256];
- if(GetPlayerMenu(playerid) == RadioMenu)
- {
- switch(row)
- {
- case 0:
- {
- radiostation[veh] = 1;
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "* {FF0000}%s{C2A2DA} Comuta radioul pe postul Radio Hit.", sendername);
- ProxDetector(30.0, playerid, string, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
- RadioUpdate(veh, 1);
- HideMenuForPlayer(RadioMenu, playerid);
- }
- case 1:
- {
- radiostation[veh] = 2;
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "* {FF0000}%s{C2A2DA} Comuta radioul pe postul Radio WISH.", sendername);
- ProxDetector(30.0, playerid, string, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
- RadioUpdate(veh, 2);
- HideMenuForPlayer(RadioMenu, playerid);
- }
- case 2:
- {
- radiostation[veh] = 3;
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "* {FF0000}%s{C2A2DA} Comuta radioul pe postul Contact FM.", sendername);
- ProxDetector(30.0, playerid, string, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
- RadioUpdate(veh, 3);
- HideMenuForPlayer(RadioMenu, playerid);
- }
- case 3:
- {
- radiostation[veh] = 4;
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "* {FF0000}%s{C2A2DA} Comuta radioul pe postul Radio Romania Hip-Hop.", sendername);
- ProxDetector(30.0, playerid, string, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
- RadioUpdate(veh, 4);
- HideMenuForPlayer(RadioMenu, playerid);
- }
- case 4:
- {
- radiostation[veh] = 5;
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "* {FF0000}%s{C2A2DA} Comuta radioul pe postul Radio Romania Populara.", sendername);
- ProxDetector(30.0, playerid, string, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
- RadioUpdate(veh, 5);
- HideMenuForPlayer(RadioMenu, playerid);
- }
- case 5:
- {
- radiostation[veh] = 0;
- format(string, sizeof(string), "* {FF0000}%s{C2A2DA} Opreste Radioul.", sendername);
- ProxDetector(30.0, playerid, string, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
- RadioUpdate(veh, 0);
- HideMenuForPlayer(RadioMenu, playerid);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement