What is wrong with my house system! Please Help !
#1

Well i have been trying to fix this for the past week but no one will help me.....


Pretty much, when i create and house and then buy it again, it is meant to get rid of the green spinning icon and put a blue on there, sometimes it does but other times, it just puts a blue on there and dont remove the green one so there is a blue and green pickup.


Also when i buy it and enter it, i just get spawned to a random location next to a field.....


Please Help Me Please


http://pastebin.com/tCgyWKc2


Thank You


Please Help Me Please
Reply
#2

AddStaticPickup doesn't return an ID, so basically deleting the icon and re-making a new icon will work for house id 0 only.

Try changing AddStaticPickup to CreatePickup.


Edit:
Now for your 2nd problem, you didn't assign a new pickup to "HouseEnter[id]", I can also see that you've made it create the blue house icon BEFORE destroying the green icon.

After changing AddStaticPickup to CreatePickup assign that blue pickup to "HouseEnter[id]" and place it AFTER destroying the old pickup.


Edit 2:
I've also noticed you made a "new pickupid" then compared it to "HouseEnter[id]" without even assigning the "pickupid" any value, which makes it always 0.
Reply
#3

Thank You!


Can you try and tell me why when i press the crouch button instead of going to interior 12 and to the position i set i go to a random location ( the same one every time ) and for a few seconds i fall under the map, I think go to 0.000( X ) 0.000 ( Y ) 0.000 ( Z )


Thank You


Please Help Me Please
Reply
#4

Change your OnPlayerKeyStateChange to this.

What I've made to check the house entering is looping through all houses and checking if you're near the "HouseEnter" coordinates of any house.

What I've made to check the house exiting is looping through all houses, decide which house you're inside by comparing your virtual world to the house's virtual world then checking if you're by the exit checkpoint.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

    if(newkeys == KEY_CROUCH)
    {
    for(new i = 0; i < MAX_HOUSES;i++)//Looping threw all houses.
    {
        //new pickupid;
        //if(pickupid == HouseEnter[i])//Checking if the checkpoint id corresponds to one of the house interiors
        if(IsPlayerInRangeOfPoint(playerid, 2, HInfo[i][XPos],HInfo[i][YPos],HInfo[i][ZPos]))//Checking if the player is near any house
        {
            new pName[24];//Creating the new var for the players name
            GetPlayerName(playerid,pName,24);//Storing the players name
            if(HInfo[i][Owned] == 1 && strcmp(HInfo[i][Owner],pName) == 0)//String comparing between the players name and the house owners name, to check if they match.
            {
                SetPVarInt(playerid,"PlayersInteriorHouse",GetPlayerInterior(playerid));//Storing, so later we can reset it back
                SetPVarInt(playerid,"PlayerVirtualWorldHouse",GetPlayerVirtualWorld(playerid));//Storing, so later we can reset it back
                SetPlayerPos(playerid,446.7281,507.0475,1001.9195);//Setting the players position.
                SetPlayerInterior(playerid,12);//Setting the players interior.
                SetPlayerVirtualWorld(playerid,HInfo[i][VirtualWorld]);//Preventing players from different houses,
                PlayerInHouseID[playerid] = i;
            }
            if(HInfo[i][Owned] == 1 && strcmp(HInfo[i][Owner],pName) != 0)//Checking if the house is owned but the house owner and the players name don't match.
            {
                SendClientMessage(playerid,-1,"You don't own this house");
            }
            if(HInfo[i][Owned] == 0)//Simply checking if the house isn't owned.
            {
                SendClientMessage(playerid,-1,"/buy to buy this lovely house");
            }
        }
        //if(pickupid == HouseExit[i])//Checking if the checkpointid is an House exit
        if(GetPlayerVirtualWorld(playerid) == HInfo[i][VirtualWorld] && IsPlayerInRangeOfPoint(playerid, 1.5, 443.9237,509.4609,1001.4195)) //Checking which house is the player inside by comparing virutal worlds, also checking if he's near the exit checkpoint
        {
            SetPlayerPos(playerid,HInfo[i][XPos]+3,HInfo[i][YPos],HInfo[i][ZPos]);//Setting the players position to checkpoint position +3
            SetPlayerInterior(playerid,GetPVarInt(playerid,"PlayersInteriorHouse"));//Setting the players interior to the one we stored
            SetPlayerVirtualWorld(playerid,GetPVarInt(playerid,"PlayerVirtualWorldHouse"));//Setting the players virtual world to the one we stored.
        }
    }
 }
    return 1;
}
Reply
#5

Quote:
Originally Posted by iRage
Посмотреть сообщение
Change your OnPlayerKeyStateChange to this.

What I've made to check the house entering is looping through all houses and checking if you're near the "HouseEnter" coordinates of any house.

What I've made to check the house exiting is looping through all houses, decide which house you're inside by comparing your virtual world to the house's virtual world then checking if you're by the exit checkpoint.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

    if(newkeys == KEY_CROUCH)
    {
    for(new i = 0; i < MAX_HOUSES;i++)//Looping threw all houses.
    {
        //new pickupid;
        //if(pickupid == HouseEnter[i])//Checking if the checkpoint id corresponds to one of the house interiors
        if(IsPlayerInRangeOfPoint(playerid, 2, HInfo[i][XPos],HInfo[i][YPos],HInfo[i][ZPos]))//Checking if the player is near any house
        {
            new pName[24];//Creating the new var for the players name
            GetPlayerName(playerid,pName,24);//Storing the players name
            if(HInfo[i][Owned] == 1 && strcmp(HInfo[i][Owner],pName) == 0)//String comparing between the players name and the house owners name, to check if they match.
            {
                SetPVarInt(playerid,"PlayersInteriorHouse",GetPlayerInterior(playerid));//Storing, so later we can reset it back
                SetPVarInt(playerid,"PlayerVirtualWorldHouse",GetPlayerVirtualWorld(playerid));//Storing, so later we can reset it back
                SetPlayerPos(playerid,446.7281,507.0475,1001.9195);//Setting the players position.
                SetPlayerInterior(playerid,12);//Setting the players interior.
                SetPlayerVirtualWorld(playerid,HInfo[i][VirtualWorld]);//Preventing players from different houses,
                PlayerInHouseID[playerid] = i;
            }
            if(HInfo[i][Owned] == 1 && strcmp(HInfo[i][Owner],pName) != 0)//Checking if the house is owned but the house owner and the players name don't match.
            {
                SendClientMessage(playerid,-1,"You don't own this house");
            }
            if(HInfo[i][Owned] == 0)//Simply checking if the house isn't owned.
            {
                SendClientMessage(playerid,-1,"/buy to buy this lovely house");
            }
        }
        //if(pickupid == HouseExit[i])//Checking if the checkpointid is an House exit
        if(GetPlayerVirtualWorld(playerid) == HInfo[i][VirtualWorld] && IsPlayerInRangeOfPoint(playerid, 1.5, 443.9237,509.4609,1001.4195)) //Checking which house is the player inside by comparing virutal worlds, also checking if he's near the exit checkpoint
        {
            SetPlayerPos(playerid,HInfo[i][XPos]+3,HInfo[i][YPos],HInfo[i][ZPos]);//Setting the players position to checkpoint position +3
            SetPlayerInterior(playerid,GetPVarInt(playerid,"PlayersInteriorHouse"));//Setting the players interior to the one we stored
            SetPlayerVirtualWorld(playerid,GetPVarInt(playerid,"PlayerVirtualWorldHouse"));//Setting the players virtual world to the one we stored.
        }
    }
 }
    return 1;
}
Ahhh, this is really annoying me, do you have skype ?


When i create a house and then buy it, the green icon goes and a blue ones comes, thats good but when i crouch it says i dont own this house..... also when i create another house the old house icon disappears


Thank You


Please Help Me Please
Reply
#6

Thank You


Please Help Me Please
Reply
#7

Thank You


Please Help Me Please
Reply
#8

don't trible post or double its kinda a way to post hunt
Reply
#9

Stop bumping stuff. People try and help you, but you just keep asking more questions. If people don't reply they either don't feel they can help you, or they just plain don't want to.

Constantly bumping your stuff can easily push people to the "dont want to" group.
Reply
#10

Thank You


Please Help Me Please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)