SA-MP Forums Archive
[Ajuda] Duvida include foreach - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Duvida include foreach (/showthread.php?tid=664889)



Duvida include foreach - SmokeKiLL - 14.03.2019

Boa noite, gostaria de saber para que serve
Code:
foreach(Player, playerid)
Se alguйm puder me explicar eu agradeзo


Re: Duvida include foreach - ipsLuan - 14.03.2019

Isso й um loop.

for(new Player = 0; Player < MAX_PLAYERS; Player++)

Significa isso.


Re: Duvida include foreach - SmokeKiLL - 14.03.2019

Humm... Entendi. Mas tipo, se eu usar um loop em OnVehicleSpawn vocк acha que pode lagar o servidor?


Re: Duvida include foreach - ipsLuan - 15.03.2019

Depende muito...
Vocк quer fazer o quк?


Re: Duvida include foreach - SmokeKiLL - 15.03.2019

PHP Code:
foreach(Playerplayerid)
{    
    if(
ConceInfo[playerid][0][vehicleconce] == vehicleid || ConceInfo[playerid][1][vehicleconce] == vehicleid || ConceInfo[playerid][2][vehicleconce] == vehicleid)
    {
        
vTrancado[vehicleid] = 1;
        
vIDPlayer[vehicleid] = playerid;
    }




Re: Duvida include foreach - Scorpion659 - 15.03.2019

Quote:
Originally Posted by SmokeKiLL
View Post
PHP Code:
foreach(Playerplayerid)
{    
    if(
ConceInfo[playerid][0][vehicleconce] == vehicleid || ConceInfo[playerid][1][vehicleconce] == vehicleid || ConceInfo[playerid][2][vehicleconce] == vehicleid)
    {
        
vTrancado[vehicleid] = 1;
        
vIDPlayer[vehicleid] = playerid;
    }

Esse loop й bem pequeno, nгo lagaria. A nгo ser que tu spawne muitos (tipo muitos) carros a todo momento.