f dont work
#1

I tried to change /enter and /exit and make them to press just f.

PHP код:
    if ((newkeys==KEY_SECONDARY_ATTACK))
{
    new 
string3[128], Query[128];
    new 
faction PlayerData[playerid][Member] + PlayerData[playerid][Leader];
    for(new 
1<= housesi++)
    {
        if (
PlayerToPoint(3playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
        {
            if(
PlayerData[playerid][HKey] == || HouseInfo[i][hLock] == 0)
            {
                
SetPlayerInterior(playerid,HouseInfo[i][hInt]);
                
SetPlayerVirtualWorld(playerid,i);
                
SetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
                
GameTextForPlayer(playerid"~w~Welcome home"50001);
                
PlayerData[playerid][InHouse] = i;
            }
            else
            {
                
GameTextForPlayer(playerid"~r~Closed"50001);
            }
        }
    }
    for(new 
1<= bizzsi++)
    {
        if(
PlayerToPoint(3playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
        {
            if(
faction != && (== 1))
            {
                return 
1;
            }
            if(
PlayerData[playerid][Bizkey] == || PlayerData[playerid][Cash] >= BizzInfo[i][bEntranceCost])
            {
                if(
PlayerData[playerid][Bizkey] != i)
                {
                    if(
BizzInfo[i][bLocked] == 1) return GameTextForPlayer(playerid"~r~Closed"50001);
                    if(
BizzInfo[i][bProducts] == 0) return GameTextForPlayer(playerid"~r~Out Of Stock"50001);
                    
GivePlayerCash(playerid,-BizzInfo[i][bEntranceCost]);
                    
format(string3sizeof(string3), "~r~-$%d~n~~w~type /exit~n~to get out"BizzInfo[i][bEntranceCost]);
                    
GameTextForPlayer(playeridstring350003);
                    if(
!= 1)
                    {
                        
BizzInfo[i][bTill] += BizzInfo[i][bEntranceCost];
                        
BizzInfo[i][bProducts]--;
                        
mysql_format(SQLQuery,128,"UPDATE `bizz` SET `Till`='%d',`EntranceCost`='%d',`Products`='%d' WHERE `ID`='%d'",BizzInfo[i][bTill],BizzInfo[i][bEntranceCost],BizzInfo[i][bProducts],BizzInfo[i][bID]);
                        
mysql_tquery(SQLQuery"""");
                    }
                    else
                    {
                        
SafeBox[5][sbMoney] += BizzInfo[i][bEntranceCost];
                        
mysql_format(SQLQuery,128,"UPDATE `safeboxs` SET `Money`='%d' WHERE `ID`='5'",SafeBox[5][sbMoney]);
                        
mysql_tquery(SQLQuery"""");
                    }
                }
                
SetPlayerInterior(playerid,BizzInfo[i][bInterior]);
                
SetPlayerVirtualWorld(playerid,BizzInfo[i][bVW]);
                
SetPlayerPos(playerid,BizzInfo[i][bExitX],BizzInfo[i][bExitY],BizzInfo[i][bExitZ]);
                
PlayerData[playerid][InBizz] = i;
            }
            else
            {
                
GameTextForPlayer(playerid"~r~You dont have the cash"50001);
            }
        }
    }
    if (
PlayerToPoint(4.0playerid,1412.0304,-1700.1549,13.5395))
    {
//enter cladire-spawn
        
SetPlayerPos(playerid,16.0883,33.4171,973.3144);
        
SetPlayerFacingAngle(playerid270.7579);
        
TogglePlayerControllable(playerid0);
        
SetTimerEx("UnfreezeT"30000"d"playerid);
    }
    else if (
PlayerToPoint(2.0playerid,-1.3946,19.1643,973.3081))
    {
//sport room
        
SetPlayerPos(playerid,-1.3711,22.2146,973.4081);
    }
    else if (
PlayerToPoint(2.0playerid,22.1204,27.4664,973.3081))
    {
//main room
        
SetPlayerPos(playerid,22.1380,29.9197,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,22.2507,20.9277,973.3081))
    {
//rest room
        
SetPlayerPos(playerid,22.2184,18.6323,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,2486.5198,-1645.2394,14.0772) && faction == 2)
    {
//HQ Grove St. 125
        
PlayerData[playerid][InHQ] = 2;
        
SetPlayerPos(playerid,942.171997,-16.542755,1000.929687);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid2);
    }
    else if (
PlayerToPoint(2.0playerid,2000.0482,-1114.3588,27.1250) && faction == 3)
    {
//Grape Street Watts
        
PlayerData[playerid][InHQ] = 3;
        
SetPlayerPos(playerid,964.106994,-53.205497,1001.124572);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid3);
    }
    else if (
PlayerToPoint(2.0playerid,1899.4996,-2005.1289,13.5469) && faction == 4)
    {
//Varrio Nuevo Estrada
        
PlayerData[playerid][InHQ] = 4;
        
SetPlayerPos(playerid,1710.433715,-1669.379272,20.225049);
        
SetPlayerInterior(playerid,18);
        
SetPlayerVirtualWorld(playerid4);
    }
    else if (
PlayerToPoint(2.0playerid,1653.7765,-1655.5151,22.5156) && faction == 5)
    {
//SA GOV
        
PlayerData[playerid][InHQ] = 5;
        
SetPlayerPos(playerid,1494.3252,1304.9429,1093.2891);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid5);
    }
    else if (
PlayerToPoint(2.0playerid,755.3737,-1362.3281,13.5131) && faction == 6)
    {
//SAN Network
        
PlayerData[playerid][InHQ] = 6;
        
SetPlayerPos(playerid,1494.3252,1304.9429,1093.2891);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid6);
    }
    else if (
PlayerToPoint(2.0playerid,1172.4932,-1323.3479,15.4030) && faction == 7)
    {
//Emergency Dept.
        
PlayerData[playerid][InHQ] = 7;
        
SetPlayerPos(playerid,1494.3252,1304.9429,1093.2891);
        
SetPlayerInterior(playerid,3);
        
SetPlayerVirtualWorld(playerid7);
    }
    else if (
PlayerToPoint(2.0playerid,1555.2115,-1675.6229,16.1953))
    {
//LS - enter - section
        
SetPlayerPos(playerid,1118.5378,328.2394,583.7659);
        
SetPlayerFacingAngle(playerid90.0);
        
TogglePlayerControllable(playerid0);
        
SetTimerEx("UnfreezeT"30000"d"playerid);
    }
    else if (
PlayerToPoint(2.0playerid,1117.6843,326.2397,583.7659))
    {
//section - enter - PD control
    
}
    else if (
PlayerToPoint(2.0playerid,1127.5112,328.8745,583.7659))
    {
//section - enter - jail
    
}
}
    if ((
newkeys==KEY_SECONDARY_ATTACK))
{
    if(
PlayerData[playerid][InHouse] > 0)
    {
        new 
PlayerData[playerid][InHouse];
        
SetPlayerPos(playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
        
SetPlayerInterior(playerid,0);
        
SetPlayerVirtualWorld(playerid0);
        
PlayerData[playerid][InHouse] = -1;
    }
    if(
PlayerData[playerid][InBizz] > 0)
    {
        new 
PlayerData[playerid][InBizz];
        
PlayerData[playerid][InBizz] = -1;
        
SetPlayerInterior(playerid,0);
        
SetPlayerVirtualWorld(playerid0);
        
SetPlayerPos(playerid,BizzInfo[i][bEntranceX],BizzInfo[i][bEntranceY],BizzInfo[i][bEntranceZ]);
    }
    else if (
PlayerToPoint(2.0playerid,-1.3711,22.2146,973.4081))
    {
//sport room
        
SetPlayerPos(playerid,-1.3946,19.1643,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,22.1380,29.9197,973.3081))
    {
//main room
        
SetPlayerPos(playerid,22.1204,27.4664,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,22.2184,18.6323,973.3081))
    {
//rest room
        
SetPlayerPos(playerid,22.2507,20.9277,973.3081);
    }
    else if (
PlayerToPoint(2.0playerid,38.1737,33.4262,973.3081))
    {
//exit spawn room
        
SetPlayerPos(playerid,1412.0304,-1700.1549,13.5395);
    }
    else if (
PlayerToPoint(2.0playerid,-15.9546,32.5763,973.3081))
    {
//exit spawn room
        
SetPlayerPos(playerid,1412.0304,-1700.1549,13.5395);
    }
    else if (
PlayerToPoint(2.0playerid,942.171997,-16.542755,1000.929687))
    {
//HQ Grove St. 125
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,2486.5198,-1645.2394,14.0772);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,964.106994,-53.205497,1001.124572))
    {
//Grape Street Watts
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,2000.0482,-1114.3588,27.1250);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1710.433715,-1669.379272,20.225049))
    {
//Varrio Nuevo Estrada
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,1899.4996,-2005.1289,13.5469);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1494.3252,1304.9429,1093.2891) && PlayerData[playerid][InHQ] == 5)
    {
//SA GOV
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,1653.7765,-1655.5151,22.5156);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1494.3252,1304.9429,1093.2891) && PlayerData[playerid][InHQ] == 6)
    {
//SAN Network
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,755.3737,-1362.3281,13.5131);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1494.3252,1304.9429,1093.2891) && PlayerData[playerid][InHQ] == 7)
    {
//Emergency Dept.
        
PlayerData[playerid][InHQ] = -1;
        
SetPlayerPos(playerid,1172.4932,-1323.3479,15.4030);
        
SetPlayerVirtualWorld(playerid,0);
        
SetPlayerInterior(playerid,0);
    }
    else if (
PlayerToPoint(2.0playerid,1119.1720,330.5911,583.7659))
    {
//section - exit - LS
        
SetPlayerPos(playerid,1552.3688,-1675.5404,16.1953);
        
SetPlayerFacingAngle(playerid90.0);
    }

I dont get any errors,but when i press f it does not teleport me where it should,it teleports me in the same spot.
Reply
#2

First of, you're checking for a keypress the wrong way. See THIS.
Second, this is 2015, stop using obsolete "Godfather" like functions such as "PlayerToPoint". We now have IsPlayerInRangeOfPoint and others.
Last of, it's very hard to say what's going on as the code is really messy and doesn't make much sense.
Unfortunately, you have to do this the hard way and that is to check each and every case (if statement) to find where your real problem lies.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)