Enter and exit from house?!
#1

Hi. I'm wondering, how i can enter and exit house with ENTER_VEHICLE key?
I already have this /enter and /exit command.
Can somebody help me?
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Reply
#3

thanks, buddy
Reply
#4

But i'm quite new at scripting, can somebody make it for me?
Just for entering and exiting house on key ENTER_VEHICLE.
Please?
Reply
#5

To Clive: Watched your link, tested, but nothing won't come out. Can you help me?
Reply
#6

It ain`t that hard ... look:
pawn Код:
if ((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK))
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, X, Y, Z) // Change X, Y, Z with your house entrance coordinates
        {
                 // the rest of the code here...
        }
     }
Reply
#7

Big Big thanks to you Antonio
Reply
#8

pawn Код:
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2(firetest).pwn(46359) : error 017: undefined symbol "newkeys"
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven'
s Roleplay 0.3c\gamemodes\larp2(firetest).pwn(46362) : error 001: expected token: ")", but found "{"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
i writed front of this line(what you gave)
#define newkeys
#undefine newkeys

and if i write only
#define newkeys
then i get this error:
pawn Код:
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2(firetest).pwn(46358) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven'
s Roleplay 0.3c\gamemodes\larp2(firetest).pwn(46358) : warning 215: expression has no effect
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2(firetest).pwn(46358) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven'
s Roleplay 0.3c\gamemodes\larp2(firetest).pwn(46358) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Steven\Desktop\Server Stuff\RRserver\Ravens_Roleplay_0.3c\Ravens_Roleplay_0.3c\Raven's Roleplay 0.3c\gamemodes\larp2(firetest).pwn(46358) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#9

If someone i so good and helpful and helps me to fix this then original code is here:
pawn Код:
if(strcmp(cmd, "/enter", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            for(new i = 0; i < sizeof(HouseInfo); i++)
            {
                if (IsPlayerInRangeOfPoint(playerid, 10,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
                {
                    //printf("Found House :%d",i);
                    if(PlayerInfo[playerid][pPhousekey] == i || HouseInfo[i][hLock] == 0)
                    {
                        if(PlayerInfo[playerid][pWanted] == 0)
                        {
                            SafeSetPlayerInterior(playerid,HouseInfo[i][hInt]);
                            SetPlayerVirtualWorld(playerid,HouseInfo[i][hWorld]);
                            SafeSetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
                            GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
                            PlayerInfo[playerid][pLocal] = i;
                            PlayerInfo[playerid][pVirWorld] = HouseInfo[i][hWorld];
                            HouseEntered[playerid] = i;
                            PlayerInfo[playerid][pInteriorNr] = 39;
                        }
                        else
                        {
                            GameTextForPlayer(playerid, "~r~Criminals can't hide in houses!", 5000, 1);
                            return 1;
                        }
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                        return 1;
                    }
                }
            }
            for(new i = 0; i < sizeof(BizzInfo); i++)
            {
                if (IsPlayerInRangeOfPoint(playerid, 5,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
                {
                    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(2,i);
                            GameTextForPlayer(playerid, string, 5000, 3);
                        }
                        PlayerInfo[playerid][pInteriorNr] = BizzInfo[i][bInteriorNr];
                        SetPlayerVirtualWorld(playerid,BizzInfo[i][bVirWorld]);
                        SafeSetPlayerInterior(playerid,BizzInfo[i][bInterior]);
                        SafeSetPlayerPos(playerid,BizzInfo[i][bExitX],BizzInfo[i][bExitY],BizzInfo[i][bExitZ]);
                        new dood[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, dood, sizeof(dood));
                        BizzEntered[playerid] = i;
                        enterbizz[playerid] = BizzEntered[playerid];
                        new h,mi,s,y,m,d;
                        getdate(y,m,d);
                        gettime(h,mi,s);
                        format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s payed $%d to enter biz %d",d,m,y,h,mi,s, dood, BizzInfo[i][bEntranceCost], i);
                        printf("%s", string);
                        PayLog(string);
                        if(BizzInfo[i][bVirWorld] == 0 || BizzInfo[i][bVirWorld] == 1)
                        {
                            OnPlayerEnterFood(playerid, 1);
                        }
                        else if(BizzInfo[i][bVirWorld] == 2 || BizzInfo[i][bVirWorld] == 3)
                        {
                            OnPlayerEnterFood(playerid, 2);
                        }
                        else if(BizzInfo[i][bVirWorld] == 4 || BizzInfo[i][bVirWorld] == 5)
                        {
                            OnPlayerEnterFood(playerid, 3);
                        }
                        else if(BizzInfo[i][bVirWorld] == 6)
                        {
                            OnPlayerEnterFood(playerid, 4);
                        }
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
                    }
                }
            }
            for(new i = 0; i < sizeof(SBizzInfo); i++)
            {
                if (IsPlayerInRangeOfPoint(playerid, 3,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;
                            }
                            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(3,i);
                        }
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~You dont have the cash", 5000, 1);
                    }
                }
            }
            if (IsPlayerInRangeOfPoint(playerid, 3,2695.6235,-1704.6960,11.8438))
            {
                GameTextForPlayer(playerid, "~w~Welcome to the 8ball Track", 5000, 1);
                SafeSetPlayerInterior(playerid,7);
                SafeSetPlayerPos(playerid,-1404.5299,-259.0602,1043.6563);
            }
            else if (IsPlayerInRangeOfPoint(playerid, 8,-2111.5686,-443.9720,38.7344))
            {
                GameTextForPlayer(playerid, "~w~Welcome to the Dirt Track", 5000, 1);
                SafeSetPlayerInterior(playerid,4);
                SafeSetPlayerPos(playerid,-1443.0554,-581.1879,1055.0472);
            }
            else if (IsPlayerInRangeOfPoint(playerid, 3,-2080.3079,-406.0309,38.7344))
            {
                GameTextForPlayer(playerid, "~w~Welcome to the Stunting Track", 5000, 1);
                SafeSetPlayerInterior(playerid,14);
                SafeSetPlayerPos(playerid,-1464.7732,1557.5533,1052.5313);
            }
            if (IsPlayerInRangeOfPoint(playerid,10,1099.3762,1601.5387,12.5469))
            {
                if (GetPlayerState(playerid) == 2)
                {
                    if (PlayerInfo[playerid][pDTK] == 0 && PlayerInfo[playerid][pDM] == 0 && PlayerInfo[playerid][pAdmin] <= 2)
                    {
                        SendClientMessage(playerid,COLOR_NICERED,"You do not have a DD Ticket!");

                        format(string, sizeof(string), "[ADMIN]: %s Tried to Enter to the DDS Without a Ticket!", sendername);
                        ABroadCast(COLOR_LIGHTRED,string, 5);
                        return 1;
                    }
                    new tmpcar = GetPlayerVehicleID(playerid);
                    new vehicleid = GetPlayerVehicleID(playerid);
                    SetVehiclePos(tmpcar, -1437.1271,990.9039,1030.5000);
                    PlayerInfo[playerid][pDTK] = 0;
                    SafeSetPlayerInterior(playerid, 15)
                    LinkVehicleToInterior(vehicleid, 15);
                    PlayerInfo[playerid][pInteriorNr] = 25;
                    GameTextForPlayer(playerid,"~p~Raven's Roleplay ~n~~r~Destruction Derby Stadium", 5000,1)
                    SendClientMessage(playerid, COLOR_NICERED, "Welcome to the Raven's Roleplay Destruction Derby Stadium (DD)");
                    SendClientMessage(playerid, TEAM_VAGOS_COLOR, "----------------------------------DD Main Rules---------------------------------------");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "Ram Someone Before the Admin Does a countdown is equal to two hours Jail");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "The Center Square means Hosters Area");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "If you do not host the DD, You are not Allowed to Get to the Hoster Area");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "Getting into the Hoster Area without beginning a Hoster is equal to 30 Minutes Jail");
                    SendClientMessage(playerid, TEAM_VAGOS_COLOR, "----------------------------------Driver Rules----------------------------------------");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "Get to the Corners of the Stadium and Wait for The Admin Voice!");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "The Last One That remains without getting destroyed Wins");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "Prize: 13,337 ML$ And 1500 Bullets Of Any Gun; GOOD LUCK!");
                }
                else
                {
                    if (PlayerInfo[playerid][pDSTK] == 0 && PlayerInfo[playerid][pDM] == 0 && PlayerInfo[playerid][pAdmin] <= 2)
                    {
                        SendClientMessage(playerid,COLOR_NICERED,"You do not have a DD (S) Ticket!");

                        format(string, sizeof(string), "[ADMIN]: %s Tried to Enter to the DD (S) Without a Ticket!", sendername);
                        ABroadCast(COLOR_LIGHTRED,string, 5);
                        return 1;
                    }
                    GameTextForPlayer(playerid, "~p~Raven's Roleplay ~n~~r~~h~Destruction Derby Stadium ~n~~g~Las Venturas", 5000, 1);
                    SafeSetPlayerInterior(playerid, 15);
                    SafeSetPlayerPos(playerid,-1390.0785,930.2457,1041.5313);
                    PlayerInfo[playerid][pDSTK] = 0;
                    PlayerInfo[playerid][pInteriorNr] = 25;
                    SendClientMessage(playerid, COLOR_NICERED, "Welcome to the Raven's Roleplay Destruction Derby Stadium (DD)");
                    SendClientMessage(playerid, TEAM_VAGOS_COLOR, "------------------------------------DD Main Rules------------------------------------");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "Ram Someone Before the Manager Does a countdown is equal to two hours Jail");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "The Center Square means Hosters Area");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "If you do not host the DD, You are not Allowed to Get to the Hoster Area");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "Getting into the Hoster Area without beginning a Hoster is equal to 30 Minutes Jail");
                    SendClientMessage(playerid, TEAM_VAGOS_COLOR, "----------------------------------Spectator Rules------------------------------------");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "Remain at the Spectators Area And Have Fun!");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "Do not Attack ANYONE At the Spectators Area");
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "Attacking Someone or Entering inside of the stadium is equal 30 Minutes Jail.");
                }
            }
            else if (IsPlayerInRangeOfPoint(playerid, 4,2073.2979,-1831.1228,13.5469))
            { // Pay & Spray
                if(GetPlayerState(playerid) == 2)
                {
                    if(GetPlayerMoney(playerid) > SBizzInfo[5][sbEntranceCost] + 100)
                    {
                        if(SBizzInfo[5][sbProducts] > 0)
                        {
                            new tmpcar = GetPlayerVehicleID(playerid);
                            SetVehiclePos(tmpcar, 2062.1294,-1831.5498,13.5469);
                            SetVehicleZAngle(tmpcar, 90);
                            SafeGivePlayerMoney(playerid, - SBizzInfo[5][sbEntranceCost]);
                            SBizzInfo[5][sbTill] += SBizzInfo[5][sbEntranceCost];
                            SBizzInfo[5][sbProducts]--;
                            SetTimerEx("AfterSpray1", 7500, false, "i", playerid);
                        }
                        else
                        {
                            GameTextForPlayer(playerid, "~r~Out of stock", 5000, 1);
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to enter Pay & Spray.");
                    }
                }
            }
            else if (IsPlayerInRangeOfPoint(playerid, 4,1024.9756,-1030.7930,32.0257))
            { // Pay & Spray
                if(GetPlayerState(playerid) == 2)
                {
                    if(GetPlayerMoney(playerid) > SBizzInfo[5][sbEntranceCost] + 100)
                    {
                        if(SBizzInfo[5][sbProducts] > 0)
                        {
                            new tmpcar = GetPlayerVehicleID(playerid);
                            SetVehiclePos(tmpcar, 1024.9763,-1021.8850,32.1016);
                            SetVehicleZAngle(tmpcar, 0);
                            SafeGivePlayerMoney(playerid, - SBizzInfo[5][sbEntranceCost]);
                            SBizzInfo[5][sbTill] += SBizzInfo[5][sbEntranceCost];
                            SBizzInfo[5][sbProducts]--;
                            SetTimerEx("AfterSpray2", 7500, false, "i", playerid);
                        }
                        else
                        {
                            GameTextForPlayer(playerid, "~r~Out of stock", 5000, 1);
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to enter Pay & Spray.");
                    }
                }
            }
            else if (IsPlayerInRangeOfPoint(playerid, 4,488.3819,-1733.0563,11.1752))
            { // Pay & Spray
                if(GetPlayerState(playerid) == 2)
                {
                    if(GetPlayerMoney(playerid) > SBizzInfo[5][sbEntranceCost] + 100)
                    {
                        if(SBizzInfo[5][sbProducts] > 0)
                        {
                            new tmpcar = GetPlayerVehicleID(playerid);
                            SetVehiclePos(tmpcar, 487.4099,-1741.4585,11.1330);
                            SetVehicleZAngle(tmpcar, 180);
                            SafeGivePlayerMoney(playerid, - SBizzInfo[5][sbEntranceCost]);
                            SBizzInfo[5][sbTill] += SBizzInfo[5][sbEntranceCost];
                            SBizzInfo[5][sbProducts]--;
                            SetTimerEx("AfterSpray3", 7500, false, "i", playerid);
                        }
                        else
                        {
                            GameTextForPlayer(playerid, "~r~Out of stock", 5000, 1);
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to enter Pay & Spray.");
                    }
                }
            }
            else if (IsPlayerInRangeOfPoint(playerid, 4,719.8940,-464.8272,16.3359))
            { // Pay & Spray
                if(GetPlayerState(playerid) == 2)
                {
                    if(GetPlayerMoney(playerid) > SBizzInfo[5][sbEntranceCost] + 100)
                    {
                        if(SBizzInfo[5][sbProducts] > 0)
                        {
                            new tmpcar = GetPlayerVehicleID(playerid);
                            SetVehiclePos(tmpcar, 720.3924,-456.0286,16.3359);
                            SetVehicleZAngle(tmpcar, 0);
                            SafeGivePlayerMoney(playerid, - SBizzInfo[5][sbEntranceCost]);
                            SBizzInfo[5][sbTill] += SBizzInfo[5][sbEntranceCost];
                            SBizzInfo[5][sbProducts]--;
                            SetTimerEx("AfterSpray4", 7500, false, "i", playerid);
                        }
                        else
                        {
                            GameTextForPlayer(playerid, "~r~Out of stock", 5000, 1);
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to enter Pay & Spray.");
                    }
                }
            }
        }

        new y, m, d;
        new h,mi,s;
        getdate(y,m,d);
        gettime(h,mi,s);
        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /enter",d,m,y,h,mi,s,sendername);
        CommandLog(string);
        return 1;
    }
Reply
#10

hoping on you friends
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)