Moving a gate help!!
#1

I have do 5 gate help but all the stuff people said didnt work so here i am again need help

PHP код:
#include <a_samp> 
#define FILTERSCRIPT 
new gate1
public 
OnFilterScriptInit() 
{  
    
gate1 CreateObject(9692231.45703, -2212.4411612.531810.000000.00000, -45.00000); //Gate1
    
return 1

public 
OnPlayerCommandText(playeridcmdtext[]) 

    if(!
strcmp(cmdtext"/open"true)) 
    { 
        if(
IsPlayerInRangeOfPoint(playerid15.02231.4570, -2212.44129.3241)) 
        { 
            
MoveObject(gate12231.4570, -2212.44129.32415); 
            
SendClientMessage(playerid0x0000BBAA"the Gate Opened Successfuly , Weclome !"); 
            return 
1
        } 
    } 
    if(!
strcmp(cmdtext"/close"true)) 
    { 
        if(
IsPlayerInRangeOfPoint(playerid15.02231.45703, -2212.4411612.53181)) 
        { 
            
MoveObject(gate12231.45703, -2212.4411612.531815); 
            
SendClientMessage(playerid0xAA3333AA"the Gate Closed successfuly !"); 
            return 
1
        } 
    } 
      return 
0

Reply
#2

Try to put this line:

pawn Код:
gate1 = CreateObject(969, 2231.45703, -2212.44116, 12.53181, 0.00000, 0.00000, -45.00000); //Gate1
Under OnGameModeInIt.
Reply
#3

It does not work in game when i type in /open or /close it just said bad command
Reply
#4

Have you thought of updating to zcmd?
Reply
#5

MoveObject have seven arguments. https://sampwiki.blast.hk/wiki/MoveObject
Reply
#6

Quote:
Originally Posted by Goldino
Посмотреть сообщение
Have you thought of updating to zcmd?
Can i have the link please
Reply
#7

PHP код:
#include <a_samp>
#define FILTERSCRIPT
new gate1;
public 
OnFilterScriptInit()
{
    
gate1 CreateObject(9692231.45703, -2212.4411612.531810.000000.00000, -45.00000); //Gate1
    
return 1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/open"cmdtexttrue10) == 0)
    {
        if(
IsPlayerInRangeOfPoint(playerid15.02231.4570, -2212.44129.3241))
        {
            
MoveObject(gate12231.4570, -2212.44129.40485);
            
SendClientMessage(playerid0x0000BBAA"the Gate Opened Successfuly , Weclome !");
            return 
1;
        }
    }
    if (
strcmp("/close"cmdtexttrue10) == 0)
    {
        if(
IsPlayerInRangeOfPoint(playerid15.02231.45703, -2212.4411612.53181))
        {
            
MoveObject(gate12231.45703, -2212.4411612.531815);
            
SendClientMessage(playerid0xAA3333AA"the Gate Closed successfuly !");
            return 
1;
        }
    }
    return 
0;

Reply
#8

Quote:
Originally Posted by LavaHDProkiller
Посмотреть сообщение
It does not work in game when i type in /open or /close it just said bad command
You have to be near a certain point for the gate to work since the command has:
if(IsPlayerInRangeOfPoint(playerid, 15.0, 2231.4570, -2212.4412, 9.3241))
You have to be within 15 units from 2231.4570, -2212.4412, 9.3241 in order for the command to work.
Reply
#9

*Oops. Sorry for this failed post... xD*
Reply
#10

Right, You asked me to help you on Skype so here it goes.

You will need Zcmd so here is the link: http://www.solidfiles.com/d/d20f/

So here goes, First off do this:
Код:
//Includes
#include <zcmd> //Commands processor - Quicker and better IMO

//New-Gates
new gate1;

public OnGameModeInit()
{
      // Don't use these lines if it's a filterscript
      SetGameModeText("Blank Script");
      AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

      //Gate Creation
     gate1 = CreateObject(969, 2231.45703, -2212.44116, 12.53181, 0.00000, 0.00000, -45.00000);

      return 1;
}
Now that you have done that, It should have made the gate. To make it work, Do the following:

Код:
//Below you can change the command, All you need to do is change next to the CMD: part to whatever you want your command to be. Make sure there is not a space between the colon and the command its self. 
CMD:closegate(playerid, params[])
{

	MoveObject(gate1, 2231.45703, -2212.44116, 12.53181, 1);
	SendClientMessage(playerid, 0xEF994300, "You opened (Gate Name Here)...");


	return 1;
}

CMD:opengate(playerid, params[])
{

	MoveObject(gate1, 2231.4570, -2212.4412, 9.3241, 1);
	SendClientMessage(playerid, 0xEF994300, "You closed (Gate Name Here)...");


	return 1;
}
Right now that you have done this, You may want to test this out. Just compile the script, I reccomend doing it in a game-mode because its easier for me. (IMO)

.:Steps:.
1:. Follow the steps (You may want to type it instead of copy and pasting it because of errors...)
2:. Make sure to COMPILE your game-mode after.
3:. Start your server and test it out.

Good luck and have fun coding. I sure have.

Hope I helped you, Regards,
Skillzz
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)