PDA

View Full Version : Changing radio for all players in the car!


OGKush
05/07/2015, 02:29 PM
OK,here I am,again...I have a curiosity!:)) Here's some code that is in the OnDialogReponse,something with that radios...etc. So,I don't want to change the radio only for me,I want to change for everyone that is in my car!:))


PlayRadio(playerid,listitem); // listitem = the radio ID and PlayRadio is a function that chooses and plays the radio.
new ID = GetPlayerVehicleID(playerid);
for(new i;i<=MAX_PLAYERS;i++) if(IsPlayerInVehicle(i,ID) PlayRadio(i,listitem);

1. Do you know a shorter method,or something that consumes less RAM or CPU?
2. It consumes too much RAM or CPU? A good host can process this code without lag,even with 500-1000 players on? Because there are 500 loops minimum...anyway,I want to make a server with 1000 slots (in my dreams).

I have an idea,to pun the IDs of players that enter in the car in a .txt,on seats...seat 1,seat 2,seat 3,a file that contains data about that car and then when I change the Radio to take that IDs from the file...this seems complicated,but if is necessary and less consuming in memory and CPU I will do it!:D

[XST]O_x
05/07/2015, 03:08 PM
I have an idea,to pun the IDs of players that enter in the car in a .txt,on seats...seat 1,seat 2,seat 3,a file that contains data about that car and then when I change the Radio to take that IDs from the file...this seems complicated,but if is necessary and less consuming in memory and CPU I will do it!:D

Or just use foreach.