ok well the command goes back after i type /buyhouse entrance works but with /buyhouse level sends the buyhouse message again and so does same thing if i use /buyhouse level 1 can someone fix this for me? thanks
Код:
CMD:buyhouse(playerid, params[])
{
if(PlayerInfo[playerid][pOwnsHouse] != 1)
{
SendClientMessage(playerid, WHITE, "Stand where you wish your house entrance to be and type /buyhouse entrance.");
SendClientMessage(playerid, WHITE, "Please choose an appropriate and realistic location for your house.");
SendClientMessage(playerid, RED, "Administration will be notified and WILL DELETE YOUR HOUSE WITHOUT REFUND");
SendClientMessage(playerid, RED, "if it is placed in an inappropriate location.");
}
else if(PlayerInfo[playerid][pOwnsHouse] = 1)
{
SendClientMessage(playerid, RED, "You Allready Own a House");
}
if(strcmp(params, "entrance", true) == 0)
{
if(PlayerInfo[playerid][pGotEntrance] != 0) return SendClientMessage(playerid,RED,"You've already placed your house entrance.");
else if(GetPlayerInterior(playerid) != 0) return SendClientMessage(playerid,WHITE,"You have to be outside to make a entrance."), SendClientMessage(playerid,WHITE,"If this is a error in the script, please Contact a Admin/Scripter.");
else if(GetPlayerMoney(playerid) <= 49999) return SendClientMessage(playerid,WHITE,"You need atleast $50,000 to buy a house.");
else
{
SendClientMessage(playerid, WHITE, "Your house entrance has been placed. If you placed it wrong, stand in the");
SendClientMessage(playerid, WHITE, "appropriate place and type /buyhouse entrance again. Otherwise, type" );
SendClientMessage(playerid, GREEN, "Type /buyhouse level [level you want]. Level must exceed your character level.");
SendClientMessage(playerid, WHITE, "Houses cost $50000 per level. Doing this will confirm the purchase of your house.");
SendClientMessage(playerid, RED, "If you do not wish to purchase a house, type /buyhouse cancel now.");
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerInfo[playerid][pHouseX] = Float:pX; // The co-ords for House enter
PlayerInfo[playerid][pHouseY] = Float:pY; // The co-ords for House enter
PlayerInfo[playerid][pHouseZ] = Float:pZ; // The co-ords for House enter
PlayerInfo[playerid][pEnterHouse] = 0;
PlayerInfo[playerid][pMakingHouse] = 1;
}
}
else if(strcmp(params, "level", true) == 0)
{
SendClientMessage(playerid, WHITE, "Type /buyhouse level [level you want]. Level must exceed your character level.");
SendClientMessage(playerid, WHITE, "Houses cost $50000 per level. Doing this will confirm the purchase of your house.");
SendClientMessage(playerid, WHITE, "If you do not wish to purchase a house, type /buyhouse cancel now.");
return 1;
}
if(strcmp(params, "1", true) == 0)
{
new mylevel = PlayerInfo[playerid][pHouseLevel];
new Range = 1-mylevel;
new cost = Range*50000;
if(GetPlayerMoney(playerid) < cost) return SendClientMessage(playerid,WHITE,"You can't afford a house of that level!");
GivePlayerMoney(playerid,-cost);
PlayerInfo[playerid][pEnterHouse] = 1;
SendClientMessage(playerid, WHITE, "Congratulations! You have purchased a level 1 house for $50,000");
SendClientMessage(playerid, WHITE, "type /househelp for a list of the housing commands.");
new VirtualWorldHouse = 1 + random(255); // Random number for VW
PlayerInfo[playerid][pHouseVW] = VirtualWorldHouse; // The Virtual World for House Interior
PlayerInfo[playerid][pHouseIntX] = 244.411987;// The co-ords for House Interior
PlayerInfo[playerid][pHouseIntY] = 305.032989;// The co-ords for House Interior
PlayerInfo[playerid][pHouseIntZ] = 999.148437;// The co-ords for House Interior
PlayerInfo[playerid][pHouseInt] = 1;// The Interor id for House Interior
PlayerInfo[playerid][pHouseLevel] = 1;// house level
PlayerInfo[playerid][pGotCar] = 1;
PlayerInfo[playerid][pMakingHouse] = 0;
PlayerInfo[playerid][pHouseSpawn] = 1;
PlayerInfo[playerid][pOwnsHouse] = 1;
LoadHouseCars(playerid);
return 1;
}
return 1;
}