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 != -&& 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(stringsizeof(string), "[{31B404}Property{FFFFFF}]\nHouse Price: %s\nAddress: %s.Street"FormatNumber(HouseData[houseid][housePrice]), HouseData[houseid][houseAddress]);
            
HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(stringCOLOR_WHITEHouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 15.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
        }
        else {
            
format(stringsizeof(string), "[{31B404}Property{FFFFFF}]\nAddress: %s.Street"HouseData[houseid][houseAddress]);
            
HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(stringCOLOR_WHITEHouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 15.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
        }
         
HouseData[houseid][housePickup] = CreateDynamicPickup(127323HouseData[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(playeridcheckpointid)
{
    if(
GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
        new 
string[128];
        for(new 
0sizeof(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(playeridCOLOR_GREEN"Would you like to buy this?");
                            
format(stringsizeof(string), "Price: $%d"Houses[c][HousePrice]);
                            
SendClientMessage(playeridCOLOR_GREENstring);
                            
SendClientMessage(playeridCOLOR_WHITE"Available commands: /enter, /ds(hout)");
                            
SendClientMessage(playeridCOLOR_WHITE"/buyhouse");
                        }
                        else
                        {
                            if(
Houses[c][Rentable] == 1)
                            {
                                new 
string2[128];
                                
format(stringsizeof(string), "[Address: %d] You're standing on %s's porch.",c,Houses[c][Owner]);
                                
SendClientMessage(playeridCOLOR_GREENstring);
                                
format(string2sizeof(string2), "Available commands: /enter, /ds(hout), /rentroom (Price: $%d)"Houses[c][RentCost]);
                                
SendClientMessage(playeridCOLOR_WHITEstring2);
                            }
                            else
                            {
                                
format(stringsizeof(string), "[Address: %d] You're standing on %s's porch.",c,Houses[c][Owner]);
                                
SendClientMessage(playeridCOLOR_GREENstring);
                                
SendClientMessage(playeridCOLOR_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)