GetPlayerVehicleID
#1

Hi i need something like GetPlayerVehicleID thats get all the vehicle id's
Anyone help?
Reply
#2

Of all the Players...

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    new Storage = GetPlayerVehicleID(i);
    //code (What you want to do with it)
}
Reply
#3

i mean i making a /refillcars command that refill all cars in the server
i use zcmd
Reply
#4

Quote:
Originally Posted by ryanhawk31
Посмотреть сообщение
i mean i making a /refillcars command that refill all cars in the server
i use zcmd
Then use the same thing...

pawn Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
    VehicleInfo[i][vFuel] = 100.00;// TO be adjusted to your script..
}
Reply
#5

Well, something like this would be:


Quote:

for(new i = 0; i < MAX_PLAYERS; i++)
{
for(new cars=0; cars<MAX_VEHICLES; cars++)
{
//function
}
}

I donґt know if it will works but you can try it.
Reply
#6

Quote:
Originally Posted by LoLeRo
Посмотреть сообщение
Well, something like this would be:




I donґt know if it will works but you can try it.
Why do a loop of all the cars for each player? Thats pointless your repeating the task for the deafult 500 players... if unaltered...
Reply
#7

Quote:
Originally Posted by IceCube!
Посмотреть сообщение
Why do a loop of all the cars for each player? Thats pointless your repeating the task for the deafult 500 players... if unaltered...
I have seen in some roleplay servers that they use 2 loops, one for players and other one for vehicles.

But ryan you can use the script you need.
Reply
#8

Yes, thats for looping through owned vehicles for example, therefore you dont need to use 2 BIG numbers like Players and Vehicles but...

Players
Max_Owned_Vehicles (Of which they can max own searching their player data).

Each loop has afunction, if he used yours his loop would go on for hours...
Reply
#9

Quote:
Originally Posted by IceCube!
Посмотреть сообщение
Of all the Players...

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    new Storage = GetPlayerVehicleID(i);
    //code (What you want to do with it)
}
Correction
new Storage[MAX_PLAYERS]; // Global

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    new Storage[i] = GetPlayerVehicleID(i);
    //code (What you want to do with it)
}
Reply
#10

Quote:
Originally Posted by Knappen
Посмотреть сообщение
Correction
new Storage[MAX_PLAYERS]; // Global

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    new Storage[i] = GetPlayerVehicleID(i);
    //code (What you want to do with it)
}
NO!, As you ONLY want to alter that iformaton for INSIDE THAT FUNCTION, I'm fed up with this thread being bumped!

He Only needs the vehicle ID for the cars the players are currantly in for refueling. HE DOES NOT need to have this sotred forever, it should be destroyed once the function has ran its course, if you do this will all your varialbes condgradulate your self on create a RAM hogging gamemode.

If thats what hes doing, if he wants all cars change it to all cars(Max Vehicles) he can, I cant even remember what hes doing but it doesn't require a global variable!

STOP bumping this thread when the CORRECT answer has been given unless you have something USEFUL to add!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)