[help] buyable interior system
#4

pawn Код:
if(dialogid == lista_interior)
    {
        if(response)
        {
            for(new i = 0; i < MAX_CASE; i++)
            {
                new nome[24];
                GetPlayerName(playerid,nome,sizeof(nome));
                if(cinfo[i][acquisita] == 1 && strcmp(cinfo[i][proprietario],nome) == 0)
                {
                    switch(listitem)
                    {
                        case 0 :
                        {
                            cinfo[i][posxu] = 2324.33;
                            cinfo[i][posyu] = -1144.79;
                            cinfo[i][poszu] = 1050.71;
                            cinfo[i][interior] = 1
                            cinfo[i][virtualworld] = GetPlayerVirtualWorld(playerid);
                            new file[40];
                            format(file,sizeof(file),"case/%i.ini",i);
                            INI_Open(file);
                            INI_WriteInt("Interior",cinfo[i][interior]);
                            INI_WriteInt("VW",GetPlayerVirtualWorld(playerid));
                            INI_WriteFloat("Posxu",cinfo[i][posxu]);
                            INI_WriteFloat("Posyu",cinfo[i][posyu]);
                            INI_WriteFloat("Posyu",cinfo[i][poszu]);
                            INI_Save();
                            INI_Close();
                        GivePlayerMoney(playerid,-50000);
                            caricacase();
                            return 1;
                        }
                    }
                    return 1;
                }
                return 1;
            }
            return 1;
        }
        return 1;
    }
    return 0;
}
even if the coordinates are correct i spawn in air.
may be that the problem is due to the declaretion of SetPVarInt on this callback?


pawn Код:
public OnPlayerEnterDynamicCP(playerid,checkpointid)
{
    for(new i = 0; i < MAX_CASE; i++)
    {
        if(checkpointid == casaentrata[i])
        {
            new nome[24];
            GetPlayerName(playerid,nome,24);
            if(cinfo[i][acquisita] == 1 && strcmp(cinfo[i][proprietario],nome) == 0)
            {
                SetPVarInt(playerid,"PlayersInteriorCasa",GetPlayerInterior(playerid));
                SetPVarInt(playerid,"PlayersVWCasa",GetPlayerVirtualWorld(playerid));
                SendClientMessage(playerid,-1,"[SERVER] /join for to join in this house");
            }

            if(cinfo[i][acquisita] == 1 && strcmp(cinfo[i][proprietario],nome) != 0)
            {
                SendClientMessage(playerid,-1,"[SERVER] You can't own this house");
            }

            if(cinfo[i][acquisita] == 0)
            {
                SendClientMessage(playerid,-1,"[SERVER] /buy to buy this house");
            }
        }

        if(checkpointid == casauscita[i])
        {
            SetPlayerPos(playerid,cinfo[i][posx]+3,cinfo[i][posy],cinfo[i][posz]);
            SetPlayerInterior(playerid,GetPVarInt(playerid,"PlayersInteriorCasa"));
            SetPlayerVirtualWorld(playerid,GetPVarInt(playerid,"PlayerVWCasa"));
        }
    }
    return 1;
}
create house command

pawn Код:
CMD:chouse(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"[SERVER] You aren't an admin!");
    new prezzocasa, id = contocase;
    if(sscanf(params,"i", prezzocasa)) return SendClientMessage(playerid,-1,"[SERVER]USAGE: /chouse [price]");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid,x,y,z);
    cinfo[id][prezzo] = prezzocasa;
    cinfo[id][acquisita] = 0;
    cinfo[id][chiusa] = 1;
    cinfo[id][soldi] = 0;
    cinfo[id][interior] = 12;
    cinfo[id][posx] = x;
    cinfo[id][posy] = y;
    cinfo[id][posz] = z;
    cinfo[id][posxu] = 443.9237;
    cinfo[id][posyu] = 509.4609;
    cinfo[id][poszu] = 1001.4195;
    cinfo[id][virtualworld] = GetPlayerVirtualWorld(playerid);
    format(cinfo[id][proprietario],24,"Nonusablenameforthishouse");
    SendClientMessage(playerid,-1,"[SERVER] House Created");
    casaentrata[id] = CreateDynamicCP(x,y,z,1.5,GetPlayerVirtualWorld(playerid));
    casauscita[id] = CreateDynamicCP(cinfo[id][posxu],cinfo[id][posyu],cinfo[id][poszu],1.5,GetPlayerVirtualWorld(playerid));
    new file[40],labelstringa[100];
    format(file,sizeof(file),"case/%i.ini",id);
    INI_Open(file);
    INI_WriteInt("Prezzo",prezzocasa);
    INI_WriteInt("Acquisita",0);
    INI_WriteInt("Chiusa",1);
    INI_WriteInt("Soldi",cinfo[id][soldi]);
    INI_WriteInt("Interior",cinfo[id][interior]);
    INI_WriteInt("VW",GetPlayerVirtualWorld(playerid));
    INI_WriteFloat("Posx",x);
    INI_WriteFloat("Posy",y);
    INI_WriteFloat("Posz",z);
    INI_WriteFloat("Posxu",443.9237);
    INI_WriteFloat("Posyu",509.4609);
    INI_WriteFloat("Poszu",1001.4195);
    INI_WriteString("Proprietario","Nonusablenameforthishouse");
    INI_Save();
    INI_Close();
    format(labelstringa,sizeof(labelstringa),"Owned: No \nPrice: %i",prezzocasa);
    cinfo[id][labelinfo] = Create3DTextLabel(labelstringa,0xFF0000FF,x,y,z,25.0,GetPlayerVirtualWorld(playerid));
    contocase++;
    return 1;
}
when i create the house, and type the command /join it works perfectly.. and spawn me in the house but when i try to change the interior by dialog and type /join don't works and i spawn in the air.
Reply


Messages In This Thread
[help] buyable interior system - by Galletziz - 18.04.2014, 17:48
Re: [help] buyable interior system - by Galletziz - 18.04.2014, 18:31
Re: [help] buyable interior system - by Konstantinos - 18.04.2014, 19:22
Re: [help] buyable interior system - by Galletziz - 18.04.2014, 19:36
Re: [help] buyable interior system - by Konstantinos - 18.04.2014, 19:40
Re: [help] buyable interior system - by Galletziz - 18.04.2014, 19:46
Re: [help] buyable interior system - by Konstantinos - 18.04.2014, 20:02
Re: [help] buyable interior system - by Galletziz - 18.04.2014, 20:06
Re: [help] buyable interior system - by Galletziz - 18.04.2014, 20:16
Re: [help] buyable interior system - by Konstantinos - 18.04.2014, 20:31

Forum Jump:


Users browsing this thread: 3 Guest(s)