Help me with enter/exit
#3

First of all why are you repeating the same if-statement over and over?

Try using this.
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_SECONDARY_ATTACK))
    {
        if( IsPlayerInRangeOfPoint( playerid, 2.0, 627.2234, -571.8664, 17.9145 ) )
        {
            SetPlayerPos( playerid, 2415.6736,-1695.3650,1016.0280 );
            SetPlayerInterior( playerid, 0 );
            SetTimerEx("ucitavanjeobjekatatd", 50, false, "i", playerid);
            new string[128];
            format(string, sizeof(string), "* %s otvara vrata i ulazi u prostoriju.", GetName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

            return 1;
        }
        else if( IsPlayerInRangeOfPoint( playerid, 2.0, 2415.6736, -1695.3650, 1016.0280 ) ) {
            if(PlayerInfo[playerid][pRuzeostvari] == 0) return
            SendClientMessage(playerid, COLOR_RED, ""COL_BLUE"[POLICAJAC]: "COL_WHITE"Gospodine, ne mozete izaci jer niste uzeli svoje stvari!"), SendClientMessage(playerid, COLOR_RED, ""COL_CYAN"*"COL_GREY"Otidite kod zatvorskih celija i tamo uzmite svoje stvari. /ruzmistvari.");

            SetPlayerPos( playerid, 627.2234,-571.8664,17.9145 );
            SetPlayerInterior( playerid, 0 );
            SetTimerEx("ucitavanjeobjekatatd", 50, false, "i", playerid);
            new string[128];
            format(string, sizeof(string), "* %s otvara vrata i izlazi iz prostorije.", GetName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            return 1;
        }
       else  if( IsPlayerInRangeOfPoint( playerid, 2.0, 681.4557, -473.9840, 16.5363 ) )
        {
            SetPlayerPos( playerid, -456.5717,-278.0141,4021.8850 );
            SetPlayerInterior( playerid, 0 );
            SetTimerEx("ucitavanjeobjekatatd", 50, false, "i", playerid);

            new string[128];
            format(string, sizeof(string), "* %s otvara vrata i ulazi u prostoriju.", GetName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

            return 1;
        }
        else if( IsPlayerInRangeOfPoint( playerid, 2.0, -456.5717, -278.0141, 4021.8850 ) )
        {
            SetPlayerPos( playerid, 681.4557,-473.9840,16.5363 );
            SetPlayerInterior( playerid, 0 );
            SetTimerEx("ucitavanjeobjekatatd", 50, false, "i", playerid);
            new string[128];
            format(string, sizeof(string), "* %s otvara vrata i izlazi iz prostorije.", GetName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            return 1;
        }
    }

    return 1;
}
Reply


Messages In This Thread
Help me with enter/exit - by TiXz0r - 05.12.2014, 21:22
Re: Help me with enter/exit - by CoaPsyFactor - 05.12.2014, 21:51
Re: Help me with enter/exit - by DaniceMcHarley - 05.12.2014, 22:02
Re: Help me with enter/exit - by TiXz0r - 05.12.2014, 22:14

Forum Jump:


Users browsing this thread: 1 Guest(s)