SA-MP Forums Archive
/open and /close don't work. - 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: /open and /close don't work. (/showthread.php?tid=347094)



/open and /close don't work. - Gangster-rocks - 31.05.2012

pawn Код:
CreateObject(2990,2479.87768555,-1720.38623047,16.46136665,0.00000000,0.00000000,179.99993896); //object(wongs_gate) (1)
pawn Код:
if (strcmp("/open", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, 0xFFCFFF, " You've opened the gate please close it ");
        MoveObject(2990,2479.87768555,-1720.38623047,16.46136665,0.00000000,0.00000000,179.99993896,1);
        SetTimer("close", 10000, 0);//the gate will close after 10 seconds
       
       return 1;
    }
if (strcmp("/close", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, 0xFFCFFF, " You've closed the gate thanks for closing it ");
        MoveObject(2990,2479.87768555,-1720.38623047,16.46136665,0.00000000,0.00000000,179.99993896,0);
What i've to do.


Re: /open and /close don't work. - Jonny5 - 31.05.2012

all your X,Y,Z is the same

you need the one for open to be the X. Y, Z, Angel of the gate once its opened.


Re: /open and /close don't work. - HuSs3n - 31.05.2012

pawn Код:
//on top
new IsOpened,Gate;

//OnGameModeinit
Gate = CreateObject(2990,2479.87768555,-1720.38623047,16.46136665,0.00000000,0.00000000,179.99993896);
IsOpened=0;
pawn Код:
if (strcmp("/open", cmdtext, true, 10) == 0)
    {
        if(IsOpened == 1) return SendClientMessage(playerid, 0xFFFCFFF, " The Gate Is Already Opened ");
        IsOpened =1;
        SendClientMessage(playerid, 0xFFFCFFF, " You've opened the gate please close it ");
        MoveObject(Gate,2479.87768555,-1720.38623047,10.46136665,3.00,0.00000000,0.00000000,179.99993896);
        SetTimer("close", 10000, 0);//the gate will close after 10 seconds
       
       return 1;
    }
if (strcmp("/close", cmdtext, true, 10) == 0)
    {
        if(IsOpened == 0) return SendClientMessage(playerid, 0xFFFCFFF, " The Gate Is Already Closed ");
        IsOpened =0;
        MoveObject(Gate,2479.87768555,-1720.38623047,16.46136665,3.00,0.00000000,0.00000000,179.99993896);
     }

pawn Код:
forward close();
public close()
{
     If(IsOpened == 1)
     {      
           MoveObject(Gate,2479.87768555,-1720.38623047,16.46136665,3.00,0.00000000,0.00000000,179.99993896);
           IsOpened=0;
     }
}



Re: /open and /close don't work. - [jS]Thomas - 31.05.2012

Firstly your X,Y,Z are all the same as the above poster has posted. Secondly, you need to show what object your moving e.g. Gate = CreateDynamicObject and MoveObject(Gate,...)

This should help: https://sampforum.blast.hk/showthread.php?tid=332956


Re: /open and /close don't work. - Gangster-rocks - 31.05.2012

What is the DynamicObject i donno it.


Re: /open and /close don't work. - Gangster-rocks - 31.05.2012

@Huss3an
pawn Код:
AMEMO~1\s.pwn(43) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(43) : error 017: undefined symbol "IsOpened"
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(43) : warning 215: expression has no effect
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(43) : error 017: undefined symbol "Gate"
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(45) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(55) : warning 202: number of arguments does not match definition
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(56) : warning 202: number of arguments does not match definition
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(57) : warning 213: tag mismatch
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(106) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(112) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(117) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(119) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(122) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(127) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(129) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(132) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(137) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(139) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(141) : error 017: undefined symbol "IsOpened"
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(142) : error 017: undefined symbol "IsOpened"
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(142) : warning 215: expression has no effect
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(144) : error 017: undefined symbol "Gate"
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(147) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(151) : error 017: undefined symbol "IsOpened"
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(152) : error 017: undefined symbol "IsOpened"
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(152) : warning 215: expression has no effect
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(153) : error 017: undefined symbol "Gate"
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(155) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(158) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(160) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(163) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(165) : warning 217: loose indentation
C:\DOCUME~1\admin\Desktop\NEWFOL~3\GAMEMO~1\s.pwn(169) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


8 Errors.



Re: /open and /close don't work. - Gangster-rocks - 31.05.2012

See.


Re: /open and /close don't work. - HuSs3n - 31.05.2012

show ur code ,how and where did you add the lines


Re: /open and /close don't work. - newbienoob - 31.05.2012

Try
pawn Код:
new IsOpened[MAX_PLAYERS];

if(IsOpened[playerid] == 1) return SendClientMessage(playerid, 0xFFFCFFF, " The Gate Is Already Opened ");



Re: /open and /close don't work. - HuSs3n - 31.05.2012

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
Try
pawn Код:
new IsOpened[MAX_PLAYERS];

if(IsOpened[playerid] == 1) return SendClientMessage(playerid, 0xFFFCFFF, " The Gate Is Already Opened ");
Thats wrong!