Advertisement
Guest User

Automatic Toll Gate with Charging of player 2

a guest
May 8th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1.  
  2. new open[MAX_PLAYERS];
  3.  
  4. public TollGate_Open()
  5. new tollvehicle;
  6.  
  7. for(new i=GetMaxPlayers(); i > -1; i--)
  8. {
  9. //Iterates through an array of Created Object toll gate
  10. for(new a; a<sizeof(GatePos); a++)
  11. {
  12. //If Player is in range of toll gate AND if open is false
  13. if(IsPlayerInRangeOfPoint(i, 8.0, GatePos[a][0],GatePos[a][1],GatePos[a][2]))
  14. {
  15. tollvehicle = GetPlayerVehicleID(i);
  16.  
  17. if(IsPlayerInVehicle(i, tollvehicle) && open[i] != true)
  18. {
  19. MoveObject(Gate[a], GatePos[a][0],GatePos[a][1],GatePos[a][2], 5.00, GatePos[a][3], 0.0, GatePos[a][5]);
  20. open[i] = true;
  21. GivePlayerMoney(i,-20);
  22. GameTextForPlayer(i,"$20\nToll Paid",3000,4);
  23. }
  24. }
  25.  
  26. //Move back the toll gate to its closed state
  27. if(!open[i]){
  28. MoveObject(Gate[a], GatePos[a][0],GatePos[a][1],GatePos[a][2], 5.00, GatePos[a][3], GatePos[a][4], GatePos[a][5]);
  29. open[i] = false;
  30. }
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement