SA-MP Forums Archive
Please help me !! I NEED THIS ! MOVING GATE! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Please help me !! I NEED THIS ! MOVING GATE! (/showthread.php?tid=448109)



Please help me !! I NEED THIS ! MOVING GATE! - gligorj - 03.07.2013

I need this gate to move :/

CreateObject(980,2220.8000500,-18.5000000,28.2000000,0.0000000,0.0000000,40.00000 00); //object(airportgate) (1)

please give me a code :///


Re: Please help me !! I NEED THIS ! MOVING GATE! - niconhan - 03.07.2013

Try this again. Fixed problems
Код:
#include <a_samp> // As usual, add this include to the top so your script will work.
#include <streamer> // For CreateDynamicObject and MoveDynamicObject

new gate; // The objectid your gate will be using
new timer[MAX_PLAYERS]; // Creates your auto-closing timer
//Add these two ABOVE your OnFilterScriptInit() or OnGameModeInit()

public OnFilterScriptInit() // or OnGameModeInit() if you are using a gamemode
{
    gate = CreateDynamicObject(980,2220.8000500,-18.5000000,28.2000000,0.0000000,0.0000000,40.00000); //object(airportgate) (1)
    // Place this under OnFilterScriptInit(), or OnGameModeInit() if you are using it in a gamemode.
}

public OnPlayerCommandText(playerid, cmdtext[]) // This is where we make the open command
{
    if (strcmp("/open", cmdtext, true, 10) == 0) // When a player types '/open'
    {
          if(IsPlayerInRangeOfPoint(playerid, 15, 2220.8000500,-18.5000000,28.2000000)) // Will detect whether they are near the gate or not
           { // It is recommended you set the RangeOfPoint to the coordinates of your 'closed' gate
           MoveDynamicObject(gate, 2220.8000500,-18.5000000,23.2000000, 3);
           SendClientMessage(playerid, 0xEF994300, "The gate is opening and will close in 10 seconds."); // Send the player that typed /open, this message
           timer[playerid] = SetTimerEx("gateclose",10000,false,"i",playerid); // Will activate a timer called 'gateclose' after 10 seconds, once the player has typed 'open'. Does not repeat itself.
           // If you want to change timer: 1 Second = 1000, 5 seconds = 5000, 40 seconds = 40000, 1 minute = 60000 etc.
          }
    }
    return 1;
}

forward gateclose(); //Defines our 'gateclose' timer when a player types /open, and what we want the gate to do
public gateclose()
{
      MoveDynamicObject(gate, 2220.8000500,-18.5000000,28.2000000, 3);
      // which will be the same as the position in your FilterScriptInit()
}



Re: Please help me !! I NEED THIS ! MOVING GATE! - gligorj - 03.07.2013

this is a filterscript ?


Re: Please help me !! I NEED THIS ! MOVING GATE! - niconhan - 03.07.2013

Quote:
Originally Posted by gligorj
Посмотреть сообщение
this is a filterscript ?
Yes! But if you want use in gamemode you can copy it to pwn file and replace it


Re: Please help me !! I NEED THIS ! MOVING GATE! - gligorj - 03.07.2013

I am using this like a filterscript , i compile it and then in the game mode commands are not allowed , they are not working all of the commands..


Re: Please help me !! I NEED THIS ! MOVING GATE! - niconhan - 03.07.2013

Try this
Код:
#include <a_samp> // As usual, add this include to the top so your script will work.
#include <streamer> // For CreateDynamicObject and MoveDynamicObject
#include <ZCMD> // For Easy Command

new gate; // The objectid your gate will be using
new timer[MAX_PLAYERS]; // Creates your auto-closing timer
//Add these two ABOVE your OnFilterScriptInit() or OnGameModeInit()

public OnFilterScriptInit() // or OnGameModeInit() if you are using a gamemode
{
    gate = CreateDynamicObject(980,2220.8000500,-18.5000000,28.2000000,0.0000000,0.0000000,40.00000); //object(airportgate) (1)
    // Place this under OnFilterScriptInit(), or OnGameModeInit() if you are using it in a gamemode.
}

CMD:gate(playerid, params[])
{
          if(IsPlayerInRangeOfPoint(playerid, 15, 2220.8000500,-18.5000000,28.2000000)) // Will detect whether they are near the gate or not
           { // It is recommended you set the RangeOfPoint to the coordinates of your 'closed' gate
           MoveDynamicObject(gate, 2220.8000500,-18.5000000,23.2000000, 3);
           SendClientMessage(playerid, 0xEF994300, "The gate is opening and will close in 10 seconds."); // Send the player that typed /open, this message
           timer[playerid] = SetTimerEx("gateclose",10000,false,"i",playerid); // Will activate a timer called 'gateclose' after 10 seconds, once the player has typed 'open'. Does not repeat itself.
           // If you want to change timer: 1 Second = 1000, 5 seconds = 5000, 40 seconds = 40000, 1 minute = 60000 etc.
          }
	}


forward gateclose(); //Defines our 'gateclose' timer when a player types /open, and what we want the gate to do
public gateclose()
{
      MoveDynamicObject(gate, 2220.8000500,-18.5000000,28.2000000, 3);
      // which will be the same as the position in your FilterScriptInit()
}



Re: Please help me !! I NEED THIS ! MOVING GATE! - gligorj - 03.07.2013

Thank you my friend , now is working , i will open a server , so pm if you want to be my scripter i will pay you


Re: Please help me !! I NEED THIS ! MOVING GATE! - niconhan - 03.07.2013

Quote:
Originally Posted by gligorj
Посмотреть сообщение
Thank you my friend , now is working , i will open a server , so pm if you want to be my scripter i will pay you
No problems. I can script for you if you want.
Add me skype : lov3_public
or Yahoo id : lov3_public
Recommended use Yahoo ! Thanks you


Re: Please help me !! I NEED THIS ! MOVING GATE! - GeniusPobs - 03.07.2013

No return?
pawn Код:
#include <a_samp> // As usual, add this include to the top so your script will work.
#include <streamer> // For CreateDynamicObject and MoveDynamicObject
#include <ZCMD> // For Easy Command

new gate; // The objectid your gate will be using
new timer[MAX_PLAYERS]; // Creates your auto-closing timer
//Add these two ABOVE your OnFilterScriptInit() or OnGameModeInit()

public OnFilterScriptInit() // or OnGameModeInit() if you are using a gamemode
{
    gate = CreateDynamicObject(980,2220.8000500,-18.5000000,28.2000000,0.0000000,0.0000000,40.00000); //object(airportgate) (1)
    // Place this under OnFilterScriptInit(), or OnGameModeInit() if you are using it in a gamemode.
   return 1;
}

CMD:gate(playerid, params[])
{
          if(IsPlayerInRangeOfPoint(playerid, 15, 2220.8000500,-18.5000000,28.2000000)) // Will detect whether they are near the gate or not
           { // It is recommended you set the RangeOfPoint to the coordinates of your 'closed' gate
           MoveDynamicObject(gate, 2220.8000500,-18.5000000,23.2000000, 3);
           SendClientMessage(playerid, 0xEF994300, "The gate is opening and will close in 10 seconds."); // Send the player that typed /open, this message
           timer[playerid] = SetTimerEx("gateclose",1000*10,false,"i",playerid); // Will activate a timer called 'gateclose' after 10 seconds, once the player has typed 'open'. Does not repeat itself.
           // 1000 milliseconds = 1 second
          }
          return 1;
    }


forward gateclose(); //Defines our 'gateclose' timer when a player types /open, and what we want the gate to do
public gateclose()
{
      MoveDynamicObject(gate, 2220.8000500,-18.5000000,28.2000000, 3);
      // which will be the same as the position in your FilterScriptInit()
      return 1;
}



Re: Please help me !! I NEED THIS ! MOVING GATE! - niconhan - 03.07.2013

why not?