SA-MP Forums Archive
stock IsPlayerInBusiness ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: stock IsPlayerInBusiness ? (/showthread.php?tid=649392)



stock IsPlayerInBusiness ? - Osamakurdi - 08.02.2018

Anyone give me stock that check is player in any buisness ?


Re: stock IsPlayerInBusiness ? - jasperschellekens - 08.02.2018

Uhm?
Do you realize that every business system in different? Show your code and i can help you create a isplayerinbusiness


Re: stock IsPlayerInBusiness ? - PepsiCola23 - 08.02.2018

PHP код:
IsPlayerInRangeOfPoint 
and use the coordinates of the biz [ your biz info,i dont know how you have it ,maybe bizposX,bizposY,bizposZ for example,but it depends


Re: stock IsPlayerInBusiness ? - solstice_ - 08.02.2018

Quote:
Originally Posted by PepsiCola23
Посмотреть сообщение
PHP код:
IsPlayerInRangeOfPoint 
and use the coordinates of the biz [ your biz info,i dont know how you have it ,maybe bizposX,bizposY,bizposZ for example,but it depends
But how? This is only going to check the coordinates of a business, not many businesses.


Re: stock IsPlayerInBusiness ? - Abagail - 08.02.2018

The best way for accurate detection is a variable set when entering a business. Once they leave it, reset the var (account for other things such as admin teleports as well).

For more accuracy, you could also check something such as the players virtual world (you could also check position but it's redundant in most cases), if its a mismatch, reset the var. If you do this, call IsPlayerInBusiness directly. You can do the same with a "GetPlayersCurrentBusiness" function as well. This assumes the player can only be in a single business at one time.

Ex:
PHP код:
IsPlayerInBusiness(playerid)
{
       if(
PlayerData[playerid][pd_CurrentBusiness]))
       {
             if(
GetPlayerVirtualWorld(playerid) == BisInfo[PlayerData[playerid][pd_CurrentBusiness]][bbInsideWorld])
                 return 
true;
           
             else
                  
PlayerData[playerid][pd_CurrentBusiness] = INVALID_BUSINESS_ID;
       }
       return 
false;