Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new modelid = 968;
- new PlayerPaid[MAX_PLAYERS] = {false, ...};
- new Float:GatePos[29][9] =
- {
- {x, y, z, r-x, r-y, r-z, x_open, y_close, z_close}
- }
- public OnFilterScriptInit()
- {
- for(new a; a<sizeof(GatePos); a++)
- {
- Gate[a] = CreateObject(modelid, GatePos[a][0],GatePos[a][1],GatePos[a][2],GatePos[a][3],GatePos[a][4],GatePos[a][5], 150.0);
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetTimer("TollGate_Open", 1500, 1);
- return 1;
- }
- public TollGate_Open()
- {
- new vehicleid;
- new open;
- for(new i=GetMaxPlayers(); i > -1; i--)
- {
- //Iterates through an array of Created Object toll gate
- for(new a; a<sizeof(GatePos); a++)
- {
- //If Player is in range of toll gate AND if open is false
- if(IsPlayerInRangeOfPoint(i, 6.0, GatePos[a][0],GatePos[a][1],GatePos[a][2]))
- {
- vehicleid = GetPlayerVehicleID(i);
- if(IsPlayerInVehicle(i, vehicleid))
- {
- open = true;
- //Moves the object barrier 968
- MoveObject(Gate[a], GatePos[a][0],GatePos[a][1],GatePos[a][2], 2000, GatePos[a][3], 0.0, GatePos[a][5]);
- //Prevents the closing of toll gate when the player's vehicle is still in range
- if(open && !PlayerPaid[i]){
- GivePlayerMoney(i,-20);
- GameTextForPlayer(i,"$20\nToll Paid",3000,4);
- PlayerPaid[i] = true;
- }else{
- continue;
- }
- break;
- }
- }
- if(!open){
- //SendClientMessage(PlayerPaid[i], -1, "Toll gate closed");
- MoveObject(Gate[a], GatePos[a][0],GatePos[a][1],GatePos[a][2], 2000, GatePos[a][3], GatePos[a][4], GatePos[a][5]);
- //PlayerPaid[i] = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement