Jump to content

Question

Posted

Salut, am aceste 2 functii, una pentru intrare si una pentru iesire. Poti intra in cele mentionate in titlu dar cand vreau sa ies nu mai face nimic.

function EnterFunction(playerid) {
    new i = PickupInfo[PlayerPickup[playerid]][pkID];

    switch(PickupInfo[PlayerPickup[playerid]][pkType]) {
        case 1: {
            if(!PlayerToPoint(1.5, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
                return true;
            if(GetPlayerVirtualWorld(playerid) != 0)
                return SCM(playerid, COLOR_LGREEN, "Error: You can not enter in a house because you are in another virtual world.");

            if(HouseInfo[i][hLock] != 0) 
                return GameTextForPlayer(playerid, "~r~~h~Closed", 1000, 1);
            SetPlayerInterior(playerid,HouseInfo[i][hInterior]);
            PlayerInfo[playerid][pInt] = HouseInfo[i][hInterior];
            PlayerInfo[playerid][pLocal] = i;
            SetPlayerVirtualWorld(playerid,HouseInfo[i][hVirtual]);
            InHouse[playerid] = i;
            DeelayCommand[playerid][13] = 5;
            HouseRadio(playerid, i);
            SetPlayerPosEx(true, playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
        }
        case 2: {
            if(!PlayerToPoint(1.5, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]) || BizzInfo[i][bStatic] != 0)
                return true;
            if(PlayerMoney(playerid, BizzInfo[i][bFee])) 
                return GameTextForPlayer(playerid, "~r~~h~You do not have enough money", 1000, 1);
            if(BizzInfo[i][bLocked] == 1) 
                return GameTextForPlayer(playerid, "~r~~h~Closed", 1000, 1);
            switch(BizzInfo[i][bType]) {
                case 1: SCM(playerid,COLOR_WHITE,"Commands: /withdraw, /transfer, /deposit.");
                case 3: SCM(playerid,COLOR_WHITE,"Commands: /drink.");
                case 5: SCM(playerid,COLOR_WHITE,"Commands: /buydildo.");
                case 6: SCM(playerid,COLOR_WHITE,"Commands: /buy.");
                case 7: SCM(playerid,COLOR_WHITE,"Commands: /glasses, /buyhat.");
                case 8: {
                    if(KG[playerid] != 0) {
                    GiveJobSalary(playerid);
                    DisablePlayerCheckpointEx(playerid);
                    CP[playerid] = 0;
                    GunoiKG[playerid] = 0;
                    KG[playerid] = 0;
                    PlayerInfo[playerid][pFarmerSkill] ++;
                    Update(playerid, pFarmerSkillx);                        
                    DestroyVehicle(JobVehicle[playerid]);
                    JobVehicle[playerid] = 0, JobWorking[playerid] = 0;
                    }
                }
                case 9: SCM(playerid,COLOR_WHITE,"Commands: /dice.");
                case 20: SCM(playerid,COLOR_WHITE,"Commands: /buy.");
            }
            GivePlayerCash(playerid, 0,BizzInfo[i][bFee]);
            BizzInfo[i][bBalance] += BizzInfo[i][bFee];
            BizzRadio(playerid, i);                               
            SetPlayerInterior(playerid,BizzInfo[i][bInterior]);
            PlayerInfo[playerid][pInt] = BizzInfo[i][bInterior];
            PlayerInfo[playerid][pLocal] = i+99;
            SetPlayerVirtualWorld(playerid,BizzInfo[i][bVirtual]);
            InBussines[playerid] = i;
            SetPlayerPosEx(true, playerid,BizzInfo[i][bExitX],BizzInfo[i][bExitY],BizzInfo[i][bExitZ] + 0.2);
            gQuery[0] = EOS;
            mysql_format(SQL, gQuery, sizeof(gQuery),"UPDATE `bizz` SET `Till`='%d' WHERE `ID`='%d'",BizzInfo[i][bBalance], BizzInfo[i][bID]);
            mysql_tquery(SQL, gQuery, "", "");
        }
        case 3: {
            if(!PlayerToPoint(1.5, playerid, DynamicFactions[i][extX], DynamicFactions[i][extY], DynamicFactions[i][extZ]))
                return true;
            if(PlayerInfo[playerid][pMember] == i || i < 3 || DynamicFactions[i][fLock] == 1 || OnDuty[playerid] == 1 /*adaugat nou->*/|| OnDuty[playerid] == 0) {
                SetPlayerInterior(playerid, DynamicFactions[i][fInterior]);
                SetPlayerVirtualWorld(playerid, DynamicFactions[i][fID]);
                InHQ[playerid] = i;
                SetPlayerPosEx(true, playerid, DynamicFactions[i][fcX], DynamicFactions[i][fcY], DynamicFactions[i][fcZ]);
            }
        }
        case 4: {
            if(!PlayerToPoint(1.5, playerid, ClanHQInfo[i][cPosX], ClanHQInfo[i][cPosY], ClanHQInfo[i][cPosZ])) 
                return true;
            if(GetPlayerVirtualWorld(playerid) != 0)
                return SCM(playerid, COLOR_LGREEN, "You can not enter in a house because you are in another virtual world.");
            if(ClanHQInfo[i][cClan] != PlayerInfo[playerid][pClan] && ClanHQInfo[i][cClan] != 0) return SCMf(playerid, COLOR_GREY, "You are not in the clan with id %d.", ClanHQInfo[i][cClan]);
            else if(ClanHQInfo[i][cClan] == 0) return 1;
            SetPlayerInterior(playerid, 1);
            InClanHQ[playerid] = i;
            SetPlayerVirtualWorld(playerid, ClanHQInfo[i][cVirtualWorld]);
            SetPlayerPosEx(false, playerid, ClanHQInfo[i][cEnterX], ClanHQInfo[i][cEnterY], ClanHQInfo[i][cEnterZ]);
            SCM(playerid, COLOR_WHITE, "Welcome to clan HQ.");    
        }
    }           
    return true;
}

//test
function ExitFunction(playerid) {
    new i;
    if(InHouse[playerid] != -1) {
        i = InHouse[playerid];
        if(PlayerInfo[playerid][pSleeping] == 1) 
            return true;    
        
        if(!PlayerToPoint(1.5, playerid,HouseInfo[i][hExitx], HouseInfo[i][hExity], HouseInfo[i][hExitz]))
            return true;
        SetPlayerInterior(playerid,0);
        SetPlayerVirtualWorld(playerid, 0);
        PlayRadio[playerid] = 0;
        SetPlayerPosEx(false, playerid,HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez]);
        StopAudioStreamForPlayer(playerid);
        InHouse[playerid] = -1;
        return true;
    }
    if(InBussines[playerid] != -1) {
        i = InBussines[playerid];
        if(!PlayerToPoint(1.5, playerid,BizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]))
            return true;

        SetPlayerInterior(playerid, 0);
        PlayerInfo[playerid][pLocal] = 255;
        PlayRadio[playerid] = 0;
        StopAudioStreamForPlayer(playerid);
        SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pTutorial] < 10 ? playerid + 10 : 0);
        SetPlayerPosEx(false, playerid,BizzInfo[i][bEntranceX],BizzInfo[i][bEntranceY],BizzInfo[i][bEntranceZ]);
        InBussines[playerid] = -1;
        return true;
    }
    if(InHQ[playerid] != -1) {
        i = InHQ[playerid];
        if(!PlayerToPoint(1.5, playerid, DynamicFactions[i][fcX], DynamicFactions[i][fcY], DynamicFactions[i][fcZ]))
            return true;
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerPosEx(false, playerid, DynamicFactions[i][extX], DynamicFactions[i][extY], DynamicFactions[i][extZ]);
        InHQ[playerid] = -1;
        return true;
    }
    if(InClanHQ[playerid] != -1) {
        new idd = ClanInfo[PlayerInfo[playerid][pClan]][clHQ];
        if(!PlayerToPoint(1.5, playerid, ClanHQInfo[idd][cEnterX], ClanHQInfo[idd][cEnterY], ClanHQInfo[idd][cEnterZ])) 
            return true;
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerPosEx(false, playerid, ClanHQInfo[idd][cPosX], ClanHQInfo[idd][cPosY], ClanHQInfo[idd][cPosZ]);
        InClanHQ[playerid] = -1;
    }
    return true;
}

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.