SA-MP Forums Archive
changes enter/exit - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: changes enter/exit (/showthread.php?tid=177109)



changes enter/exit - FrankC - 16.09.2010

I think this is my enter/exit code

Код:
if(IsKeyJustDown(KEY_CROUCH, newkeys, oldkeys) )
	{
	    if( Player[playerid][PrisonDuration] >= 1 )
	    {
	        SendClientMessage( playerid, WHITE, "This feature isn't available whilst you're prisoned / jailed." );
	    }
	    else
	    {
			if(IsPlayerInRangeOfPoint( playerid, 3, BankIntX, BankIntY, BankIntZ) )
			{
			    SetPlayerInterior( playerid, 0 );
			    TextDrawHideForPlayer( playerid, ExitTextdraw);
			    SetPlayerPos( playerid, BankExtX, BankExtY, BankExtZ);
			}
its current set to when i press on C i go in and C again i go out, i want it to be
/enter = enter /exit = exit
can i change it in this code?


Re: changes enter/exit - FrankC - 16.09.2010

What about this code to enter

Код:
if(strcmp(cmd, "/enter", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			for(new 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]);
						SetPlayerVirtualWorld(playerid,HouseInfo[i][hWorld]);
						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;
						HouseEntered[playerid] = i;
					}
					else
					{
						GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
					}
				}
			}
And this for exit

Код:
if(strcmp(cmd, "/exit", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			for(new i = 0; i <  sizeof(HouseInfo); i++)
			{
				//printf("House :%d",i);
				if (PlayerToPoint(3, playerid,HouseInfo[i][hExitx], HouseInfo[i][hExity], HouseInfo[i][hExitz]))
				{
				    if(HouseEntered[playerid] == i)
				    {
						SetPlayerInterior(playerid,0);
						SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
						PlayerInfo[playerid][pInt] = 0;
						PlayerInfo[playerid][pLocal] = 255;
						SetCameraBehindPlayer(playerid);
						SetPlayerVirtualWorld(playerid,0);
						HouseEntered[playerid] = 255;
						if(HouseInfo[i][hHel] == 1)
						{
							new Float:tempheal;
							GetPlayerHealth(playerid,tempheal);
							if(tempheal < 100.0)
							{
								SetPlayerHealth(playerid,100.0);
							}
						}
						return 1;
					}
				}
			}
But i cant just replace them with the KEY_CROUCH code can i?
and does this "if(strcmp(cmd, "/exit", true) == 0)" Make the command ore do i have to add the command
some where else?


Re: changes enter/exit - FrankC - 16.09.2010

Can anybody help me?