OnPlayerPickUpPickup Help
#7

pawn Код:
public OnPlayerPickUpPickup(playerid,pickupid)
{
    new counting,notowner;
    for(new i = 0; i < MAX_HOUSES;i++)//Looping threw all houses.
    {
        if(pickupid == HouseEnter[i])//Checking if the checkpoint id corresponds to one of the house interiors
        {
            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
                SetPlayerInterior(playerid,12);//Setting the players interior.
                SetPlayerPos(playerid,446.7281,507.0475,1001.4195);//Setting the players position.
                SetPlayerVirtualWorld(playerid,HInfo[i][VirtualWorld]);//Preventing players from different houses, finding each other.
                PlayerInHouseID[playerid] = i;
                counting++;
            }
            if(HInfo[i][Owned] == 1 && strcmp(HInfo[i][Owner],pName) != 0) notowner = 1;//Checking if the house is owned but the house owner and the players name don't match.
           
        }
        if(pickupid == HouseExit[i])//Checking if the checkpointid is an House exit
        {
            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.
        }
    }
    if(counting == 0)//Simply checking if the house isn't owned.
    {
        SendClientMessage(playerid,-1,"/buy to buy this lovely house");
        return 1;
    }
    if(notowner == 1)
    {
        SendClientMessage(playerid,-1,"You don't own this house");
        return 1;
    }
    return 1;
}
Try that.

Should fix your spam issues.
Reply


Messages In This Thread
OnPlayerPickUpPickup Help (SOLVED) - by mrsamp - 07.08.2012, 20:24
Re: OnPlayerPickUpPickup Help - by mrsamp - 07.08.2012, 22:20
Respuesta: OnPlayerPickUpPickup Help - by [DOG]irinel1996 - 07.08.2012, 22:27
Re: OnPlayerPickUpPickup Help - by mrsamp - 07.08.2012, 23:22
Re: OnPlayerPickUpPickup Help - by Jstylezzz - 07.08.2012, 23:53
Re: OnPlayerPickUpPickup Help - by mrsamp - 08.08.2012, 09:04
Re: OnPlayerPickUpPickup Help - by phillip875 - 08.08.2012, 09:25
Re: OnPlayerPickUpPickup Help - by [MM]RoXoR[FS] - 08.08.2012, 09:38
Re: OnPlayerPickUpPickup Help - by mrsamp - 08.08.2012, 11:43
Re: OnPlayerPickUpPickup Help - by mrsamp - 08.08.2012, 12:18

Forum Jump:


Users browsing this thread: 1 Guest(s)