Convoy Trucking

Hyde Park => GTA & SA-MP => Topic started by: Rockey on August 05, 2012, 22:33

Title: Moving gates
Post by: Rockey on August 05, 2012, 22:33
I am currently making a new map on mta that im putting a lot of working into and want to show it to a few friends but before i do that i want to add it to my local server so i can add moving gates and thing like that.. I've seen videos on how to add gates that open on command ( you type /gate1 ) for example, but i want it how cvt works, as in when you aprouch the gate opens.

Please can somone explain how this is done, also for a cookie if you can tell me how to make my map load before the cars load.. my cars on my local keep falling through my private island :why:
Title: Re: Moving gates
Post by: DeHavilland on August 05, 2012, 22:37
1. You should know the gate id
2. Place the gate where you want it
3. Place another gate where you want it to go to
4. Convert your .map at convertffs website
5. Place the codes to your gamemode
6. Then search for the object id for that gate and remove that one (where you wanted it to go 3.)
7. Make a command
8. Save and try

That's how I think it should work, if it doesn't then read http://wiki.sa-mp.com/wiki/MoveObject
Title: Re: Moving gates
Post by: Rockey on August 05, 2012, 22:40
Quote from: DeHavilland on August 05, 2012, 22:37
1. You should know the gate id
2. Place the gate where you want it
3. Place another gate where you want it to go to
4. Convert your .map at convertffs website
5. Place the codes to your gamemode
6. Then search for the object id for that gate and remove that one (where you wanted it to go 3.)
7. Make a command
8. Save and try

That's how I think it should work, if it doesn't then read http://wiki.sa-mp.com/wiki/MoveObject

But this wont work on a radius? i want it to work like club gates do in cvt, just without being in the club
Title: Re: Moving gates
Post by: Matias on August 05, 2012, 23:10
There you have, i will not tell you how all the script works, figure it by yourself.
Also you must try by yourself if you ask us you dont learn. You can get more help at samp forums.


#include <a_samp>
#include <foreach>

new gate;
forward Timer();
forward GateClose();

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
Gate = CreateObject(....);
return 1;
}

public OnPlayerConnect(playerid)
{
SetTimer("Timer", 1000, 1);
return 1;
}

public Timer()
{
    for(new i=0; i<MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
{
    if(IsPlayerInRangeOfPoint(i, 5, x_coord, y_coord, z_coord))
{
    MoveObject(Gate, x_coord, y_coord, z_coord, speed);
    SetTimer("GateClose", 5000, 0);
    return 1;
    }
}
}
}

public GateClose()
{
    MoveObject(Gate, x_coord, y_coord, z_coord, speed);
    return 1;
}
Title: Re: Moving gates
Post by: Twido on August 05, 2012, 23:15
know to script xD
Title: Re: Moving gates
Post by: Rockey on August 05, 2012, 23:57
Thanks for your help guys, i want to learn but right now its just for showcasing maps.. Anyone got an idea about how to make the map load before cars do?
Title: Re: Moving gates
Post by: Matias on August 06, 2012, 00:05
You can add Objects at Gamemodeinit and set a timer at Gamemodeinit, then at public fuction of that timer you add the cars.
That will let you choose when you want the cars to spawn :)
Almost everything is based on timers



At Top of gamemode:

forward SpawnCars();

At:

public OnGameModeInit()
{
Objects List

        SetTimer("SpawnCars", 5000, 0);
return 1;
}

public SpawnCars()
{
        Add Cars Coords Here
        return 1;
}