Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new Float:VehicleX[MAX_VEHICLES],Float:VehicleY[MAX_VEHICLES],Float:VehicleZ[MAX_VEHICLES],Float:Percorreu[MAX_VEHICLES],Timer[MAX_VEHICLES];
- stock Float:GetDistanceVehicleFromPoint(vehicleid,float:pontox,float:pontoy,float:pontoz)
- {
- new Float:x,Float:y,Float:z;
- GetVehiclePos(vehicleid,x1,y1,z1);
- return floatsqroot(floatpower(floatabs(floatsub(pontox,x)),2)+floatpower(floatabs(floatsub(pontoy,y)),2)+floatpower(floatabs(floatsub(pontoz,z)),2));
- }
- stock GetDistanceTraveled(vehicleid) return Percorreu[vehicleid];
- public OnGameModeInit()
- {
- for(new v; v < MAX_VEHICLES; v++)
- {
- GetVehiclePos(v,VehicleX[v],VehicleY[v],VehicleZ[v]);
- }
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- Timer[vehicleid] = SetTimerEx("Corrida",2000,true,"i",vehicleid);
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- KillTimer(Timer[vehicleid]);
- return 1;
- }
- public forward Corrida(vehicleid)
- {
- Percorreu[vehicleid] += GetDistanceVehicleFromPoint(vehicleid,VehicleX[vehicleid],VehicleY[vehicleid],VehicleZ[vehicleid]);
- GetVehiclePos(vehicleid,VehicleX[vehicleid],VehicleY[vehicleid],VehicleZ[vehicleid]);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment