Changing radio for all players in the car! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Changing radio for all players in the car! (
/showthread.php?tid=580440)
Changing radio for all players in the car! -
OGKush - 05.07.2015
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!
Re: Changing radio for all players in the car! -
[XST]O_x - 05.07.2015
Quote:
Originally Posted by OGKush
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! 
|
Or just use foreach.