13.12.2012, 11:42
Hi, I made what is we can enter any biz on pressing a key, it worked perfectly but as i made it available to exit the biz.And when i use it i exit the biz but in a sec it automatically gets me in the biz again.Couldnt fix it i have all the codes below
Help will be appreciated!
Код:
if ((oldkeys & KEY_SECONDARY_ATTACK) && !(newkeys & KEY_SECONDARY_ATTACK)) { for(new idx=1; idx<MAX_BIZ; idx++) { if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ])) { new string[128], text, i; if(!BizInfo[idx][bStatus] && PlayerInfo[playerid][pBiz] != idx && !PlayerInfo[playerid][pVBiz]) return SendClientMessage(playerid, COLOR_GREY, "This business is closed."); if(BizInfo[idx][bType] == 1) // 24/7 Business { format(string, sizeof(string), "** %s pushes the door and enters the business.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SetPlayerPos(playerid, -27.3025,-57.6649,1003.5469); SetPlayerFacingAngle(playerid, 357.5915); SetCameraBehindPlayer(playerid); SetPlayerInterior(playerid, 6); SetPlayerVirtualWorld(playerid, idx+100); format(string, sizeof(string), "** Welcome to %s's 24/7 Market.(( /list /buy )). **", text); SendClientMessage(i, COLOR_GREEN, string); return 1; } else if(BizInfo[idx][bType] == 2) // Clothes Shop Business { format(string, sizeof(string), "** %s pushes the door and enters the business.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SetPlayerPos(playerid, 207.0638,-139.9965,1003.5078); SetPlayerFacingAngle(playerid, 356.3849); SetCameraBehindPlayer(playerid); SetPlayerInterior(playerid, 3); SetPlayerVirtualWorld(playerid, idx+100); format(string, sizeof(string), "** Welcome to %s's Clothing Store.(( /list /buy )). **", text); SendClientMessage(playerid, COLOR_GREEN, string); return 1; } else if(BizInfo[idx][bType] == 3) // Ammunation Business { format(string, sizeof(string), "** %s pushes the door and enters the business.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SetPlayerPos(playerid, 285.8044,-85.9956,1001.5229); SetPlayerFacingAngle(playerid, 358.9898); SetCameraBehindPlayer(playerid); SetPlayerInterior(playerid, 4); SetPlayerVirtualWorld(playerid, idx+100); format(string, sizeof(string), "** Welcome to %s's Ammunation.(( /list /buy )). **", text); SendClientMessage(playerid, COLOR_GREEN, string); return 1; } else if(BizInfo[idx][bType] == 4) // Club Business { format(string, sizeof(string), "** %s pushes the door and enters the business.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SetPlayerPos(playerid, 493.4252,-24.3061,1000.6797); SetPlayerFacingAngle(playerid, 0.2432); SetCameraBehindPlayer(playerid); SetPlayerInterior(playerid, 17); SetPlayerVirtualWorld(playerid, idx+100); format(string, sizeof(string), "** Welcome to %s's Club.(( /list /buy )). **", text); SendClientMessage(playerid, COLOR_GREEN, string); return 1; } else if(BizInfo[idx][bType] == 5) // Advertisement Agency { format(string, sizeof(string), "** %s pushes the door and enters the business.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SetPlayerPos(playerid, 834.1631,7.4883,1004.1797); SetPlayerFacingAngle(playerid, 86.7239); SetCameraBehindPlayer(playerid); SetPlayerInterior(playerid, 3); SetPlayerVirtualWorld(playerid, idx+100); format(string, sizeof(string), "** Welcome to %s's Advertisment Agency.(( /list /buy )). **", text); SendClientMessage(playerid, COLOR_GREEN, string); return 1; } else if(BizInfo[idx][bType] == 6) // Fast Food { format(string, sizeof(string), "** %s pushes the door and enters the business.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SetPlayerPos(playerid, 372.3830,-133.2579,1001.4922); SetPlayerFacingAngle(playerid, 0.4216); SetCameraBehindPlayer(playerid); SetPlayerInterior(playerid, 5); SetPlayerVirtualWorld(playerid, idx+100); format(string, sizeof(string), "** Welcome to %s's Fast Food.(( /list /buy )). **", text); SendClientMessage(playerid, COLOR_GREEN, string); return 1; } } } } if(IsPlayerInRangeOfPoint(playerid, 2, -27.3025,-57.6649,1003.5469) || IsPlayerInRangeOfPoint(playerid, 2, 207.0638,-139.9965,1003.5078) || IsPlayerInRangeOfPoint(playerid, 2, 285.8044,-85.9956,1001.5229) || IsPlayerInRangeOfPoint(playerid, 2, 493.4252,-24.3061,1000.6797) || IsPlayerInRangeOfPoint(playerid, 2, 834.1631,7.4883,1004.1797) || IsPlayerInRangeOfPoint(playerid, 2, 372.3830,-133.2579,1001.4922)) // 24/7 || Clothes Shop || Ammunation || Club || Advertisement Agency || FastFood { new idx, done, string[128]; idx = GetPlayerVirtualWorld(playerid)-100; if(!done && idx < MAX_BIZ && BizInfo[idx][bType]) { format(string, sizeof(string), "** %s pushes the door and exits the business.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SetPlayerPos(playerid, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); } done = 1; }