Another problem with KEY_SECONDARY_ATTACK
#1

I'm experiencing a problem with the KEY_SECONDARY_ATTACK. When I press ENTER, it should open the door, nothing happens. Why? Here is the code
Sorry my bad english i'm Italian.
pawn Код:
else if(newkeys == KEY_SECONDARY_ATTACK)//NON FUNZIONA!!!
    {
     new Float:cx, Float:cy, Float:cz;
        GetPlayerPos(playerid, cx, cy, cz);
    if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3)
    {
        if (PlayerToPointStripped(5, playerid,245.0578,72.4314,1002.5406,cx,cy,cz))
        {
            if (portacentrale == 1)
            {
            portacentrale = 0;
            MoveDynamicObject(lspddoor1, 244.0578,72.4314,1002.5406, 3.5000);
            MoveDynamicObject(lspddoor2, 247.1478,72.4314,1002.5406, 3.5000);
            SendClientMessage(playerid, COLOR_BLUE,"La porta и aperta, chiudila per favore!");
            format(string, sizeof(string), "* %s apre la porta della centrale.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else
            {
            MoveDynamicObject(lspddoor1, 245.0578,72.4314,1002.5406, 3.5000);
            MoveDynamicObject(lspddoor2, 245.9478,72.4314,1002.5406, 3.5000);
            SendClientMessage(playerid, COLOR_BLUE,"Porta della centrale chiusa!");
            format(string, sizeof(string), "* %s chiude la porta della centrale.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            portacentrale = 1;
           
   }
  }
  }
 }
Reply
#2

You didnt return eny value of the KEY try this


pawn Код:
else if(newkeys == KEY_SECONDARY_ATTACK)//NON FUNZIONA!!!
{
     new Float:cx, Float:cy, Float:cz;
      GetPlayerPos(playerid, cx, cy, cz);
    if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3)
    {
        if (PlayerToPointStripped(5, playerid,245.0578,72.4314,1002.5406,cx,cy,cz))
        {
            if (portacentrale == 1)
            {
            portacentrale = 0;
            MoveDynamicObject(lspddoor1, 244.0578,72.4314,1002.5406, 3.5000);
            MoveDynamicObject(lspddoor2, 247.1478,72.4314,1002.5406, 3.5000);
            SendClientMessage(playerid, COLOR_BLUE,"La porta и aperta, chiudila per favore!");
            format(string, sizeof(string), "* %s apre la porta della centrale.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string,      COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
           }
           else
           {
            MoveDynamicObject(lspddoor1, 245.0578,72.4314,1002.5406, 3.5000);
            MoveDynamicObject(lspddoor2, 245.9478,72.4314,1002.5406, 3.5000);
            SendClientMessage(playerid, COLOR_BLUE,"Porta della centrale chiusa!");
            format(string, sizeof(string), "* %s chiude la porta della centrale.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string,                                                     COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            portacentrale = 1;
            }
}  
return 1;
Reply
#3

Quote:
Originally Posted by Maime
Посмотреть сообщение
You didnt return eny value of the KEY try this


pawn Код:
else if(newkeys == KEY_SECONDARY_ATTACK)//NON FUNZIONA!!!
{
     new Float:cx, Float:cy, Float:cz;
      GetPlayerPos(playerid, cx, cy, cz);
    if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3)
    {
        if (PlayerToPointStripped(5, playerid,245.0578,72.4314,1002.5406,cx,cy,cz))
        {
            if (portacentrale == 1)
            {
            portacentrale = 0;
            MoveDynamicObject(lspddoor1, 244.0578,72.4314,1002.5406, 3.5000);
            MoveDynamicObject(lspddoor2, 247.1478,72.4314,1002.5406, 3.5000);
            SendClientMessage(playerid, COLOR_BLUE,"La porta и aperta, chiudila per favore!");
            format(string, sizeof(string), "* %s apre la porta della centrale.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string,      COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
           }
           else
           {
            MoveDynamicObject(lspddoor1, 245.0578,72.4314,1002.5406, 3.5000);
            MoveDynamicObject(lspddoor2, 245.9478,72.4314,1002.5406, 3.5000);
            SendClientMessage(playerid, COLOR_BLUE,"Porta della centrale chiusa!");
            format(string, sizeof(string), "* %s chiude la porta della centrale.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string,                                                     COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            portacentrale = 1;
            }
}  
return 1;
It should be:
pawn Код:
else if(newkeys == KEY_SECONDARY_ATTACK)//NON FUNZIONA!!!
    {
     new Float:cx, Float:cy, Float:cz;
        GetPlayerPos(playerid, cx, cy, cz);
    if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3)
    {
        if (PlayerToPointStripped(5, playerid,245.0578,72.4314,1002.5406,cx,cy,cz))
        {
            if (portacentrale == 1)
            {
            portacentrale = 0;
            MoveDynamicObject(lspddoor1, 244.0578,72.4314,1002.5406, 3.5000);
            MoveDynamicObject(lspddoor2, 247.1478,72.4314,1002.5406, 3.5000);
            SendClientMessage(playerid, COLOR_BLUE,"La porta и aperta, chiudila per favore!");
            format(string, sizeof(string), "* %s apre la porta della centrale.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else
            {
            MoveDynamicObject(lspddoor1, 245.0578,72.4314,1002.5406, 3.5000);
            MoveDynamicObject(lspddoor2, 245.9478,72.4314,1002.5406, 3.5000);
            SendClientMessage(playerid, COLOR_BLUE,"Porta della centrale chiusa!");
            format(string, sizeof(string), "* %s chiude la porta della centrale.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            portacentrale = 1;
            }
   }
  }
  return 1;
  }
but does not work the same.
Reply
#4

Код:
    if ((newkeys & KEY_SECONDARY_ATTACK)//NON FUNZIONA!!!
    {
  		new Float:cx, Float:cy, Float:cz;
        GetPlayerPos(playerid, cx, cy, cz);
	    if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3)
	    {
	        if (PlayerToPointStripped(5, playerid,245.0578,72.4314,1002.5406,cx,cy,cz))
	        {
	            if (portacentrale == 1)
	            {
		            portacentrale = 0;
		            MoveDynamicObject(lspddoor1, 244.0578,72.4314,1002.5406, 3.5000);
		            MoveDynamicObject(lspddoor2, 247.1478,72.4314,1002.5406, 3.5000);
		            SendClientMessage(playerid, COLOR_BLUE,"La porta и aperta, chiudila per favore!");
		            format(string, sizeof(string), "* %s apre la porta della centrale.", PlayerName(playerid));
		            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	            }
	            else
	            {
		            MoveDynamicObject(lspddoor1, 245.0578,72.4314,1002.5406, 3.5000);
		            MoveDynamicObject(lspddoor2, 245.9478,72.4314,1002.5406, 3.5000);
		            SendClientMessage(playerid, COLOR_BLUE,"Porta della centrale chiusa!");
		            format(string, sizeof(string), "* %s chiude la porta della centrale.", PlayerName(playerid));
		            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		            portacentrale = 1;
				}
			}
		}
	}
Reply
#5

Quote:
Originally Posted by Scarface~
Посмотреть сообщение
Код:
    if ((newkeys & KEY_SECONDARY_ATTACK)//NON FUNZIONA!!!
    {
  		new Float:cx, Float:cy, Float:cz;
        GetPlayerPos(playerid, cx, cy, cz);
	    if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3)
	    {
	        if (PlayerToPointStripped(5, playerid,245.0578,72.4314,1002.5406,cx,cy,cz))
	        {
	            if (portacentrale == 1)
	            {
		            portacentrale = 0;
		            MoveDynamicObject(lspddoor1, 244.0578,72.4314,1002.5406, 3.5000);
		            MoveDynamicObject(lspddoor2, 247.1478,72.4314,1002.5406, 3.5000);
		            SendClientMessage(playerid, COLOR_BLUE,"La porta и aperta, chiudila per favore!");
		            format(string, sizeof(string), "* %s apre la porta della centrale.", PlayerName(playerid));
		            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	            }
	            else
	            {
		            MoveDynamicObject(lspddoor1, 245.0578,72.4314,1002.5406, 3.5000);
		            MoveDynamicObject(lspddoor2, 245.9478,72.4314,1002.5406, 3.5000);
		            SendClientMessage(playerid, COLOR_BLUE,"Porta della centrale chiusa!");
		            format(string, sizeof(string), "* %s chiude la porta della centrale.", PlayerName(playerid));
		            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		            portacentrale = 1;
				}
			}
		}
	}
invalid expression, assumed zero
Reply
#6

Quote:
Originally Posted by alanhutch
Посмотреть сообщение
invalid expression, assumed zero
Remove some of those } down there and move it to the side
Reply
#7

RESOLVED! I replaced the KEY_SECONDARY_ATTACK with KEY_JUMP! IT WORKED! Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)