get players in vehicle
#1

that possible to get players in vehicle without loop if someone know how that very help me.
Reply
#2

no way without looping , you should loop and use IsPlayerInVehicle
Reply
#3

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 ).
Reply
#4

help someone?
Reply
#5

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).
Reply
#6

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.
Reply
#7

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.
Reply
#8

IsPlayerInAnyVehicle, do you mean that ?
Reply
#9

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.)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)