30.12.2009, 14:18
Hey,i wanted to make textlabels to houses,but the prob is when i want to sell it,the new one wont appear what should come,
heres the command
heres the command
pawn Код:
if(strcmp(cmd, "/sellhouse", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pPhousekey] == 255)
{
SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
return 1;
}
if(PlayerInfo[playerid][pMarried] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " You are Married, can't sell the House !");
return 1;
}
if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
{
Delete3DTextLabel(Text3D:houseowned);
new house = PlayerInfo[playerid][pPhousekey];
HouseInfo[house][hHel] = 0;
HouseInfo[house][hArm] = 0;
HouseInfo[house][hHealthx] = 0;
HouseInfo[house][hHealthy] = 0;
HouseInfo[house][hHealthz] = 0;
HouseInfo[house][hArmourx] = 0;
HouseInfo[house][hArmoury] = 0;
HouseInfo[house][hArmourz] = 0;
HouseInfo[house][hLock] = 1;
HouseInfo[house][hOwned] = 0;
HouseInfo[house][hVec] = 418;
HouseInfo[house][hVcol1] = -1;
HouseInfo[house][hVcol2] = -1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
//ConsumingMoney[playerid] = 1;
SafeGivePlayerMoney(playerid,HouseInfo[house][hValue]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d",HouseInfo[house][cValue] );
GameTextForPlayer(playerid, string, 10000, 3);
format(string1, sizeof(string), "[SALE]\n$ %d",HouseInfo[house][hValue]);
housesale = Create3DTextLabel(string1,0x006400FF,HouseInfo[house][hEntrancex], HouseInfo[house][hEntrancey], HouseInfo[house][hEntrancez]+1,15,0,1);
PlayerInfo[playerid][pPhousekey] = 255;
if(PlayerInfo[playerid][pLocal] == house)
{
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetPlayerPos(playerid,HouseInfo[house][hEntrancex],HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez]);
PlayerInfo[playerid][pInt] = 0;
}
Delete3DTextLabel(Text3D:houseowned);
OnPropUpdate();
OnPlayerUpdate(playerid);
format(string1, sizeof(string), "[SALE]\n$ %d",HouseInfo[house][hValue]);
housesale = Create3DTextLabel(string1,0x006400FF,HouseInfo[house][hEntrancex], HouseInfo[house][hEntrancey], HouseInfo[house][hEntrancez]+1,15,0,1);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't own a house.");
}
}
return 1;
}