zsawall (Object ID 19359) closed ( 2658.9016, -1518.2900, 39.2486, 0.0000, 0.0000, 89.1446 ) opened ( 2660.2017, -1518.2900, 39.2486, 0.0000, 0.0000, 89.1446 ) //---------------------------------------------------------- zsadoorint - (Object ID 1537) closed ( 2657.27100, -1518.02466, 38.09280, 0.00000, 0.00000, -182.00000) opened ( 2658.5439, -1518.0027, 38.0928, 0.00000, 0.00000, -182.00000)
new zsabookcase, bool: zsabookcaseState ; //--------------------------------------------- zsabookcase = CreateObject( 14455,2662.2791, -1518.4174, 39.5401,0,0, 179.1134 ); // bookcase. zsabookcaseState = false; //---------------------------------------------- public OnPlayerCommandText( playerid, cmdtext[ ] ) { if ( !strcmp( cmdtext, "/7895123", true ) ) { if ( cmdtext[ 8 ] ) return false; if ( !IsPlayerInRangeOfPoint( playerid, 2.0, 2656.6663, -1518.6973, 39.1067 ) ) return SendClientMessage( playerid, -1, "You are not close enough." ); zsabookcaseState = ! zsabookcaseState; switch ( zsabookcaseState ) { case true : // True = Gate is opened MoveObject( zsabookcase, 2663.7615, -1518.4259, 39.4907, 1.0 ); default : // Else ( false ) = Gate is closed MoveObject( zsabookcase, 2662.2791, -1518.4174, 39.5401, 1.0 ); } SendClientMessage( playerid, -1, ( zsabookcaseState ) ? ( "ZSA - Access Granted" ) : ( "Closing Access" ) ); // ^ iGateState == true ^ Then ^ Gate is open ^ Else ^ Gate is closed return 1; } return 0; }
case true:
{
MoveObject(...);
MoveObject(...);
}
default:
{
MoveObject(...);
MoveObject(...);
}
new object[3];
object[0] = CreateObject(...);
object[1] = CreateObject(...);
object[2] = CreateObject(...);
case true:
{
MoveObject(object[0],...);
MoveObject(object[1],...);
MoveObject(object[2],...);
}
default:
{
MoveObject(object[0],...);
MoveObject(object[1],...);
MoveObject(object[2],...);
}
pawn Код:
More info on MoveObject https://sampwiki.blast.hk/wiki/MoveObject |
#include <a_samp>
new object[3];//~~~~~~~~~~~~~~~~~//
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
object[0] = CreateObject(14455,2662.2791, -1518.4174, 39.54010,0,0, 179.1134,0.0);//BOOKCASE
object[1] = CreateObject(19359,2658.9016, -1518.2900, 39.2486, 0.0000, 0.0000, 89.1446,0.0);//ZSAWALL
object[2] = CreateObject(1537, 2657.27100, -1518.02466, 38.09280, 0.00000, 0.00000, -182.00000,0.0);//ZSADOORINT
return 1;
}
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
if ( !strcmp( cmdtext, "/7895123", true ) )
{
if ( cmdtext[ 8 ] )
return false;
if ( !IsPlayerInRangeOfPoint( playerid, 2.0, 2656.6663, -1518.6973, 39.1067 ) )
return SendClientMessage( playerid, -1, "You are not close enough." );
object[3]State = ! object[3]State;
switch ( object[3]State )
{
case true : // True = Gate is opened
{
MoveObject(object[0], 2663.7615, -1518.4259, 39.4907, 1.0 );
MoveObject(object[1], 2663.7615, -1518.4259, 39.4907, 1.0 );
MoveObject(object[2], 2663.7615, -1518.4259, 39.4907, 1.0 );
}
default : // Else ( false ) = Gate is closed
{
MoveObject(object[0], 2662.2791, -1518.4174, 39.5401, 1.0 );
MoveObject(object[1], 2662.2791, -1518.4174, 39.5401, 1.0 );
MoveObject(object[2], 2662.2791, -1518.4174, 39.5401, 1.0 );
{
}
SendClientMessage( playerid, -1, ( object[3]State ) ? ( "ZSA - Access Granted" ) : ( "Closing Access" ) );
// ^ iGateState == true ^ Then ^ Gate is open ^ Else ^ Gate is closed
return 1;
}
return 0;
}
C:\Users\Ygor\Desktop\vamuve\zhq.pwn(52) : error 032: array index out of bounds (variable "object")
C:\Users\Ygor\Desktop\vamuve\zhq.pwn(52) : error 017: undefined symbol "State"
C:\Users\Ygor\Desktop\vamuve\zhq.pwn(52) : error 032: array index out of bounds (variable "object")
C:\Users\Ygor\Desktop\vamuve\zhq.pwn(52) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.