SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 05/12/2008, 09:45 PM   #1
.:*Starstrike*:.
Little Clucker
 
Join Date: Nov 2008
Posts: 9
Reputation: 0
Default Press "enter" to /enter a building.

Hey, WAZZAP.

I want it so i can press "enter" on my keyboard to enter a building, how would i go about doing that?

So i want to change my /enter command to pressing "enter" or "f" on the keyboard.

Help wanted.
.:*Starstrike*:. is offline  
Old 05/12/2008, 09:49 PM   #2
Pawel_Shark
Little Clucker
 
Join Date: Apr 2008
Posts: 39
Reputation: 0
Default Re: Press "enter" to /enter a building.

im using this on my server

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_ENTER)
    {
        if(PlayerToPoint(3.9,playerid,2019.7307,1916.2554,12.3333))
         {
                    SetPlayerPos(playerid, 1441.3934,-5953.5630,151.5722);
                    GameTextForPlayer(playerid, "~b~Aby opuscic arene wpisz ~n~~r~ /wyjdz", 3000, 3);
                    SetPlayerTime(playerid, 22,59);
                    ResetPlayerWeapons(playerid);
                    GivePlayerWeapon(playerid, 16, 10);
                    GivePlayerWeapon(playerid, 46, 1);
                    GivePlayerWeapon(playerid, 4, 10);
                    GivePlayerWeapon(playerid, 16, 10);
                    GivePlayerWeapon(playerid, 26, 900);
                    GivePlayerWeapon(playerid, 31, 900);
                    GivePlayerWeapon(playerid, 34, 500);
                    SetPlayerHealth(playerid, 100);
                    ondm[playerid] = 1;
                    return 1;
          }
//-------------------MORE

//-------------------MORE  
}
    return 0;
}

Just Change the position where it will teleport you froom
its this line

if(PlayerToPoint(3.9,playerid,2019.7307,1916.2554,12.3333))

for the more teleports bit just paste this

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_ENTER)
{
if(PlayerToPoint(3.9,playerid,2019.7307,1916.2554, 12.3333))
{
SetPlayerPos(playerid, 1441.3934,-5953.5630,151.5722);
GameTextForPlayer(playerid, "~b~Aby opuscic arene wpisz ~n~~r~ /wyjdz", 3000, 3);
SetPlayerTime(playerid, 22,59);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 16, 10);
GivePlayerWeapon(playerid, 46, 1);
GivePlayerWeapon(playerid, 4, 10);
GivePlayerWeapon(playerid, 16, 10);
GivePlayerWeapon(playerid, 26, 900);
GivePlayerWeapon(playerid, 31, 900);
GivePlayerWeapon(playerid, 34, 500);
SetPlayerHealth(playerid, 100);
ondm[playerid] = 1;
return 1;
}
if(PlayerToPoint(3.9,playerid,2019.7307,1916.2554, 12.3333))
{
SetPlayerPos(playerid, 1441.3934,-5953.5630,151.5722);
GameTextForPlayer(playerid, "~b~Aby opuscic arene wpisz ~n~~r~ /wyjdz", 3000, 3);
SetPlayerTime(playerid, 22,59);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 16, 10);
GivePlayerWeapon(playerid, 46, 1);
GivePlayerWeapon(playerid, 4, 10);
GivePlayerWeapon(playerid, 16, 10);
GivePlayerWeapon(playerid, 26, 900);
GivePlayerWeapon(playerid, 31, 900);
GivePlayerWeapon(playerid, 34, 500);
SetPlayerHealth(playerid, 100);
ondm[playerid] = 1;
return 1;
}

}
return 0;
}
Pawel_Shark is offline  
Old 05/12/2008, 09:50 PM   #3
.:*Starstrike*:.
Little Clucker
 
Join Date: Nov 2008
Posts: 9
Reputation: 0
Default Re: Press "enter" to /enter a building.

AS i know how to work from GF, how would i change the /enter to pressing enter on the GF gamemode?
.:*Starstrike*:. is offline  
Old 05/12/2008, 09:52 PM   #4
Pawel_Shark
Little Clucker
 
Join Date: Apr 2008
Posts: 39
Reputation: 0
Default Re: Press "enter" to /enter a building.

paste the /enter command here
Pawel_Shark is offline  
Old 05/12/2008, 09:53 PM   #5
yom
Gangsta
 
Join Date: Jul 2006
Posts: 988
Reputation: 6
Default Re: Press "enter" to /enter a building.

http://forum.sa-mp.com/index.php?topic=67900.0
yom is offline  
Old 05/12/2008, 09:54 PM   #6
.:*Starstrike*:.
Little Clucker
 
Join Date: Nov 2008
Posts: 9
Reputation: 0
Default Re: Press "enter" to /enter a building.

Code:
if(strcmp(cmd, "/enter", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
		{
		
		  for (i=0; i<MAX_FAMILY; i++)
		  {
		  if (FamilyInfo[i][FamilyExt][0] != 0.0 && FamilyInfo[i][FamilyInt][0] != 0.0)
		    {
		    if (PlayerToPoint(2, playerid, FamilyInfo[i][FamilyExt][0], FamilyInfo[i][FamilyExt][1], FamilyInfo[i][FamilyExt][2]))
		      {
		      SetPlayerInterior(playerid, FamilyInfo[i][FamilyHQ]);
		      SetPlayerPos(playerid, FamilyInfo[i][FamilyInt][0], FamilyInfo[i][FamilyInt][1], FamilyInfo[i][FamilyInt][2]);
		      SetPlayerFacingAngle(playerid, FamilyInfo[i][FamilyInt][3]);
		      }
		    }
		  }
		
			for(i = 0; i < sizeof(ApartmentInfo); i++)
			{
				if (PlayerToPoint(3, playerid,ApartmentInfo[i][aEntrancex], ApartmentInfo[i][aEntrancey], ApartmentInfo[i][aEntrancez]))
				{
					//printf("Found House :%d",i);
					if(PlayerInfo[playerid][pPapptkey] >= 0 || ApartmentInfo[i][aLock] == 0)
					{
						SetPlayerVirtualWorld(playerid,ApartmentInfo[i][aVirtualWorld]);
						SetPlayerInterior(playerid,ApartmentInfo[i][aInt]);
						SetPlayerPos(playerid,ApartmentInfo[i][aExitx],ApartmentInfo[i][aExity],ApartmentInfo[i][aExitz]);
						GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
						PlayerInfo[playerid][pVirtualWorld] = ApartmentInfo[i][aVirtualWorld];
						PlayerInfo[playerid][pInt] = ApartmentInfo[i][aInt];
						PlayerInfo[playerid][pLocal] = i;
					}
					else
					{
						GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
					}
				}
			}
			for(i = 0; i < sizeof(HouseInfo); i++)
			{
				if (PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
				{
					//printf("Found House :%d",i);
					if(PlayerInfo[playerid][pPhousekey] == i || HouseInfo[i][hLock] == 0)
					{
						SetPlayerInterior(playerid,HouseInfo[i][hInt]);
						SetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
						GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
						PlayerInfo[playerid][pInt] = HouseInfo[i][hInt];
						PlayerInfo[playerid][pLocal] = i;
					}
					else
					{
						GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
					}
				}
			}
			for(i = 0; i < sizeof(BizzInfo); i++)
			{
				if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
				{
					//printf("Found House :%d",i);
					if(!IsACop(playerid) && i == 3)
					{
					  SendClientMessage(playerid, COLOR_GREY, "  Cops only!");
					  return 1;
					}
					if(PlayerInfo[playerid][pPbiskey] == i || GetPlayerMoney(playerid) >= BizzInfo[i][bEntranceCost])
					{
						if(PlayerInfo[playerid][pPbiskey] != i)
						{
							if(BizzInfo[i][bLocked] == 1)
							{
								GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
								return 1;
							}
							if(BizzInfo[i][bProducts] == 0)
							{
								GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
								return 1;
							}
							SafeGivePlayerMoney(playerid,-BizzInfo[i][bEntranceCost]);
							format(string, sizeof(string), "~r~-$%d~n~~w~type /exit~n~to get out", BizzInfo[i][bEntranceCost]);
							BizzInfo[i][bTill] += BizzInfo[i][bEntranceCost];
							ExtortionBiz(i, BizzInfo[i][bEntranceCost]);
							BizzInfo[i][bProducts]--;
							//OnPropUpdate();
							SaveSQLBizz(i+1);
							GameTextForPlayer(playerid, string, 5000, 3);
						}
						SetPlayerInterior(playerid,BizzInfo[i][bInterior]);
						SetPlayerPos(playerid,BizzInfo[i][bExitX],BizzInfo[i][bExitY],BizzInfo[i][bExitZ]);
						PlayerInfo[playerid][pInt] = BizzInfo[i][bInterior];
						PlayerInfo[playerid][pLocal] = i+99;
						new dood[MAX_PLAYER_NAME];
						GetPlayerName(playerid, dood, sizeof(dood));
						format(string, sizeof(string), "%s payed $%d to enter biz %d", dood, BizzInfo[i][bEntranceCost], i);
						printf("%s", string);
						PayLog(string);
						//PlayerInfo[playerid][pLocal] = i;
					}
					else
					{
						GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
					}
				}
			}
			for(i = 0; i < sizeof(SBizzInfo); i++)
			{
				if (PlayerToPoint(3, playerid,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
				{
					if(PlayerInfo[playerid][pPbiskey] == i || GetPlayerMoney(playerid) >= SBizzInfo[i][sbEntranceCost])
					{
						if(PlayerInfo[playerid][pPbiskey] != i)
						{
							if(SBizzInfo[i][sbLocked] == 1)
							{
								GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
								return 1;
							}
							if(SBizzInfo[i][sbProducts] == 0)
							{
								GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
								return 1;
							}
							if(i == 10)
							{
							  PaintballPlayers ++;
							  PlayerPaintballing[playerid] = 1;
							  new rand = random(sizeof(PaintballSpawns));
								SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
								TogglePlayerControllable(playerid, 0);
							}
							else if(i == 11)
							{
							  PlayerKarting[playerid] = 1;
							  SendClientMessage(playerid, TEAM_GROVE_COLOR, "You can now parcipitate in an ATV Race, grab a Kart.");
							}
							else
							{
							  return 1;
							}
							SafeGivePlayerMoney(playerid,-SBizzInfo[i][sbEntranceCost]);
							gSpentCash[playerid] = GetPlayerMoney(playerid);
							SBizzInfo[i][sbProducts]--;
							SBizzInfo[i][sbTill] += SBizzInfo[i][sbEntranceCost];
							ExtortionSBiz(i, SBizzInfo[i][sbEntranceCost]);
							new dood[MAX_PLAYER_NAME];
							GetPlayerName(playerid, dood, sizeof(dood));
							format(string, sizeof(string), "%s payed $%d to enter sbiz %d", dood, SBizzInfo[i][sbEntranceCost], i);
							printf("%s", string);
							PayLog(string);
							//OnPropUpdate();
							SaveSQLSBizz(i+1);
						}
					}
					else
					{
						GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
					}
				}
			}
		}
		return 1;
	}

Quote:
Originally Posted by yom
No one checks them topics, and its only midly GF related.
.:*Starstrike*:. is offline  
Old 05/12/2008, 10:00 PM   #7
Pawel_Shark
Little Clucker
 
Join Date: Apr 2008
Posts: 39
Reputation: 0
Default Re: Press "enter" to /enter a building.

Delete The Command From OnPlayerCommandText

and put it to OnPlayerKeyStateChange

pawn Code:
if(newkeys == KEY_ENTER)
    {
      if(IsPlayerConnected(playerid))
        {
       
          for (i=0; i<MAX_FAMILY; i++)
          {
          if (FamilyInfo[i][FamilyExt][0] != 0.0 && FamilyInfo[i][FamilyInt][0] != 0.0)
            {
            if (PlayerToPoint(2, playerid, FamilyInfo[i][FamilyExt][0], FamilyInfo[i][FamilyExt][1], FamilyInfo[i][FamilyExt][2]))
              {
              SetPlayerInterior(playerid, FamilyInfo[i][FamilyHQ]);
              SetPlayerPos(playerid, FamilyInfo[i][FamilyInt][0], FamilyInfo[i][FamilyInt][1], FamilyInfo[i][FamilyInt][2]);
              SetPlayerFacingAngle(playerid, FamilyInfo[i][FamilyInt][3]);
              }
            }
          }
       
            for(i = 0; i < sizeof(ApartmentInfo); i++)
            {
                if (PlayerToPoint(3, playerid,ApartmentInfo[i][aEntrancex], ApartmentInfo[i][aEntrancey], ApartmentInfo[i][aEntrancez]))
                {
                    //printf("Found House :%d",i);
                    if(PlayerInfo[playerid][pPapptkey] >= 0 || ApartmentInfo[i][aLock] == 0)
                    {
                        SetPlayerVirtualWorld(playerid,ApartmentInfo[i][aVirtualWorld]);
                        SetPlayerInterior(playerid,ApartmentInfo[i][aInt]);
                        SetPlayerPos(playerid,ApartmentInfo[i][aExitx],ApartmentInfo[i][aExity],ApartmentInfo[i][aExitz]);
                        GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
                        PlayerInfo[playerid][pVirtualWorld] = ApartmentInfo[i][aVirtualWorld];
                        PlayerInfo[playerid][pInt] = ApartmentInfo[i][aInt];
                        PlayerInfo[playerid][pLocal] = i;
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                    }
                }
            }
            for(i = 0; i < sizeof(HouseInfo); i++)
            {
                if (PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
                {
                    //printf("Found House :%d",i);
                    if(PlayerInfo[playerid][pPhousekey] == i || HouseInfo[i][hLock] == 0)
                    {
                        SetPlayerInterior(playerid,HouseInfo[i][hInt]);
                        SetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
                        GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
                        PlayerInfo[playerid][pInt] = HouseInfo[i][hInt];
                        PlayerInfo[playerid][pLocal] = i;
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                    }
                }
            }
            for(i = 0; i < sizeof(BizzInfo); i++)
            {
                if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
                {
                    //printf("Found House :%d",i);
                    if(!IsACop(playerid) && i == 3)
                    {
                      SendClientMessage(playerid, COLOR_GREY, " Cops only!");
                      return 1;
                    }
                    if(PlayerInfo[playerid][pPbiskey] == i || GetPlayerMoney(playerid) >= BizzInfo[i][bEntranceCost])
                    {
                        if(PlayerInfo[playerid][pPbiskey] != i)
                        {
                            if(BizzInfo[i][bLocked] == 1)
                            {
                                GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
                                return 1;
                            }
                            if(BizzInfo[i][bProducts] == 0)
                            {
                                GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
                                return 1;
                            }
                            SafeGivePlayerMoney(playerid,-BizzInfo[i][bEntranceCost]);
                            format(string, sizeof(string), "~r~-$%d~n~~w~type /exit~n~to get out", BizzInfo[i][bEntranceCost]);
                            BizzInfo[i][bTill] += BizzInfo[i][bEntranceCost];
                            ExtortionBiz(i, BizzInfo[i][bEntranceCost]);
                            BizzInfo[i][bProducts]--;
                            //OnPropUpdate();
                            SaveSQLBizz(i+1);
                            GameTextForPlayer(playerid, string, 5000, 3);
                        }
                         SetPlayerInterior(playerid,BizzInfo[i][bInterior]);
                        SetPlayerPos(playerid,BizzInfo[i][bExitX],BizzInfo[i][bExitY],BizzInfo[i][bExitZ]);
                        PlayerInfo[playerid][pInt] = BizzInfo[i][bInterior];
                        PlayerInfo[playerid][pLocal] = i+99;
                        new dood[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, dood, sizeof(dood));
                        format(string, sizeof(string), "%s payed $%d to enter biz %d", dood, BizzInfo[i][bEntranceCost], i);
                        printf("%s", string);
                        PayLog(string);
                        //PlayerInfo[playerid][pLocal] = i;
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
                    }
                }
            }
            for(i = 0; i < sizeof(SBizzInfo); i++)
            {
                if (PlayerToPoint(3, playerid,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
                {
                    if(PlayerInfo[playerid][pPbiskey] == i || GetPlayerMoney(playerid) >= SBizzInfo[i][sbEntranceCost])
                    {
                        if(PlayerInfo[playerid][pPbiskey] != i)
                        {
                            if(SBizzInfo[i][sbLocked] == 1)
                            {
                                GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
                                return 1;
                            }
                            if(SBizzInfo[i][sbProducts] == 0)
                            {
                                GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
                                return 1;
                            }
                            if(i == 10)
                            {
                              PaintballPlayers ++;
                              PlayerPaintballing[playerid] = 1;
                              new rand = random(sizeof(PaintballSpawns));
                                SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
                                TogglePlayerControllable(playerid, 0);
                            }
                            else if(i == 11)
                            {
                              PlayerKarting[playerid] = 1;
                              SendClientMessage(playerid, TEAM_GROVE_COLOR, "You can now parcipitate in an ATV Race, grab a Kart.");
                            }
                            else
                            {
                              return 1;
                            }
                            SafeGivePlayerMoney(playerid,-SBizzInfo[i][sbEntranceCost]);
                            gSpentCash[playerid] = GetPlayerMoney(playerid);
                            SBizzInfo[i][sbProducts]--;
                            SBizzInfo[i][sbTill] += SBizzInfo[i][sbEntranceCost];
                            ExtortionSBiz(i, SBizzInfo[i][sbEntranceCost]);
                            new dood[MAX_PLAYER_NAME];
                            GetPlayerName(playerid, dood, sizeof(dood));
                            format(string, sizeof(string), "%s payed $%d to enter sbiz %d", dood, SBizzInfo[i][sbEntranceCost], i);
                            printf("%s", string);
                            PayLog(string);
                            //OnPropUpdate();
                            SaveSQLSBizz(i+1);
                        }
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
                    }
                }
            }
        }
        return 1;
    }

if you don't have this public, just paste this above OnGameMod...

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_ENTER)
{
      if(IsPlayerConnected(playerid))
        {
       
          for (i=0; i<MAX_FAMILY; i++)
          {
          if (FamilyInfo[i][FamilyExt][0] != 0.0 && FamilyInfo[i][FamilyInt][0] != 0.0)
            {
            if (PlayerToPoint(2, playerid, FamilyInfo[i][FamilyExt][0], FamilyInfo[i][FamilyExt][1], FamilyInfo[i][FamilyExt][2]))
              {
              SetPlayerInterior(playerid, FamilyInfo[i][FamilyHQ]);
              SetPlayerPos(playerid, FamilyInfo[i][FamilyInt][0], FamilyInfo[i][FamilyInt][1], FamilyInfo[i][FamilyInt][2]);
              SetPlayerFacingAngle(playerid, FamilyInfo[i][FamilyInt][3]);
              }
            }
          }
       
            for(i = 0; i < sizeof(ApartmentInfo); i++)
            {
                if (PlayerToPoint(3, playerid,ApartmentInfo[i][aEntrancex], ApartmentInfo[i][aEntrancey], ApartmentInfo[i][aEntrancez]))
                {
                    //printf("Found House :%d",i);
                    if(PlayerInfo[playerid][pPapptkey] >= 0 || ApartmentInfo[i][aLock] == 0)
                    {
                        SetPlayerVirtualWorld(playerid,ApartmentInfo[i][aVirtualWorld]);
                        SetPlayerInterior(playerid,ApartmentInfo[i][aInt]);
                        SetPlayerPos(playerid,ApartmentInfo[i][aExitx],ApartmentInfo[i][aExity],ApartmentInfo[i][aExitz]);
                        GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
                        PlayerInfo[playerid][pVirtualWorld] = ApartmentInfo[i][aVirtualWorld];
                        PlayerInfo[playerid][pInt] = ApartmentInfo[i][aInt];
                        PlayerInfo[playerid][pLocal] = i;
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                    }
                }
            }
            for(i = 0; i < sizeof(HouseInfo); i++)
            {
                if (PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
                {
                    //printf("Found House :%d",i);
                    if(PlayerInfo[playerid][pPhousekey] == i || HouseInfo[i][hLock] == 0)
                    {
                        SetPlayerInterior(playerid,HouseInfo[i][hInt]);
                        SetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
                        GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
                        PlayerInfo[playerid][pInt] = HouseInfo[i][hInt];
                        PlayerInfo[playerid][pLocal] = i;
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                    }
                }
            }
            for(i = 0; i < sizeof(BizzInfo); i++)
            {
                if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
                {
                    //printf("Found House :%d",i);
                    if(!IsACop(playerid) && i == 3)
                    {
                      SendClientMessage(playerid, COLOR_GREY, " Cops only!");
                      return 1;
                    }
                    if(PlayerInfo[playerid][pPbiskey] == i || GetPlayerMoney(playerid) >= BizzInfo[i][bEntranceCost])
                    {
                        if(PlayerInfo[playerid][pPbiskey] != i)
                        {
                            if(BizzInfo[i][bLocked] == 1)
                            {
                                GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
                                return 1;
                            }
                            if(BizzInfo[i][bProducts] == 0)
                            {
                                GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
                                return 1;
                            }
                            SafeGivePlayerMoney(playerid,-BizzInfo[i][bEntranceCost]);
                            format(string, sizeof(string), "~r~-$%d~n~~w~type /exit~n~to get out", BizzInfo[i][bEntranceCost]);
                            BizzInfo[i][bTill] += BizzInfo[i][bEntranceCost];
                            ExtortionBiz(i, BizzInfo[i][bEntranceCost]);
                            BizzInfo[i][bProducts]--;
                            //OnPropUpdate();
                            SaveSQLBizz(i+1);
                            GameTextForPlayer(playerid, string, 5000, 3);
                        }
                        SetPlayerInterior(playerid,BizzInfo[i][bInterior]);
                        SetPlayerPos(playerid,BizzInfo[i][bExitX],BizzInfo[i][bExitY],BizzInfo[i][bExitZ]);
                        PlayerInfo[playerid][pInt] = BizzInfo[i][bInterior];
                        PlayerInfo[playerid][pLocal] = i+99;
                        new dood[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, dood, sizeof(dood));
                        format(string, sizeof(string), "%s payed $%d to enter biz %d", dood, BizzInfo[i][bEntranceCost], i);
                        printf("%s", string);
                        PayLog(string);
                        //PlayerInfo[playerid][pLocal] = i;
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
                    }
                }
            }
            for(i = 0; i < sizeof(SBizzInfo); i++)
            {
                if (PlayerToPoint(3, playerid,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
                {
                    if(PlayerInfo[playerid][pPbiskey] == i || GetPlayerMoney(playerid) >= SBizzInfo[i][sbEntranceCost])
                    {
                        if(PlayerInfo[playerid][pPbiskey] != i)
                        {
                            if(SBizzInfo[i][sbLocked] == 1)
                            {
                                GameTextForPlayer(playerid, "~r~Closed", 5000, 1);
                                return 1;
                            }
                            if(SBizzInfo[i][sbProducts] == 0)
                            {
                                GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
                                return 1;
                            }
                            if(i == 10)
                            {
                              PaintballPlayers ++;
                              PlayerPaintballing[playerid] = 1;
                              new rand = random(sizeof(PaintballSpawns));
                                SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
                                TogglePlayerControllable(playerid, 0);
                            }
                            else if(i == 11)
                            {
                              PlayerKarting[playerid] = 1;
                              SendClientMessage(playerid, TEAM_GROVE_COLOR, "You can now parcipitate in an ATV Race, grab a Kart.");
                            }
                            else
                            {
                              return 1;
                            }
                            SafeGivePlayerMoney(playerid,-SBizzInfo[i][sbEntranceCost]);
                            gSpentCash[playerid] = GetPlayerMoney(playerid);
                            SBizzInfo[i][sbProducts]--;
                            SBizzInfo[i][sbTill] += SBizzInfo[i][sbEntranceCost];
                            ExtortionSBiz(i, SBizzInfo[i][sbEntranceCost]);
                            new dood[MAX_PLAYER_NAME];
                            GetPlayerName(playerid, dood, sizeof(dood));
                            format(string, sizeof(string), "%s payed $%d to enter sbiz %d", dood, SBizzInfo[i][sbEntranceCost], i);
                            printf("%s", string);
                            PayLog(string);
                            //OnPropUpdate();
                            SaveSQLSBizz(i+1);
                        }
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
                    }
                }
            }
        }
        return 1;
    }
}
Pawel_Shark is offline  
Old 01/08/2010, 11:47 PM   #8
Unte99
Gangsta
 
Unte99's Avatar
 
Join Date: Jul 2010
Location: Lithuania
Posts: 629
Reputation: 65
Default Re: Press "enter" to /enter a building.

Quote:
Originally Posted by Pawel_Shark View Post
im using this on my server

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_ENTER)
    {
        if(PlayerToPoint(3.9,playerid,2019.7307,1916.2554,12.3333))
         {
                    SetPlayerPos(playerid, 1441.3934,-5953.5630,151.5722);
                    GameTextForPlayer(playerid, "~b~Aby opuscic arene wpisz ~n~~r~ /wyjdz", 3000, 3);
                    SetPlayerTime(playerid, 22,59);
                    ResetPlayerWeapons(playerid);
                    GivePlayerWeapon(playerid, 16, 10);
                    GivePlayerWeapon(playerid, 46, 1);
                    GivePlayerWeapon(playerid, 4, 10);
                    GivePlayerWeapon(playerid, 16, 10);
                    GivePlayerWeapon(playerid, 26, 900);
                    GivePlayerWeapon(playerid, 31, 900);
                    GivePlayerWeapon(playerid, 34, 500);
                    SetPlayerHealth(playerid, 100);
                    ondm[playerid] = 1;
                    return 1;
          }
//-------------------MORE

//-------------------MORE  
}
    return 0;
}

Just Change the position where it will teleport you froom
its this line

if(PlayerToPoint(3.9,playerid,2019.7307,1916.2554,12.3333))

for the more teleports bit just paste this

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_ENTER)
{
if(PlayerToPoint(3.9,playerid,2019.7307,1916.2554, 12.3333))
{
SetPlayerPos(playerid, 1441.3934,-5953.5630,151.5722);
GameTextForPlayer(playerid, "~b~Aby opuscic arene wpisz ~n~~r~ /wyjdz", 3000, 3);
SetPlayerTime(playerid, 22,59);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 16, 10);
GivePlayerWeapon(playerid, 46, 1);
GivePlayerWeapon(playerid, 4, 10);
GivePlayerWeapon(playerid, 16, 10);
GivePlayerWeapon(playerid, 26, 900);
GivePlayerWeapon(playerid, 31, 900);
GivePlayerWeapon(playerid, 34, 500);
SetPlayerHealth(playerid, 100);
ondm[playerid] = 1;
return 1;
}
if(PlayerToPoint(3.9,playerid,2019.7307,1916.2554, 12.3333))
{
SetPlayerPos(playerid, 1441.3934,-5953.5630,151.5722);
GameTextForPlayer(playerid, "~b~Aby opuscic arene wpisz ~n~~r~ /wyjdz", 3000, 3);
SetPlayerTime(playerid, 22,59);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 16, 10);
GivePlayerWeapon(playerid, 46, 1);
GivePlayerWeapon(playerid, 4, 10);
GivePlayerWeapon(playerid, 16, 10);
GivePlayerWeapon(playerid, 26, 900);
GivePlayerWeapon(playerid, 31, 900);
GivePlayerWeapon(playerid, 34, 500);
SetPlayerHealth(playerid, 100);
ondm[playerid] = 1;
return 1;
}

}
return 0;
}


You don't need this part:

Quote:
SetPlayerTime(playerid, 22,59);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 16, 10);
GivePlayerWeapon(playerid, 46, 1);
GivePlayerWeapon(playerid, 4, 10);
GivePlayerWeapon(playerid, 16, 10);
GivePlayerWeapon(playerid, 26, 900);
GivePlayerWeapon(playerid, 31, 900);
GivePlayerWeapon(playerid, 34, 500);
SetPlayerHealth(playerid, 100);
ondm[playerid] = 1;
because it's for the DM servers, if your server is a DM type then use all of it.
Unte99 is offline  
Old 02/08/2010, 02:24 AM   #9
Daren_Jacobson
Huge Clucker
 
Join Date: Jun 2008
Posts: 424
Reputation: 6
Default Re: Press "enter" to /enter a building.

when dealing with keys, use & (bitwise), not == (logical)

if (newkeys & KEY_ENTER)
__________________
Daren_Jacobson is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Game Stop when i press "Escape" FelipekxD Client Support 4 16/06/2010 09:25 PM
how to make like if you press "F" or enter then enters building? hardstop Help Archive 3 28/04/2010 12:18 PM
Issue about /enter & /exit commands at an "i" icon Alice[WS] Help Archive 1 07/08/2009 09:18 PM
"Enter" animation... introzen Help Archive 3 29/03/2009 01:56 PM
My /enter doesn't "return 1;" in all situations... introzen Help Archive 4 29/03/2009 11:39 AM


All times are GMT. The time now is 10:15 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.