27.03.2011, 13:01
hey, im having this problem like when people enter a cp, i want it to show
the dialog bit shows, but then if there is a response they click buy nothing happenes
iv even tried print...
here is my code
the dialog bit shows, but then if there is a response they click buy nothing happenes
iv even tried print...
here is my code
pawn Код:
public OnPlayerEnterDynamicCP(playerid,checkpointid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
for(new i = 0; i < MAX_HOUSES; i++)
{
if(checkpointid == Checkpoint[i])
{
if(HInfo[i][owned] == 0)
{
new string[200];
format(string,sizeof(string),"This house is up for sale for $%i",HInfo[i][price]);
ShowPlayerDialog(playerid,2693,0,"Buy house",string,"Buy","Cancel");
SetPVarInt(playerid,"InHouseID",i);
break;
}
else if(strcmp(HInfo[i][owner],pName,true) == 1)
{
SetPlayerInterior(playerid,HInfo[i][interior]);
SetPlayerVirtualWorld(playerid,HInfo[i][world]);
SetPlayerPos(playerid,HInfo[i][telex],HInfo[i][teley],HInfo[i][telez]);
break;
}
}
}
}
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2693)
{
new pName[MAX_PLAYER_NAME],file[200],string[200];
if(GetPlayerMoney(playerid) < HInfo[GetPVarInt(playerid,"InHouseID")][price]) return SendClientMessage(playerid,red,"You dont have enough cash for this house");
HInfo[GetPVarInt(playerid,"InHouseID")][owned] = 1;
format(file,sizeof(file),"FHouse/houses/%i.ini",GetPVarInt(playerid,"InHouseID"));
GetPlayerName(playerid,pName,sizeof(pName));
strmid(HInfo[GetPVarInt(playerid,"InHouseID")][owner],pName,0,strlen(pName),255);
SetPlayerInterior(playerid,HInfo[GetPVarInt(playerid,"InHouseID")][interior]);
SetPlayerVirtualWorld(playerid,HInfo[GetPVarInt(playerid,"InHouseID")][world]);
SetPlayerPos(playerid,HInfo[GetPVarInt(playerid,"InHouseID")][telex],HInfo[GetPVarInt(playerid,"InHouseID")][teley],HInfo[GetPVarInt(playerid,"InHouseID")][telez]);
GivePlayerMoney(playerid,-HInfo[GetPVarInt(playerid,"InHouseID")][price]);
INI_Open(file);
HInfo[GetPVarInt(playerid,"InHouseID")][owned] = 1;
INI_WriteInt("Owned",1);
INI_WriteString("Owner",HInfo[GetPVarInt(playerid,"InHouseID")][owner]);
INI_Save();
INI_Close();
format(string,sizeof(string),"Owned by: %s \nHouse cost: %i \nID: %i",pName,HInfo[GetPVarInt(playerid,"InHouseID")][price],GetPVarInt(playerid,"InHouseID"));
Update3DTextLabelText(HInfo[GetPVarInt(playerid,"InHouseID")][label],0x00FF40FF,string);
print("readed!");
}
return 1;
}