Problems with "onplayerkeystateChange"
#1

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 :



PHP код:
new string[256];
    new 
sendername[MAX_PLAYER_NAME];
      
GetPlayerName(playeridsendernamesizeof(sendername));
     for(new 
0sizeofBizzInfo ); i++)
        {
            if(
IsPlayerInRangeOfPointplayerid3BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
             {
                if(
GetPlayerVirtualWorldplayerid ) == 0)
                  {
                      if(
BizzInfo[i][bLocked] == 0)
                     {
                           if(
PlayerInfo[playerid][pCash] >= BizzInfo[i][bEntranceCost])
                          {
                               if(
PlayerInfo[playerid][pMask] == 1)
                            {
                                
format(stringsizeof(string), "Stanger has entered the Business.");
                            }
                            else
                            {
                                
format(stringsizeof(string), "%s has entered the Business."sendername);
                            }
                             
SetPlayerInteriorplayeridBizzInfo[i][bInteriorID]);
                              
SetPlayerPosplayeridBizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]);
                              
PlayerInfo[playerid][InBusiness] = i;
                              
SetPlayerVirtualWorldplayeridBizzInfo[i][bVirWorld]);
                               
PlayerInfo[playerid][pVirtualWorld] = BizzInfo[i][bVirWorld];
                              if(
BizzInfo[i][bType] == 1)
                            {
                                
SendClientMessageplayeridCOLOR_YELLOW"You entered in a 24-7!");
                                
SendClientMessageplayeridCOLOR_WHITE"USAGE: /buy" );
                            }
                            else if(
BizzInfo[i][bType] == 2)
                            {
                                
SendClientMessageplayeridCOLOR_YELLOW"You entered in a Clothes Store!");
                                
SendClientMessageplayeridCOLOR_WHITE"USAGE: /buy" );
                            }
                            else if(
BizzInfo[i][bType] == 3)
                            {
                                
SendClientMessageplayeridCOLOR_YELLOW"You entered in a Club!");
                                
SendClientMessageplayeridCOLOR_WHITE"USAGE: /buy" );
                            }
                            else if(
BizzInfo[i][bType] == 4)
                            {
                                
SendClientMessageplayeridCOLOR_YELLOW"You entered in an Ammunation!");
                                
SendClientMessageplayeridCOLOR_WHITE"USAGE: /buy" );
                            }
                            else if(
BizzInfo[i][bType] == 5)
                            {
                                
SendClientMessageplayeridCOLOR_YELLOW"You entered in a Casino!");
                                
SendClientMessageplayeridCOLOR_WHITE"USAGE: /casinohelp & /buy");
                            }
                            else if(
BizzInfo[i][bType] == 6)
                            {
                                
SendClientMessageplayeridCOLOR_YELLOW"You entered in a Restaurant!");
                                
SendClientMessageplayeridCOLOR_WHITE"USAGE: /buy" );
                            }
                            else if(
BizzInfo[i][bType] == 7)
                            {
                                
GetPlayerArmour(playeridpKevlar[playerid]);
                                
GetPlayerHealth(playeridpHP[playerid]);
                                
SendClientMessage(playeridCOLOR_YELLOW"You entered in a Paintball Arena!");
                                
PlayerPaintballing[playerid] = 1;
                                
PlayerPlaySound(playerid10570.00.00.0);
                                
SendClientMessage(playeridCOLOR_LIGHTRED"You can now buy your weapons!");
                                
SendClientMessage(playeridCOLOR_WHITE"USAGE: /buy");
                            }
                            else if(
BizzInfo[i][bType] == 8)
                            {
                                
SendClientMessage(playeridCOLOR_YELLOW"You entered in a Bank!");
                                
SendClientMessage(playeridCOLOR_WHITE"USAGE: /bankpercent, /wiretransfer, /deposit & /withdraw" );
                            }
                            else if(
BizzInfo[i][bType] == 9)
                            {
                                
SendClientMessage(playeridCOLOR_YELLOW"You entered in an Electronic Store!");
                                
SendClientMessage(playeridCOLOR_WHITE"USAGE: /buy" );
                            }
                               else if(
BizzInfo[i][bType] == 10)
                            {
                                
SendClientMessage(playeridCOLOR_YELLOW"You entered in a Toy Store!");
                                
SendClientMessage(playeridCOLOR_WHITE"USAGE: /buy" );
                            }
                            
ProxDetector(30.0playeridstringCOLOR_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(iBizzInfo[i][bEntranceCost]);
                         }
                          else
                         {
                            
SendClientMessage(playeridCOLOR_GREY"   You don't have enough money to enter!");
                           }
                       }
                    else
                    {
                        
GameTextForPlayer(playerid"~r~Business is Locked!"10005);
                    }
                   }
            }
        }
        for(new 
0sizeof(BizzInfo); i++)
        {
              if(
IsPlayerInRangeOfPointplayerid5.0BizzInfo[PlayerInfo[playerid][InBusiness]][bExitX], BizzInfo[PlayerInfo[playerid][InBusiness]][bExitY], BizzInfo[PlayerInfo[playerid][InBusiness]][bExitZ]))
            {
                if(
GetPlayerVirtualWorldplayerid ) > 0)
                 {
                    if(
PlayerInfo[playerid][InBusiness] != 0)
                      {
                        if(
PlayerInfo[playerid][pMask] == 1)
                        {
                            
format(stringsizeof(string), "* Stanger has left the business.");
                        }
                        else
                        {
                            
format(stringsizeof(string), "* %s has left the business."sendername);
                        }
                        if(
BizzInfo[PlayerInfo[playerid][InBusiness]][bType] == 3)
                        {
                            if(
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_BEER)
                            {
                                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_BEER);
                            }
                            else if(
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_WINE)
                            {
                                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_WINE);
                            }
                            else if(
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_SPRUNK)
                            {
                                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_SPRUNK);
                            }
                            else if(
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_SMOKE_CIGGY)
                            {
                                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_SMOKE_CIGGY);
                            }
                        }
                          else if(
BizzInfo[PlayerInfo[playerid][InBusiness]][bType] == 5)
                        {
                            if(
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_BEER)
                            {
                                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_BEER);
                            }
                            else if(
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_WINE)
                            {
                                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_WINE);
                            }
                            else if(
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_SPRUNK)
                            {
                                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_SPRUNK);
                            }
                            else if(
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_SMOKE_CIGGY)
                            {
                                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_SMOKE_CIGGY);
                            }
                        }
                        else if(
BizzInfo[PlayerInfo[playerid][InBusiness]][bType] == 7)
                        {
                            
ResetPlayerPaintballWeapons(playerid);
                            
PlayerPaintballing[playerid] = 0;
                            
TogglePlayerControllable(playerid1);
                            
SetPlayerWeapons(playerid);
                            
SetPlayerArmour(playeridpKevlar[playerid]);
                            
SetPlayerHealth(playeridpHP[playerid]);
                        }
                        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                         
PlayerInfo[playerid][pVirtualWorld] = 0;
                        
SetPlayerVirtualWorldplayerid0);
                           
SetPlayerInteriorplayeridBizzInfo[PlayerInfo[playerid][InBusiness]][bExteriorID]);
                        
SetPlayerPosplayeridBizzInfo[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(stringsizeof(string), "* Stanger has left the business.");
                    }
                    else
                    {
                        
format(stringsizeof(string), "* %s has left the business."sendername);
                    }
                    
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                     
PlayerInfo[playerid][pVirtualWorld] = 0;
                       
SetPlayerVirtualWorldplayerid);
                       
SetPlayerInteriorplayeridBizzInfo[i][bExteriorID]);
                    
SetPlayerPosplayeridBizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]);
                 }
            }
        } 
I Hope you help cause i really need it - Giving Rep for the one who helps
Reply
#2

Try using the /enter cmd... except of ENTER...
Reply
#3

Agh..What you mean Exactly ?
Reply
#4

Try using the /enter cmd aside of keystatechange to enter a bizz/house not a key
Reply
#5

Dude..I Just want to know what's wrong in that Code and how to fix it..
Reply
#6

Guyss..Any help please.. It's Urgent -Sorry for BUMP-
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)