SA-MP Forums Archive
GetPlayerVehicleID - 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: GetPlayerVehicleID (/showthread.php?tid=435773)



GetPlayerVehicleID - ryanhawk31 - 08.05.2013

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


Re: GetPlayerVehicleID - IceCube! - 08.05.2013

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)
}



Re: GetPlayerVehicleID - ryanhawk31 - 08.05.2013

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


Re: GetPlayerVehicleID - IceCube! - 08.05.2013

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..
}



Respuesta: GetPlayerVehicleID - LoLeRo - 08.05.2013

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.


Re: Respuesta: GetPlayerVehicleID - IceCube! - 08.05.2013

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


Respuesta: Re: Respuesta: GetPlayerVehicleID - LoLeRo - 08.05.2013

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.


Re: GetPlayerVehicleID - IceCube! - 08.05.2013

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


Re: GetPlayerVehicleID - Knappen - 08.05.2013

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)
}



Re: GetPlayerVehicleID - IceCube! - 08.05.2013

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!