public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if( newkeys == KEY_SECONDARY_ATTACK ) //PDSPAWNULAZ { 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; } } // if( newkeys == KEY_SECONDARY_ATTACK ) //PDSPAWNIZLAZ { 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; } } // if( newkeys == KEY_SECONDARY_ATTACK ) //BARSPAWNULAZ { 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; } } if( newkeys == KEY_SECONDARY_ATTACK ) //BARSPAWNIZLAZ { 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; }
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if( newkeys == KEY_SECONDARY_ATTACK ) //PDSPAWNULAZ
{
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;
}
}
//
if( newkeys == KEY_SECONDARY_ATTACK ) //PDSPAWNIZLAZ
{
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;
}
}
//
if( newkeys == KEY_SECONDARY_ATTACK ) //BARSPAWNULAZ
{
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;
}
}
if( newkeys == KEY_SECONDARY_ATTACK ) //BARSPAWNIZLAZ
{
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;
}
#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;
}
First of all why are you repeating the same if-statement over and over?
Try using this. pawn Код:
|