scripting help whit a gate
#1

hello everyone,
can somebody help me whit a script to /open a gate?
thanks!
Reply
#2

show us your code, the coordinates, the createobject or createdynamicobject or wutever you have, and which one you want to open/close.
Reply
#3

CreateObject(3749, 1525.15, 2772.92, 15.51, 0.00, 0.00, -90.42);
CreateObject(980, 1526.11, 2772.92, 12.58, 0.00, 0.00, -89.96);
thats the code
Reply
#4

hello so it very easy

add the flowing script

Код:
new mygate; //
on public OnGameModeInit() now add your mapping

Код:
mygate = CreateObject(980, 1526.11, 2772.92, 12.58, 0.00, 0.00, -89.96); // the gate
CreateObject(3749, 1525.15, 2772.92, 15.51, 0.00, 0.00, -90.42); // your map
the command

PHP код:
public OnPlayerCommandText(playeridcmdtext[]) 
{
    if(
strcmp(subcmd"o"true) == || strcmp(subcmd"open"true) == 0// /o OR /open to open the GATE
    
{
        
MoveObject(mygate1526.11002772.91996.58005);
        return 
1;
    }
    if(
strcmp(subcmd"c"true) == || strcmp(subcmd"close"true) == 0// /c OR /close to close the GATE
    
{
        
MoveObject(mygate1526.112772.9212.585);
        return 
1;
    }
    return 
0;

Reply
#5

thank you but you know how you can put this in a server?
Reply
#6

many tutorial out there. use search button next time
https://sampforum.blast.hk/showthread.php?tid=278880
Reply
#7

If you want to add this in game follow these step's :
1. Open your gm (Game Mode)
2. Click on find and and paste "OnGameModeInit()" in your search box
3. Copy and paste this code below OnGameModeInit
Код:
 mygate = CreateObject(980, 1526.11, 2772.92, 12.58, 0.00, 0.00, -89.96); // the gate
CreateObject(3749, 1525.15, 2772.92, 15.51, 0.00, 0.00, -90.42); // your map
4. Now again click on find and paste "OnPlayerCommandText" in your seach box
5. Copy and paste this code below OnPlayerCommandText
Код:
 public OnPlayerCommandText(playerid, cmdtext[]) 
{
    if(strcmp(subcmd, "o", true) == 0 || strcmp(subcmd, "open", true) == 0) // /o OR /open to open the GATE
    {
        MoveObject(mygate, 1526.1100, 2772.9199, 6.5800, 5);
        return 1;
    }
    if(strcmp(subcmd, "c", true) == 0 || strcmp(subcmd, "close", true) == 0) // /c OR /close to close the GATE
    {
        MoveObject(mygate, 1526.11, 2772.92, 12.58, 5);
        return 1;
    }
    return 0;
}
If this helped you, rep me
Reply
#8

******* is also good for finding these kind of things, would be more efficient and quicker.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)