Having house system with CP
#1

Hey, so I have that House_Refresh thingy, and I wanna add a checkpoint here is both of the codes:

How to make this: -

PHP код:

House_Refresh
(houseid)
{
    if (
houseid != -1 && HouseData[houseid][houseExists])
    {
        if (
IsValidDynamic3DTextLabel(HouseData[houseid][houseText3D]))
            
DestroyDynamic3DTextLabel(HouseData[houseid][houseText3D]);
        if (
IsValidDynamicPickup(HouseData[houseid][housePickup]))
            
DestroyDynamicPickup(HouseData[houseid][housePickup]);
        if (
IsValidDynamicMapIcon(HouseData[houseid][houseMapIcon]))
            
DestroyDynamicMapIcon(HouseData[houseid][houseMapIcon]);
            
        static
            
string[128];
        if (!
HouseData[houseid][houseOwner]) {
            
format(string, sizeof(string), "[{31B404}Property{FFFFFF}]\nHouse Price: %s\nAddress: %s.Street", FormatNumber(HouseData[houseid][housePrice]), HouseData[houseid][houseAddress]);
            
HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
        }
        else {
            
format(string, sizeof(string), "[{31B404}Property{FFFFFF}]\nAddress: %s.Street", HouseData[houseid][houseAddress]);
            
HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
        }
         
HouseData[houseid][housePickup] = CreateDynamicPickup(1273, 23, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
    }
    return 
1;
} 
to be this without errors or such :

PHP код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(
GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
        new 
string[128];
        for(new 
c = 0; c < sizeof(Houses); c++) // House checkpoints
        
{
            if(
Houses[c][PickupID] == checkpointid)
            {
                if (
PlayerToPoint(1.4,playerid,Houses[c][EnterX], Houses[c][EnterY], Houses[c][EnterZ]))
                {
                    if(
Houses[c][HousePrice] != 0)
                    {
                        if(
Houses[c][Owned] == 0)
                        {
                            
SendClientMessage(playerid, COLOR_GREEN, "Would you like to buy this?");
                            
format(string, sizeof(string), "Price: $%d", Houses[c][HousePrice]);
                            
SendClientMessage(playerid, COLOR_GREEN, string);
                            
SendClientMessage(playerid, COLOR_WHITE, "Available commands: /enter, /ds(hout)");
                            
SendClientMessage(playerid, COLOR_WHITE, "/buyhouse");
                        }
                        else
                        {
                            if(
Houses[c][Rentable] == 1)
                            {
                                new 
string2[128];
                                
format(string, sizeof(string), "[Address: %d] You're standing on %s's porch.",c,Houses[c][Owner]);
                                
SendClientMessage(playerid, COLOR_GREEN, string);
                                
format(string2, sizeof(string2), "Available commands: /enter, /ds(hout), /rentroom (Price: $%d)", Houses[c][RentCost]);
                                
SendClientMessage(playerid, COLOR_WHITE, string2);
                            }
                            else
                            {
                                
format(string, sizeof(string), "[Address: %d] You're standing on %s's porch.",c,Houses[c][Owner]);
                                
SendClientMessage(playerid, COLOR_GREEN, string);
                                
SendClientMessage(playerid, COLOR_WHITE, "Available commands: /enter, /ds(hout)");
                            }
                        }
                    }
                }
            }
        }
    }
    return 
1;
} 
Reply
#2

you want to create a CP (checkpoint), but in your code you have createdynamicpickup
Reply
#3

Quote:
Originally Posted by jeffery30162
Посмотреть сообщение
you want to create a CP (checkpoint), but in your code you have createdynamicpickup
Thats what I meant, how do I exchange between them?
Reply
#4

exchange? you cant, if you want to detect if A player picks up a pickup use:

public OnPlayerPickUpPickup(playerid, pickupid)

make sure you set the pickup to always exist even if the player picks it up.

look here: samp wiki
Reply
#5

Quote:
Originally Posted by jeffery30162
Посмотреть сообщение
exchange? you cant, if you want to detect if A player picks up a pickup use:

public OnPlayerPickUpPickup(playerid, pickupid)

make sure you set the pickup to always exist even if the player picks it up.

look here: samp wiki
Awww-. right. thanks!
Reply
#6

Quote:
Originally Posted by jeffery30162
Посмотреть сообщение
exchange? you cant, if you want to detect if A player picks up a pickup use:

public OnPlayerPickUpPickup(playerid, pickupid)

make sure you set the pickup to always exist even if the player picks it up.

look here: samp wiki
Ain't Dynamic pickups should be under OnPlayerPickUpDynamicPickup?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)