21.03.2011, 16:56
Hi,
No, this isn't another noob topic about how i can spawn them ...
I've made a function to return the closest tram and to put the player into it to drive it (seat 0).
But, i noticed it only works on one tram. So if i spawn 2 trams, the code will succeed on Tram 1, but fails at Tram 2. Same thing happens with 3 trams, 4 trams, and so on. Is this a samp bug or something? This is my code:
Greetz,
Danny
No, this isn't another noob topic about how i can spawn them ...
I've made a function to return the closest tram and to put the player into it to drive it (seat 0).
But, i noticed it only works on one tram. So if i spawn 2 trams, the code will succeed on Tram 1, but fails at Tram 2. Same thing happens with 3 trams, 4 trams, and so on. Is this a samp bug or something? This is my code:
Код:
stock ReturnClosestTramID(playerid) { for(new c=0; c<MAX_VEHICLES; c++) { if(GetVehicleModel© == 449) { new Float:X,Float:Y,Float:Z; GetVehiclePos(c, X, Y, Z); if(IsPlayerInRangeOfPoint(playerid, TRAM_RANGE, X, Y, Z)) { return c; } } } return -1; }
Danny