News:

Server address: server.convoytrucking.net
Get SA-MP 0.3.7 here: Click Here to download SA-MP 0.3.7

Main Menu

Moving gates

Started by Rockey, August 05, 2012, 22:33

Rockey

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:

DeHavilland

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
[hide=Our Renault Dauphine]
80's

90's

2007

2014 with new team colour

[/hide]

Rockey

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

Matias

#3
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;
}

Twido



[hide= Just a rule]
Quote from: Mick88
Your friends do not have the authority to allow you to break server rules. ๖ۣۜTωi∂✿
[/hide]


Rockey

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?

Matias

#6
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;
}