27.07.2011, 11:57
(
Последний раз редактировалось Libra_PL; 27.07.2011 в 16:20.
)
Hello. I've got a little problem with minigame - teleporting to a vehicle... When the minigame starts, all players are teleporting to last vehicle. They see they are in a vehicle, but other players on/near this. I don't know what's wrong with my code, I it in many ways and no effect. Someone could help me is this code made correctly?
At first, creating a vehicle:
Numbers goes from 0 to 19, as there are 20 vehicles.
Then, teleporting player to a vehicle (it was made as TeleportToVehicle function):
Stock for IsAnyoneInAVehicle is made correctly, but to make sure to show all, here it is:
If everything here was made correctly, the problem is something, what I did before. I won't show what's before, I will check my code again, until I will get anwser what's problem in this code, which I pasted. The code should work that, every player teleports into another, empty vehicle.
Thanks for help.
At first, creating a vehicle:
Код:
mVehicle[0] = CreateVehicle(...); mVehicle[1] = CreateVehicle(...); [...]
Then, teleporting player to a vehicle (it was made as TeleportToVehicle function):
Код:
stock TeleportToVehicle(playerid) { for(new i = 0; i < 20; i++) { if(!IsAnyoneInAVehicle(pdVehicle[i]) && !IsPlayerInAnyVehicle(playerid)) { PutPlayerInVehicle(playerid,pdVehicle[i],0); } } return 1; }
Код:
stock IsAnyoneInAVehicle(vehicleid) { new In; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerInAnyVehicle(i)) { if(GetPlayerVehicleID(i) == vehicleid) In++; } } if(In > 0) return true; else return false; }
Thanks for help.