Szerző Téma: sorompó  (Megtekintve 765 alkalommal)

sorompó
« Dátum: 2015. Február 18. - 15:10:34 »
0 Show voters
Hali.
PPC modhoz hogyan tudnák ilyen sorompót csinálni?
http://kepfeltoltes.hu/view/130309/974976380sa-mp-144_www.kepfeltoltes.hu_.png
válaszotokat előre is köszönöm
« Utoljára szerkesztve: 2015. Február 19. - 08:56:46 írta Pasztor1997 »

Nem elérhető ZSOLTI99

  • 1827
    • Profil megtekintése
sorompó
« Válasz #1 Dátum: 2015. Február 18. - 16:38:19 »
0 Show voters
Ugyan úgy kell mint a kaput csak ezt felfelé kell hajtani.

sorompó
« Válasz #2 Dátum: 2015. Február 18. - 17:14:41 »
0 Show voters
Tudsz küldeni egy példát?

sorompó
« Válasz #3 Dátum: 2015. Február 18. - 17:33:19 »
0 Show voters
#define FILTERSCRIPT
#include <a_samp>
#define PRESSED(%0) \\
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 
new sorompo;
forward close();
#if defined FILTERSCRIPT
public OnFilterScriptInit(){
        sorompo = CreateObject(968,0.0,0.0,0.0,0.0,0.0,0.0);
        CreateObject(0.0,0.0,0.0,0.0,0.0,0.0);}
public OnFilterScriptExit(){
        return 1;}
#endif
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
        if(IsPlayerInRangeOfPoint(playerid, 5.0, 0.0, 0.0, 0.0)){
                if(PRESSED(KEY_HANDBRAKE)) {
                MoveObject(sorompo, 0.0, 0.0, 0.0, 1, 0, 0, 90);
                SetTimer(\"close\", 4000, false);  }}
        return 1;}
public close(){
        MoveObject(sorompo, 0.0,0.0,0.0, 1,  0, 270, 90);
        return 1;}
« Utoljára szerkesztve: 2015. Február 18. - 18:41:15 írta Andriis »

sorompó
« Válasz #4 Dátum: 2015. Február 18. - 17:44:44 »
0 Show voters
Én Tollgate példára gondoltam.

Nem elérhető ZSOLTI99

  • 1827
    • Profil megtekintése
sorompó
« Válasz #5 Dátum: 2015. Február 18. - 18:25:43 »
0 Show voters
Tessék hátha kell még valakinek is . Hivatalos fórumon találtam (van kirakva)
http://forum.sa-mp.com/showthread.php?t=196493&highlight=trucking&page=438
 
AddTollGate(Float:X, Float:Y, Float:Z, Float:RX, Float:RY, Float:RZ, TollMoney)

 
PPC_GameModeInti
 
// This function is used to add toll-gates to the map
AddTollGate(Float:X, Float:Y, Float:Z, Float:RX, Float:RY, Float:RZ, TollMoney)
{
// Loop through all tollgates
for (new TollGate; TollGate < MAX_TOLLGATES; TollGate++)
{
// Check if this is an empty entry
if (ATollGates[TollGate][GateID] == 0)
{
   // Create a new object for the toll-gate in it\'s closed status
   CreateObject(966, X, Y, Z, RX, RY, RZ);
   ATollGates[TollGate][GateID] = CreateObject(968, X, Y, Z+0.8, RX, RY-90.0, RZ);
   // Set data
   ATollGates[TollGate][TollPrice] = TollMoney; // Set the price to pay for passing the toll-gate
   ATollGates[TollGate][GateStatus] = 0; // Set the status to CLOSED
   ATollGates[TollGate][TollX] = X; // Save the X coordinates
   ATollGates[TollGate][TollY] = Y; // Save the Y coordinates
   ATollGates[TollGate][TollZ] = Z; // Save the Z coordinates
   ATollGates[TollGate][TollRX] = RX; // Save the RX coordinates
   ATollGates[TollGate][TollRY] = RY; // Save the RY coordinates
   ATollGates[TollGate][TollRZ] = RZ; // Save the RZ coordinates
   // Count the total amount of refuelstations that have been created
   TollGateLoad++;
   break; // Stop the for-loop
}
}
}

 
PPC_Defines
 
// Setup a custom type that holds all data about toll-boots (les peages jaune)
enum TTollGate
{
GateID, // Holds the object-id of the gate
TollPrice, // Holds the price for passing the gate
GateStatus, // Holds the status of the gate (open = 1, closed = 0)
Float:TollX, // Holds the coordinates when the gate is opened
Float:TollY, // Holds the coordinates when the gate is opened
Float:TollZ, // Holds the coordinates when the gate is opened
Float:TollRX, // Holds the coordinates when the gate is closed
Float:TollRY, // Holds the coordinates when the gate is closed
Float:TollRZ // Holds the coordinates when the gate is closed
}

 

PPC_Toll
Code:
// This file holds all functions for the toll-system
forward Toll();
public Toll()
{
// Loop through all players
    for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
// If the player isn\'t connected, skip to the next player
        if(APlayerData[playerid][LoggedIn] == false) continue;
// Check if the player is the driver of a vehicle
if (GetPlayerVehicleSeat(playerid) == 0)
{
   // Loop through all toll-gates
   for (new TollGate; TollGate < MAX_TOLLGATES; TollGate++)
   {
      // Check if this toll-gate exists
      if (ATollGates[TollGate][GateID] != 0)
      {
          // Check if the player is in range of the tollgate
           if(IsPlayerInRangeOfPoint(playerid, 7.5, ATollGates[TollGate][TollX], ATollGates[TollGate][TollY], ATollGates[TollGate][TollZ]))
           {
            // Check if the toll-gate is closed
               if(ATollGates[TollGate][GateStatus] == 0)
            {
                // Open the gate
                   MoveObject(ATollGates[TollGate][GateID], ATollGates[TollGate][TollX], ATollGates[TollGate][TollY], ATollGates[TollGate][TollZ]+0.82, 0.04, ATollGates[TollGate][TollRX], ATollGates[TollGate][TollRY], ATollGates[TollGate][TollRZ]);
               // Set status to OPEN
                   ATollGates[TollGate][GateStatus] = 1;
               if (ATollGates[TollGate][TollPrice] != 0)
               {
                  // Let the player pay the toll
                  RewardPlayer(playerid, -ATollGates[TollGate][TollPrice], 0);
                  new string[50];
                  format(string, sizeof(string), TXT_PlayerPaysToll, ATollGates[TollGate][TollPrice]);
                  GameTextForPlayer(playerid, string, 3000, 4);
               }
                   // Start a timer that closes the gate after 5 seconds
                   SetTimerEx(\"CloseGate\", 5000, false, \"i\", TollGate);
            }
           }
      }
   }
}
    }
}
forward CloseGate(TollGate);
public CloseGate(TollGate)
{
    // Close the gate
MoveObject(ATollGates[TollGate][GateID], ATollGates[TollGate][TollX], ATollGates[TollGate][TollY], ATollGates[TollGate][TollZ]+0.82, 0.04, ATollGates[TollGate][TollRX], ATollGates[TollGate][TollRY]-90.0, ATollGates[TollGate][TollRZ]);
// Set status to CLOSED
ATollGates[TollGate][GateStatus] = 0;
}

sorompó
« Válasz #6 Dátum: 2015. Február 18. - 19:14:47 »
0 Show voters
http://kepfeltoltes.hu/view/150218/asdd_www.kepfeltoltes.hu_.png és ha kitörlöm ezt a sort akkor pedig felcsapódik
« Utoljára szerkesztve: 2015. Február 18. - 19:24:22 írta Pasztor1997 »

Nem elérhető ZSOLTI99

  • 1827
    • Profil megtekintése
sorompó
« Válasz #7 Dátum: 2015. Február 18. - 21:20:25 »
0 Show voters
Idézetet írta: Pasztor1997 date=1424283287\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"52640\" data-ipsquote-contentclass=\"forums_Topic
http://kepfeltoltes.hu/view/150218/asdd_www.kepfeltoltes.hu_.png és ha kitörlöm ezt a sort akkor pedig felcsapódik
 
AKkor ne töröld ki azt a sort és nem fog felcsapódni....Amúgy meg elég ha zárt állapotba le mappolni és  magától megy!

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal