07.11.2011, 19:40
Well..I Made a Biz system that when you Want to enter a Biz you should press "Enter" , Anyway everything is worknig fine except that when you come near the biz and press ANY key such as C / CTRL / SPACE / ENTER / LMB etc. it enters and exit AT THE SAME TIme - so if you out you keep entering / exiting - entering / exiting without controlling it - i will try to upload a video - Anyway - Here is some of the Code :
I Hope you help cause i really need it - Giving Rep for the one who helps
PHP код:
new string[256];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
for(new i = 0; i < sizeof( BizzInfo ); i++)
{
if(IsPlayerInRangeOfPoint( playerid, 3, BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
{
if(GetPlayerVirtualWorld( playerid ) == 0)
{
if(BizzInfo[i][bLocked] == 0)
{
if(PlayerInfo[playerid][pCash] >= BizzInfo[i][bEntranceCost])
{
if(PlayerInfo[playerid][pMask] == 1)
{
format(string, sizeof(string), "Stanger has entered the Business.");
}
else
{
format(string, sizeof(string), "%s has entered the Business.", sendername);
}
SetPlayerInterior( playerid, BizzInfo[i][bInteriorID]);
SetPlayerPos( playerid, BizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]);
PlayerInfo[playerid][InBusiness] = i;
SetPlayerVirtualWorld( playerid, BizzInfo[i][bVirWorld]);
PlayerInfo[playerid][pVirtualWorld] = BizzInfo[i][bVirWorld];
if(BizzInfo[i][bType] == 1)
{
SendClientMessage( playerid, COLOR_YELLOW, "You entered in a 24-7!");
SendClientMessage( playerid, COLOR_WHITE, "USAGE: /buy" );
}
else if(BizzInfo[i][bType] == 2)
{
SendClientMessage( playerid, COLOR_YELLOW, "You entered in a Clothes Store!");
SendClientMessage( playerid, COLOR_WHITE, "USAGE: /buy" );
}
else if(BizzInfo[i][bType] == 3)
{
SendClientMessage( playerid, COLOR_YELLOW, "You entered in a Club!");
SendClientMessage( playerid, COLOR_WHITE, "USAGE: /buy" );
}
else if(BizzInfo[i][bType] == 4)
{
SendClientMessage( playerid, COLOR_YELLOW, "You entered in an Ammunation!");
SendClientMessage( playerid, COLOR_WHITE, "USAGE: /buy" );
}
else if(BizzInfo[i][bType] == 5)
{
SendClientMessage( playerid, COLOR_YELLOW, "You entered in a Casino!");
SendClientMessage( playerid, COLOR_WHITE, "USAGE: /casinohelp & /buy");
}
else if(BizzInfo[i][bType] == 6)
{
SendClientMessage( playerid, COLOR_YELLOW, "You entered in a Restaurant!");
SendClientMessage( playerid, COLOR_WHITE, "USAGE: /buy" );
}
else if(BizzInfo[i][bType] == 7)
{
GetPlayerArmour(playerid, pKevlar[playerid]);
GetPlayerHealth(playerid, pHP[playerid]);
SendClientMessage(playerid, COLOR_YELLOW, "You entered in a Paintball Arena!");
PlayerPaintballing[playerid] = 1;
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_LIGHTRED, "You can now buy your weapons!");
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buy");
}
else if(BizzInfo[i][bType] == 8)
{
SendClientMessage(playerid, COLOR_YELLOW, "You entered in a Bank!");
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bankpercent, /wiretransfer, /deposit & /withdraw" );
}
else if(BizzInfo[i][bType] == 9)
{
SendClientMessage(playerid, COLOR_YELLOW, "You entered in an Electronic Store!");
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buy" );
}
else if(BizzInfo[i][bType] == 10)
{
SendClientMessage(playerid, COLOR_YELLOW, "You entered in a Toy Store!");
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buy" );
}
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
BizzInfo[i][bTill] += BizzInfo[i][bEntranceCost];
GivePlayerMoney(playerid, -BizzInfo[i][bEntranceCost]);
PlayerInfo[playerid][pCash] -= BizzInfo[i][bEntranceCost];
ExtortionBiz(i, BizzInfo[i][bEntranceCost]);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough money to enter!");
}
}
else
{
GameTextForPlayer(playerid, "~r~Business is Locked!", 1000, 5);
}
}
}
}
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if(IsPlayerInRangeOfPoint( playerid, 5.0, BizzInfo[PlayerInfo[playerid][InBusiness]][bExitX], BizzInfo[PlayerInfo[playerid][InBusiness]][bExitY], BizzInfo[PlayerInfo[playerid][InBusiness]][bExitZ]))
{
if(GetPlayerVirtualWorld( playerid ) > 0)
{
if(PlayerInfo[playerid][InBusiness] != 0)
{
if(PlayerInfo[playerid][pMask] == 1)
{
format(string, sizeof(string), "* Stanger has left the business.");
}
else
{
format(string, sizeof(string), "* %s has left the business.", sendername);
}
if(BizzInfo[PlayerInfo[playerid][InBusiness]][bType] == 3)
{
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_BEER)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
}
else if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_WINE)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
}
else if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_SPRUNK)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
}
else if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_SMOKE_CIGGY)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
}
else if(BizzInfo[PlayerInfo[playerid][InBusiness]][bType] == 5)
{
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_BEER)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
}
else if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_WINE)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
}
else if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_SPRUNK)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
}
else if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_SMOKE_CIGGY)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
}
else if(BizzInfo[PlayerInfo[playerid][InBusiness]][bType] == 7)
{
ResetPlayerPaintballWeapons(playerid);
PlayerPaintballing[playerid] = 0;
TogglePlayerControllable(playerid, 1);
SetPlayerWeapons(playerid);
SetPlayerArmour(playerid, pKevlar[playerid]);
SetPlayerHealth(playerid, pHP[playerid]);
}
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[playerid][pVirtualWorld] = 0;
SetPlayerVirtualWorld( playerid, 0);
SetPlayerInterior( playerid, BizzInfo[PlayerInfo[playerid][InBusiness]][bExteriorID]);
SetPlayerPos( playerid, BizzInfo[PlayerInfo[playerid][InBusiness]][bEntranceX], BizzInfo[PlayerInfo[playerid][InBusiness]][bEntranceY], BizzInfo[PlayerInfo[playerid][InBusiness]][bEntranceZ]);
PlayerInfo[playerid][InBusiness] = 0;
}
}
else
{
if(PlayerInfo[playerid][pMask] == 1)
{
format(string, sizeof(string), "* Stanger has left the business.");
}
else
{
format(string, sizeof(string), "* %s has left the business.", sendername);
}
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[playerid][pVirtualWorld] = 0;
SetPlayerVirtualWorld( playerid, 0 );
SetPlayerInterior( playerid, BizzInfo[i][bExteriorID]);
SetPlayerPos( playerid, BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]);
}
}
}