[help] buyable interior system -
Galletziz - 18.04.2014
Hi, i have created an buyable interior system and this is the code, so when the player choises the case 0, the file of the house gone open, and the parameters gone changed, but, i don't know what is the virtual world of the interior..
how do to know it ?! з_з
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] = ?;
new file[40];
format(file,sizeof(file),"case/%i.ini",i);
INI_Open(file);
INI_WriteInt("Interior",cinfo[i][interior]);
INI_WriteInt("VW",?);
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;
}
Re: [help] buyable interior system -
Galletziz - 18.04.2014
Nobody knows the solution ? з_з
Re: [help] buyable interior system -
Konstantinos - 18.04.2014
The interiorid must be 12 for those coordinates. The virtual world ID can be anything you want, it's up to you.
Re: [help] buyable interior system -
Galletziz - 18.04.2014
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.
Re: [help] buyable interior system -
Konstantinos - 18.04.2014
You set the interior to 1 instead of 12.
Re: [help] buyable interior system -
Galletziz - 18.04.2014
Yes because the interior is different.. have you skype I can do a screen sharing so you understand..
thanks
Re: [help] buyable interior system -
Konstantinos - 18.04.2014
X -> 2324.33
Y -> -1144.79
Z -> 1050.71
and
X -> 443.9237
Y -> 509.4609
Z -> 1001.4195
The above coordinates are for interiorid 12. Any other interior will make the player fall from the sky.
What's one is the /join command?
Re: [help] buyable interior system -
Galletziz - 18.04.2014
pawn Код:
CMD:join(playerid,params[])
{
for(new i = 0; i < MAX_CASE; i++)
{
new nome[24];
GetPlayerName(playerid,nome,24);
if(IsPlayerInRangeOfPoint(playerid,4.0,cinfo[i][posx],cinfo[i][posy],cinfo[i][posz]))
{
if(cinfo[i][acquisita] == 1 && strcmp(cinfo[i][proprietario],nome) == 0)
{
SetPlayerInterior(playerid,cinfo[i][interior]);
SetPlayerPos(playerid,cinfo[i][posxu]+3,cinfo[i][posyu],cinfo[i][poszu]);
SetPlayerVirtualWorld(playerid,cinfo[i][virtualworld]);
playerincasaid[playerid] = 1;
}
else if(cinfo[i][acquisita] == 1 && strcmp(cinfo[i][proprietario],nome) != 0)
{
if(cinfo[i][chiusa] == 1) return SendClientMessage(playerid,-1,"[SERVER] You can't join in this house because it is closed.");
if(cinfo[i][chiusa] == 0)
{
SetPlayerInterior(playerid,cinfo[i][interior]);
SetPlayerPos(playerid,cinfo[i][posxu]+3,cinfo[i][posyu],cinfo[i][poszu]);
SetPlayerVirtualWorld(playerid,cinfo[i][virtualworld]);
playerincasaid[playerid] = 1;
}
}
}
else
{
SendClientMessage(playerid,-1,"[SERVER] You aren't near a house");
}
return 1;
}
return 1;
}
Re: [help] buyable interior system -
Galletziz - 18.04.2014
I think that you havn't understood.
Admin create house, when house goes create the interior id is 12.
When player buy a house the house is the interior id 12 but if he press space, he can buy other interior with dialog list interiors. when he choise case 0 (for exemple) i want that the interior change for the interior that i set. Obviusly i set the x y z of the exit of the new interior setted so the player when type /join spawn in coords.
Re: [help] buyable interior system -
Konstantinos - 18.04.2014
It seems to me that you change only the interiorid but not the correct coordinates for that interior as well. Post the part of code that sets the new interior a player selects + the new coordinates.