get players in vehicle -
Hirsw0w - 23.09.2014
that possible to get players in vehicle without loop if someone know how that very help me.
Re: get players in vehicle -
amirab - 23.09.2014
no way without looping , you should loop and use IsPlayerInVehicle
Re: get players in vehicle -
Hirsw0w - 23.09.2014
Quote:
Originally Posted by amirab
no way without looping , you should loop and use IsPlayerInVehicle
|
but loop on 500 players every 0.3 secs do something? and make the server alot more slowely ( i have a lot loops in the mod and i wan't to found another way ).
Re: get players in vehicle -
Hirsw0w - 23.09.2014
help someone?
Re: get players in vehicle -
XStormiest - 23.09.2014
Well, thats impossible asumming you want to check if players are in the vehicle, or if you have the patient to do.
pawn Код:
if(IsPlayerInVehicle(0, vehicleid))
if(IsPlayerInVehicle(1, vehicleid))
//..........................................
if(IsPlayerInVehicle(500, vehicleid))
Until you hit 500, those are like.... 500 verificaitons a second with a timer? thats will quantify the lag you would have with the loop (wich is low...- the loop i mean).
Re: get players in vehicle -
Vince - 23.09.2014
I suppose you could use foreach to create an iterator for each vehicle. But that array would be huge since you need to allocate 2000 vehicles, multiplied by the number of available seats. Then when the player enters the vehicle you push their playerid onto the array. Whenever you need to get the players in the car you use a foreach statement. This'd loop through about 4 values or so. I believe a bus can seat 8 players, though.
Re: get players in vehicle -
Pottus - 23.09.2014
Quote:
Originally Posted by Hirsw0w
that possible to get players in vehicle without loop if someone know how that very help me.
|
What do you mean "get players in vehicle" you are not being very clear here.
Re : get players in vehicle -
streetpeace - 23.09.2014
IsPlayerInAnyVehicle, do you mean that ?
Re: get players in vehicle -
XStormiest - 23.09.2014
He cant do it without a loop, it doesnt really matter if it is IsPlayerInAnyVehicle, or IsPlayerInVehicle.
Try imagine this:
Max 2000 Vehicles on SA-MP.
621-400 = 221 cars on SA-MP including all kind of transports:
Some of them have 1,2,4 seats.
And he have to verify for each ....
Is a Math calculation so huge that I cant type it here (but I have it in my mind.)