PDA

View Full Version : Changing from /enter to ENTER_KEY


MusicBeast
11/10/2011, 11:57 AM
Hello, I always try to change the /enter command to a key response one, but I always fail.. So I came here so you help me guys.

Here is my /enter command that I want to change it to a key (( F and Enter ))

if(strcmp(cmd, "/enter", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new house[64];
for(new h = 0; h <= MAX_HOUSES; h++)
{
format(house, sizeof(house), "/Houses/%d.dini.save", h);
if(dini_Exists(house))
{
if(PlayerToPoint(PTP_RADIUS, playerid, HouseInfo[h][hExitX], HouseInfo[h][hExitY], HouseInfo[h][hExitZ]))
{
new Level = HouseInfo[h][hLevel];
if(HouseInfo[h][hLocked] == 1 && strcmp(HouseInfo[h][hName],GetName(playerid), false ) != 0) return SendClientMessage(playerid, COLOR_WHITE, ".:: [HOUSE]: This house has been locked by the owner.");
SetPlayerPos(playerid, HousesCoords[Level][0], HousesCoords[Level][1], HousesCoords[Level][2]);
SetPlayerInterior(playerid, HousesLevels[Level][0]); SetPlayerVirtualWorld(playerid, HouseInfo[h][hVirtualWorld]);
HouseEntered[playerid] = h;
}
}
}
for(new b = 0; b < sizeof(BizzInfo); b++)
{
if (PlayerToPoint(3, playerid,BizzInfo[b][bEntranceX], BizzInfo[b][bEntranceY], BizzInfo[b][bEntranceZ]))
{
if(BizzInfo[b][bEnterable] == 1)
{
if(BizzInfo[b][bLocked] == 0)
{
SetPlayerInterior(playerid,BizzInfo[b][bInt]);
if(b != 50)
{
SetPlayerVirtualWorld(playerid,b);
}
SetPlayerPos(playerid,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]);
BizEntered[playerid] = b;
return 1;
}
else
{
GameTextForPlayer(playerid,"~r~Locked",5000,1);
}
}
}
}
if (PlayerToPoint(4, playerid,966.9037,2160.651,10.82031))//droge plac entrance //2649.4436,784.3689,5.3158
{
SetPlayerInterior(playerid,1);
SetPlayerPos(playerid,964.7471,2160.203,1011.03);
}
if(PlayerToPoint(4,playerid,2227.6162,-1150.2566,1025.7969))
{
if(PlayerInfo[playerid][pMember] == 10)
{
SetPlayerPos(playerid,1064.6483,2140.0764,10.8203) ;
SetPlayerInterior(playerid,0);
}
else
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You are not allowed :.");
}
}
if(PlayerToPoint(4,playerid,196.1802,168.8133,1003 .0234))
{
if(PlayerInfo[playerid][pMember] == 1)
{
SetPlayerPos(playerid,316.3222,-169.7300,999.6010);
SetPlayerInterior(playerid,6);
}
else
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You are not allowed :.");
}
}
if (PlayerToPoint(4, playerid,2577.3669,1322.8284,10.8203))//lv bank entrance
{
SetPlayerInterior(playerid,0);
InteriorX[playerid] = 0;
SetPlayerPos(playerid,2305.573,-15.9378,26.74957);
}
if(PlayerToPoint(4,playerid,-180.1255,1133.1234,19.7422)) // Fc bank entrance
{
SetPlayerInterior(playerid,0);
InteriorX[playerid] = 4;
SetPlayerPos(playerid,2305.573,-15.9378,26.74957);
SetPlayerVirtualWorld(playerid,1);
}
if (PlayerToPoint(4, playerid,2412.8152,1123.8865,10.8203))//city hall entrance INT 1
{
SetPlayerInterior(playerid,3);
SetPlayerVirtualWorld(playerid,2);
InteriorX[playerid] = 2;
SetPlayerPos(playerid,389.9887,173.6320,1008.3828) ;
}
if (PlayerToPoint(4, playerid,-692.1195,939.5337,13.6328) && IsAMember(playerid))//DON MEETING
{
SetPlayerInterior(playerid,5);
SetPlayerPos(playerid,1261.8781,-785.4017,1091.9063);
SetPlayerVirtualWorld(playerid,1);
InteriorX[playerid] = 1;
}
else if (PlayerToPoint(3, playerid,2186.8948,1113.3240,12.6538))//Corleone hq entrance
{
if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)
{
SetPlayerInterior(playerid,5);
SetPlayerPos(playerid,1299.14,-794.77,1084.00);
InteriorX[playerid] = -1;
}
else if(Corleonehq == 0)
{
SetPlayerInterior(playerid,5);
SetPlayerPos(playerid,1299.14,-794.77,1084.00);
InteriorX[playerid] = -1;
}
else
{
SendClientMessage(playerid, COLOR_ERROR,".: Error: You are not allowed :.");
}
}
else if (PlayerToPoint(3, playerid,-2455.5759,2254.0273,4.9806))//Leone hq entrance
{
if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
{
SetPlayerInterior(playerid,6);
SetPlayerPos(playerid,234.2759,1064.9447,1084.2104 );
}
else if(Leonehq == 0)
{
SetPlayerInterior(playerid,6);
SetPlayerPos(playerid,234.2759,1064.9447,1084.2104 );
}
else
{
SendClientMessage(playerid, COLOR_ERROR,".: Error: You are not allowed :.");
}
}
else if (PlayerToPoint(3, playerid,2287.1304,2431.8948,10.8203))//PD
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,238.6730,139.1667,1003.0234) ;
}
else if(Policedoors == 0)
{
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,238.6730,139.1667,1003.0234) ;
}
else
{
SendClientMessage(playerid, COLOR_ERROR,".: Error: You are not allowed :.");
}
}
else if (PlayerToPoint(3, playerid,2337.2786,2458.8115,14.9688))//PD
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,288.8956,167.5276,1007.1719) ;
}
else if(Policedoors == 0)
{
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,288.8956,167.5276,1007.1719) ;
}
else
{
SendClientMessage(playerid, COLOR_ERROR,".: Error: You are not allowed :.");
}
}
else if (PlayerToPoint(3, playerid,-314.4895,1774.7339,43.6406))//Hitman hq entrance
{
if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
{
SetPlayerInterior(playerid, 1);
SetPlayerPos(playerid, -2158.72,641.29,1052.38);
}
else if(hitmanhq == 0)
{
SetPlayerInterior(playerid, 1);
SetPlayerPos(playerid, -2158.72,641.29,1052.38);
}
else
{
SendClientMessage(playerid, COLOR_ERROR,".: Error: You are not allowed :.");
}
}
/*--------------------------------------------------------------------------------------------------*/
else if (PlayerToPoint(3, playerid,1054.0164,2148.0813,10.8203))//Company
{
if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10)
{
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,235.508994,1189.169897,1080. 339966);
}
else if(Companyhq == 0)
{
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,235.508994,1189.169897,1080. 339966);
}
else
{
SendClientMessage(playerid, COLOR_ERROR,".: Error: You are not allowed :.");
}
}
/*--------------------------------------------------------------------------------------------------*/
else if (PlayerToPoint(3, playerid,2018.4930,1916.5040,12.3417))//Paterno
{
if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
{
SetPlayerInterior(playerid, 9);
SetPlayerPos(playerid, 2317.8179,-1026.4684,1050.2178);
}
else if(Paternohq == 0)
{
SetPlayerInterior(playerid, 9);
SetPlayerPos(playerid, 2317.8179,-1026.4684,1050.2178);
}
else
{
SendClientMessage(playerid, COLOR_ERROR,".: Error: You are not allowed :.");
}
}
/*--------------------------------------------------------------------------------------------------*/



else if (PlayerToPoint(3, playerid,1457.044,2773.399,10.82031))//Cuneohq entrance
{
if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
{
SetPlayerInterior(playerid,2);
SetPlayerPos(playerid,2528.9314,-1285.8564,1054.6406);
}
else if(Cuneohq == 0)
{
SetPlayerInterior(playerid,2);
SetPlayerPos(playerid,2528.9314,-1285.8564,1054.6406);
}
else
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You are not allowed :.");
}
}


else if (PlayerToPoint(4, playerid,1455.1733,751.2568,11.0234))//Tattaglia hq entrance
{
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
{
SetPlayerInterior(playerid,12);
SetPlayerPos(playerid,2324.3633,-1147.5537,1050.7101);
}
else if(Tattagliahq == 0)
{
SetPlayerInterior(playerid,12);
SetPlayerPos(playerid,2324.3633,-1147.5537,1050.7101);
}
else
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You are not allowed :.");
return 1;
}
}

else if (PlayerToPoint(4, playerid,2127.5686,2378.3154,10.8203))//BArzini hq entrance
{
if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9)
{
SetPlayerInterior(playerid,5);
SetPlayerPos(playerid,140.2734,1368.3577,1083.8628 );
}
else if(Barzinihq == 0)
{
SetPlayerInterior(playerid,5);
SetPlayerPos(playerid,140.2734,1368.3577,1083.8628 );
}
else
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You are not allowed :.");
}
}
else if (PlayerToPoint(4, playerid,2447.0974,2375.8008,12.1635))//FBI hq entrance
{
SetPlayerInterior(playerid,6);
SetPlayerPos(playerid,246.783996,63.900199,1003.64 0625);
}
/*else if(PlayerToPoint(4,playerid,2884.1108,2059.5029,11 .6064))
{
SetPlayerInterior(playerid,1);
SetPlayerPos(playerid,2266.4998,1647.3777,1084.234 4);
}*/
else if (PlayerToPoint(4, playerid,2884.1108,2059.5029,11.6064))//GOV hq entrance
{
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
{
SetPlayerInterior(playerid,10);
SetPlayerPos(playerid,246.40,110.84,1003.22);
}
else if(Govhq == 0)
{
SetPlayerInterior(playerid,10);
SetPlayerPos(playerid,246.40,110.84,1003.22);
}
else
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You are not allowed :.");
}
}

else if (PlayerToPoint(4, playerid,2388.5002,2465.9756,10.8203))//GOV hq entrance
{
if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
{
SetPlayerPos(playerid,389.9887,173.6320,1008.3828) ;
SetPlayerInterior(playerid,3);
InteriorX[playerid] = 0;
}
else if(NewsHq == 0)
{
SetPlayerPos(playerid,389.9887,173.6320,1008.3828) ;
SetPlayerInterior(playerid,3);
InteriorX[playerid] = 0;
}
else
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You are not allowed :.");
}
}
else if (PlayerToPoint(4, playerid,2628.6082,2348.7056,10.8203))//Stracci hq entrance
{
if(PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
{
SetPlayerInterior(playerid,18);
SetPlayerPos(playerid,1726.18,-1641.00,20.23);
}
else if(Straccihq == 0)
{
SetPlayerInterior(playerid,18);
SetPlayerPos(playerid,1726.18,-1641.00,20.23);
}
else
{
SendClientMessage(playerid,COLOR_ERROR,".: Error: You are not allowed :.");
}
}
}
return 1;
}


Could you change it? Thank you!

FarSe.
11/10/2011, 12:07 PM
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == 16)//F,from what i remember
{
OnPlayerCommandText(playerid,"/enter");
}
return 1;
}
Yes,This maybe will lag your server,because everytime when he press ENTER,the whole OnPlayerComandText+'/enter'/ command will executing ..

MusicBeast
11/10/2011, 01:13 PM
Thank you

Yamoo
11/10/2011, 01:16 PM
Use your head, I really can't believe you don't know how to transfer it to exit too after getting the /enter done for you.