Pickup not being created.
#1

Hey there, first of all - thank you for reading this.

Alright, so I have the following code:
pawn Код:
CMD:movehouse(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] < 5) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not authorized to perform this command!");
    if(sscanf(params, "d", houseid)) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /movehouse [houseid]");
    format(file, sizeof(file), "Houses/House_%d.ini", houseid);
    if(!fexist(file)) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: The selected house is not implented in the server!");
    GetPlayerPos(playerid, x, y, z);
    Delete3DTextLabel(HouseLabel[houseid]);
    DestroyPickup(HouseInfo[houseid][Pickupid]);
    format(housetext, sizeof(housetext), "{1BBF39}[ House ID:{FFFFFF} %d{1BBF39} ]", houseid);
    if(strval(dini_Get(file, "Owned")) == 1)
    {
        format(aname, sizeof(aname), "%s", dini_Get(file, "Owner"));
        kreplace(aname, '_', ' ');
        format(housetextadd, sizeof(housetextadd), "\n{1BBF39}Owner:{FFFFFF} %s", aname);
        strcat(housetext, housetextadd);
    }
    if(strval(dini_Get(file, "ForSale")) == 1 && HouseInfo[houseid][Price] != 666)
    {
        format(housetextadd1, sizeof(housetextadd1), "\n{1BBF39}Price:{FFFFFF} %d", Value);
        strcat(housetext, housetextadd1);
    }
    if(HouseInfo[houseid][ForRent] == 1 && HouseInfo[houseid][RentPrice] != 666)
    {
        format(housetextadd1, sizeof(housetextadd1), "\n{1BBF39}Rent:{FFFFFF} %d\n{1BBF39}Commands: {FFFFFF}/rentroom /unrent", HouseInfo[houseid][RentPrice]);
        strcat(housetext, housetextadd1);
    }
    GetPlayerPos(playerid, x, y, z);
    HouseLabel[houseid] = Create3DTextLabel(housetext, 0xFFFFFFFF, x, y, z, 10.0, 0, 0);
    housepickup[houseid] = CreatePickup(HouseInfo[houseid][Pickupid], 1, x, y, z, 0); // THIS ISN'T WORKING
    dini_FloatSet(file, "EnterX", x);
    dini_FloatSet(file, "EnterY", y);
    dini_FloatSet(file, "EnterZ", z);
    HouseInfo[houseid][EnterX] = x;
    HouseInfo[houseid][EnterY] = y;
    HouseInfo[houseid][EnterZ] = z;
    return 1;
}
When I use this command, everything works just fine, except the marked line.
I've debugged the command and it worked properly.

What am I doing wrong?
Reply
#2

Anyone?
Reply
#3

Do you get any errors/warnings during compiling?
Reply
#4

Umm, the array
Код:
 HouseInfo[houseid][Pickupid]
What does it contain? Because you should put the model of the pickup there, not the ID.
Reply
#5

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
Do you get any errors/warnings during compiling?
I only get a warning about not using strtok, but other than that none..

Quote:
Originally Posted by Mystique
Посмотреть сообщение
Umm, the array
Код:
 HouseInfo[houseid][Pickupid]
What does it contain? Because you should put the model of the pickup there, not the ID.
It holds the model ID, atleast that's how I call it. xD

EDIT: the housepickup[houseid] holds the pickup ID.
Reply
#6

Well explain why you use that variable at the DestroyPickup function? Because that parameter is about the real ID of the pickup, not the model ID.
Reply
#7

Quote:
Originally Posted by Mystique
Посмотреть сообщение
Well explain why you use that variable at the DestroyPickup function? Because that parameter is about the real ID of the pickup, not the model ID.
Oh.. that's why it doesn't destroy the pickup aswell. xD
One problem solved, lemme check if it fixes the one I made this thread for in the first place.

EDIT: I will edit this post in a few, lemme test a few things.

EDIT: Everything is working, thank you all.
Reply
#8

pawn Код:
CMD:movehouse(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] < 5) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not authorized to perform this command!");
    if(sscanf(params, "d", houseid)) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /movehouse [houseid]");
    format(file, sizeof(file), "Houses/House_%d.ini", houseid);
    if(!fexist(file)) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: The selected house is not implented in the server!");
    GetPlayerPos(playerid, x, y, z);
    Delete3DTextLabel(HouseLabel[houseid]);
    DestroyPickup(housepickup[houseid]);
    format(housetext, sizeof(housetext), "{1BBF39}[ House ID:{FFFFFF} %d{1BBF39} ]", houseid);
    if(strval(dini_Get(file, "Owned")) == 1)
    {
        format(aname, sizeof(aname), "%s", dini_Get(file, "Owner"));
        kreplace(aname, '_', ' ');
        format(housetextadd, sizeof(housetextadd), "\n{1BBF39}Owner:{FFFFFF} %s", aname);
        strcat(housetext, housetextadd);
    }
    if(strval(dini_Get(file, "ForSale")) == 1 && HouseInfo[houseid][Price] != 666)
    {
        format(housetextadd1, sizeof(housetextadd1), "\n{1BBF39}Price:{FFFFFF} %d", Value);
        strcat(housetext, housetextadd1);
    }
    if(HouseInfo[houseid][ForRent] == 1 && HouseInfo[houseid][RentPrice] != 666)
    {
        format(housetextadd1, sizeof(housetextadd1), "\n{1BBF39}Rent:{FFFFFF} %d\n{1BBF39}Commands: {FFFFFF}/rentroom /unrent", HouseInfo[houseid][RentPrice]);
        strcat(housetext, housetextadd1);
    }
    GetPlayerPos(playerid, x, y, z);
    HouseLabel[houseid] = Create3DTextLabel(housetext, 0xFFFFFFFF, x, y, z, 10.0, 0, 0);
    housepickup[houseid] = CreatePickup(HouseInfo[houseid][Pickupid], 1, x, y, z, 0); // THIS ISN'T WORKING
    dini_FloatSet(file, "EnterX", x);
    dini_FloatSet(file, "EnterY", y);
    dini_FloatSet(file, "EnterZ", z);
    HouseInfo[houseid][EnterX] = x;
    HouseInfo[houseid][EnterY] = y;
    HouseInfo[houseid][EnterZ] = z;
    return 1;
}
Reply
#9

Quote:
Originally Posted by Mystique
Посмотреть сообщение
pawn Код:
CMD:movehouse(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] < 5) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not authorized to perform this command!");
    if(sscanf(params, "d", houseid)) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /movehouse [houseid]");
    format(file, sizeof(file), "Houses/House_%d.ini", houseid);
    if(!fexist(file)) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: The selected house is not implented in the server!");
    GetPlayerPos(playerid, x, y, z);
    Delete3DTextLabel(HouseLabel[houseid]);
    DestroyPickup(housepickup[houseid]);
    format(housetext, sizeof(housetext), "{1BBF39}[ House ID:{FFFFFF} %d{1BBF39} ]", houseid);
    if(strval(dini_Get(file, "Owned")) == 1)
    {
        format(aname, sizeof(aname), "%s", dini_Get(file, "Owner"));
        kreplace(aname, '_', ' ');
        format(housetextadd, sizeof(housetextadd), "\n{1BBF39}Owner:{FFFFFF} %s", aname);
        strcat(housetext, housetextadd);
    }
    if(strval(dini_Get(file, "ForSale")) == 1 && HouseInfo[houseid][Price] != 666)
    {
        format(housetextadd1, sizeof(housetextadd1), "\n{1BBF39}Price:{FFFFFF} %d", Value);
        strcat(housetext, housetextadd1);
    }
    if(HouseInfo[houseid][ForRent] == 1 && HouseInfo[houseid][RentPrice] != 666)
    {
        format(housetextadd1, sizeof(housetextadd1), "\n{1BBF39}Rent:{FFFFFF} %d\n{1BBF39}Commands: {FFFFFF}/rentroom /unrent", HouseInfo[houseid][RentPrice]);
        strcat(housetext, housetextadd1);
    }
    GetPlayerPos(playerid, x, y, z);
    HouseLabel[houseid] = Create3DTextLabel(housetext, 0xFFFFFFFF, x, y, z, 10.0, 0, 0);
    housepickup[houseid] = CreatePickup(HouseInfo[houseid][Pickupid], 1, x, y, z, 0); // THIS ISN'T WORKING
    dini_FloatSet(file, "EnterX", x);
    dini_FloatSet(file, "EnterY", y);
    dini_FloatSet(file, "EnterZ", z);
    HouseInfo[houseid][EnterX] = x;
    HouseInfo[houseid][EnterY] = y;
    HouseInfo[houseid][EnterZ] = z;
    return 1;
}

Ye, well the problem was not only in the movehouse command. It was with all my house related commands, I just forgot what HouseInfo.. pickupid was for. I fixed it all. Though thank you for trying to help!
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)