26.09.2012, 04:47
Hey there. How could I open Doors with a key (such as the KEY_LOOK_BEHIND) instead of a command? Where would I create this and what would I put? Thanks.
else if ( PRESSED(KEY_LOOK_BEHIND) )
{
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer.");
if(PlayerToPoint(10,playerid,1558.970703125, -1677.9114990234, 1722.1081542969))
{
MoveObject(door1,1558.970703125, -1677.9114990234, 1722.1081542969,1.50);
MoveObject(door2,1561.9755859375, -1677.8798828125, 1722.1081542969,1.50);
}
else if(PlayerToPoint(3.0,playerid,1552.7789306641, -1691.4653320313, 1722.1081542969))
{
MoveObject(door3,1550.4266357422, -1691.5009765625, 1722.1081542969,1.50);
MoveObject(door4,1553.4294433594, -1691.4515380859, 1722.1081542969,1.50);
}
else if(PlayerToPoint(3.0,playerid,1560.1090087891, -1653.4477539063, 1719.5637207031))
{
MoveObject(door5,1560.1090087891, -1653.4477539063, 1719.5637207031,1.50);
}
return 1;
}
if(PlayerToPoint(10,playerid,1558.970703125, -1677.9114990234, 1722.1081542969))
else if(PlayerToPoint(20,playerid,1552.7789306641, -1691.4653320313, 1722.1081542969))
{
MoveObject(door3,1550.4266357422, -1691.5009765625, 1722.1081542969,1.50);
MoveObject(door4,1553.4294433594, -1691.4515380859, 1722.1081542969,1.50);
}
else if(PlayerToPoint(20,playerid,1560.1090087891, -1653.4477539063, 1719.5637207031))
{
MoveObject(door5,1560.1090087891, -1653.4477539063, 1719.5637207031,1.50);
}
return 1;
}
Everything is fine except when I press the button again it will not close. Only open. How do I make another one so it closes with the same button?
|
new gate1status;
new gate2status;
new gate3status;
else if ( PRESSED(KEY_LOOK_BEHIND) )
{
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer.");
if(PlayerToPoint(3.0,playerid,1558.970703125, -1677.9114990234, 1722.1081542969))
{
MoveObject(door1,1558.1387939453, -1677.8883056641, 1722.1081542969,1.50);
MoveObject(door2,1562.7950439453, -1677.8798828125, 1722.1081542969,1.50);
}
else if(PlayerToPoint(3.0,playerid,1552.7789306641, -1691.4653320313, 1722.1081542969))
{
MoveObject(door3,1549.6147460938, -1691.4772949219, 1722.1081542969,1.50);
MoveObject(door4,1554.2923583984, -1691.4328613281, 1722.1081542969,1.50);
}
else if(PlayerToPoint(3.0,playerid,1560.1090087891, -1653.4477539063, 1719.5637207031))
{
MoveObject(door5,1560.1309774200, -1651.7266845703, 1719.5637207031,1.50);
}
return 1;
}
else if ( PRESSED(KEY_LOOK_BEHIND) )
{
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer.");
if(PlayerToPoint(3.0,playerid,1558.970703125, -1677.9114990234, 1722.1081542969))
{
MoveObject(door1,1558.970703125, -1677.9114990234, 1722.1081542969,1.50);
MoveObject(door2,1561.9755859375, -1677.8798828125, 1722.1081542969,1.50);
}
else if(PlayerToPoint(3.0,playerid,1552.7789306641, -1691.4653320313, 1722.1081542969))
{
MoveObject(door3,1550.4266357422, -1691.5009765625, 1722.1081542969,1.50);
MoveObject(door4,1553.4294433594, -1691.4515380859, 1722.1081542969,1.50);
}
else if(PlayerToPoint(3.0,playerid,1560.1090087891, -1653.4477539063, 1719.5637207031))
{
MoveObject(door5,1560.1090087891, -1653.4477539063, 1719.5637207031,1.50);
}
return 1;
}
else if ( PRESSED(KEY_LOOK_BEHIND) )
{
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer.");
else {
if(PlayerToPoint(3.0,playerid,1558.970703125, -1677.9114990234, 1722.1081542969))
{
if(gate1status == 0) {
MoveObject(door1,1558.1387939453, -1677.8883056641, 1722.1081542969,1.50);
MoveObject(door2,1562.7950439453, -1677.8798828125, 1722.1081542969,1.50);
gate1status = 1; }
else if(gate1status == 1) {
MoveObject(door1,1558.970703125, -1677.9114990234, 1722.1081542969,1.50);
MoveObject(door2,1561.9755859375, -1677.8798828125, 1722.1081542969,1.50);
gate1status = 0; }
}
else if(PlayerToPoint(3.0,playerid,1552.7789306641, -1691.4653320313, 1722.1081542969))
{
if(gate2status == 0) {
MoveObject(door3,1549.6147460938, -1691.4772949219, 1722.1081542969,1.50);
MoveObject(door4,1554.2923583984, -1691.4328613281, 1722.1081542969,1.50);
gate2status = 1; }
else if(gate2status == 1) {
MoveObject(door3,1550.4266357422, -1691.5009765625, 1722.1081542969,1.50);
MoveObject(door4,1553.4294433594, -1691.4515380859, 1722.1081542969,1.50);
gate2status = 0; }
}
}
else if(PlayerToPoint(3.0,playerid,1560.1090087891, -1653.4477539063, 1719.5637207031))
{
if(gate3status == 0) {
MoveObject(door5,1560.1309774200, -1651.7266845703, 1719.5637207031,1.50);
gate3status = 1; }
else if(gate3status == 1) {
MoveObject(door5,1560.1090087891, -1653.4477539063, 1719.5637207031,1.50);
gate3status = 0; }
}
}
}
return 1;
}
if ( PRESSED(KEY_LOOK_BEHIND) )
{
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer.");
else {
if(PlayerToPoint(3.0,playerid,1558.970703125, -1677.9114990234, 1722.1081542969))
{
if(gate1status == 0) {
MoveObject(door1,1558.1387939453, -1677.8883056641, 1722.1081542969,1.50);
MoveObject(door2,1562.7950439453, -1677.8798828125, 1722.1081542969,1.50);
gate1status = 1; }
else if(gate1status == 1) {
MoveObject(door1,1558.970703125, -1677.9114990234, 1722.1081542969,1.50);
MoveObject(door2,1561.9755859375, -1677.8798828125, 1722.1081542969,1.50);
gate1status = 0; }
}
else if(PlayerToPoint(3.0,playerid,1552.7789306641, -1691.4653320313, 1722.1081542969))
{
if(gate2status == 0) {
MoveObject(door3,1549.6147460938, -1691.4772949219, 1722.1081542969,1.50);
MoveObject(door4,1554.2923583984, -1691.4328613281, 1722.1081542969,1.50);
gate2status = 1; }
else if(gate2status == 1) {
MoveObject(door3,1550.4266357422, -1691.5009765625, 1722.1081542969,1.50);
MoveObject(door4,1553.4294433594, -1691.4515380859, 1722.1081542969,1.50);
gate2status = 0; }
}
}
else if(PlayerToPoint(3.0,playerid,1560.1090087891, -1653.4477539063, 1719.5637207031))
{
if(gate3status == 0) {
MoveObject(door5,1560.1309774200, -1651.7266845703, 1719.5637207031,1.50);
gate3status = 1; }
else if(gate3status == 1) {
MoveObject(door5,1560.1090087891, -1653.4477539063, 1719.5637207031,1.50);
gate3status = 0; }
}
}
}
return 1;
}
C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(11759) : warning 219: local variable "H" shadows a variable at a preceding level C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17493) : warning 217: loose indentation C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17493) : error 029: invalid expression, assumed zero C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17493) : warning 215: expression has no effect C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17493) : error 001: expected token: ";", but found "if" C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17503) : warning 209: function "RL_OnPlayerKeyStateChange" should return a value C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17504) : error 010: invalid function or declaration C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17507) : error 010: invalid function or declaration C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17509) : error 010: invalid function or declaration C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17511) : error 010: invalid function or declaration C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17514) : error 021: symbol already defined: "GetPlayerHealth" C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17515) : error 021: symbol already defined: "SetPlayerHealthEx" C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17515) : error 029: invalid expression, assumed zero C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17515) : error 010: invalid function or declaration C:\Users\Grant\Desktop\zGamingRoleplay\gamemodes\Z RP.pwn(17515 -- 17517) : fatal error 107: too many error messages on one line |
if ( PRESSED(KEY_LOOK_BEHIND) )
{
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer.");
else {
if(PlayerToPoint(3.0,playerid,1558.970703125, -1677.9114990234, 1722.1081542969))
{
if(gate1status == 0) {
MoveObject(door1,1558.1387939453, -1677.8883056641, 1722.1081542969,1.50);
MoveObject(door2,1562.7950439453, -1677.8798828125, 1722.1081542969,1.50);
gate1status = 1; }
else if(gate1status == 1) {
MoveObject(door1,1558.970703125, -1677.9114990234, 1722.1081542969,1.50);
MoveObject(door2,1561.9755859375, -1677.8798828125, 1722.1081542969,1.50);
gate1status = 0; }
}
else if(PlayerToPoint(3.0,playerid,1552.7789306641, -1691.4653320313, 1722.1081542969))
{
if(gate2status == 0) {
MoveObject(door3,1549.6147460938, -1691.4772949219, 1722.1081542969,1.50);
MoveObject(door4,1554.2923583984, -1691.4328613281, 1722.1081542969,1.50);
gate2status = 1; }
else if(gate2status == 1) {
MoveObject(door3,1550.4266357422, -1691.5009765625, 1722.1081542969,1.50);
MoveObject(door4,1553.4294433594, -1691.4515380859, 1722.1081542969,1.50);
gate2status = 0; }
}
else if(PlayerToPoint(3.0,playerid,1560.1090087891, -1653.4477539063, 1719.5637207031))
{
if(gate3status == 0) {
MoveObject(door5,1560.1309774200, -1651.7266845703, 1719.5637207031,1.50);
gate3status = 1; }
else if(gate3status == 1) {
MoveObject(door5,1560.1090087891, -1653.4477539063, 1719.5637207031,1.50);
gate3status = 0; }
}
}
return 1;
}