Moving gate open and close
#1

Hello,The problem is that it opens but doesn't close. like when i type /opensfa7house ,it opens the door but when i type /closesfa7house ,nothing happens
please help me,
CodeIs:

#include <a_samp>

#define FILTERSCRIPT
new sfa7house;

public OnFilterScriptInit()
{
sfa7house = CreateObject(980, 249.21007, -1760.01697, 7.74010, 0.00000, 0.00000, 0.00000, 100.0);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/opensfa7house", true)){
MoveObject(sfa7house, 0, 0, 0, 3.0, 0.0, 0.0, 0.0);
return 1;
}
else if(strcmp(cmdtext, "/closesfa7house", true)){
MoveObject(sfa7house, 249.21007, -1760.01697, 7.74010, 0.00000, 0.00000, 0.00000, 100.0);
return 1;
}
return 0;
}
public OnFilterScriptExit()
{
return 1;
}
Reply
#2

don't use "else"..also, why does it move the object to coords "0,0,0" then to 249.21007, -1760.01697, 7.74010?

On the open command the speed is also not set?

I reckon using zcmd and doing it like this

pawn Код:
CMD:open(playerid, params[])
{
if(sscanf(params, "open", params)
{
if(IsPlayerInRangeOfPoint(whatever)
{
//open object
}
if(sscanf(params, "close", params)
{
if(IsPlayerInRangeOfPoint(whatever)
{
//close object
}
This will give you one command for all your gates (open, close)..Just add a new "ifisplayerinrangeofpoint" for every new gate, it also uses zcmd and sscanf2, which are two includes every good scripter uses (and not so good :S) Drop me a PM if you wish me to give further assistance.

NOTE: This is a demo, notice the lack of indentations, and I think I left out a few closing braces
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)