house help
#1

Hello everybody no one palm me for this post but it's my first scripting help post i do since i joined the forum so please try to be helpful

i have gagi house system when i buy house and /changespawn then sell the house the and relog i back to the place in my hosue that i sold what i need ? i want anybody help me to make it when i sell house it disable /changespawn and return to the normal spawn
Reply
#2

Can you post your '/changespawn' command code and 'public OnPlayerSpawn' and 'sell house code'? You need to reset the player's house value's and the house values (in the file and/or variables) to prevent the player from spawning in the house coordinates, I'm guessing.
Reply
#3

Well, as ABKPot has stated, /changespawn is changing the value of a variable so the script knows where to spawn the player. So you need to set the owner's new spawn to the default spawn you want them to spawn, otherwise the server is going to still assign the same spawn location.
Reply
#4

AFKPot

this is the info's that you aske me to post them

Код:
YCMD:changespawn(playerid, params[], help)
{
        #pragma unused help
        #pragma unused params
    	new id = Player[playerid][Houseid];
		if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house");
		if(!IsPlayerInRangeOfPoint(playerid,3.0,House[id][ExitX],House[id][ExitY],House[id][ExitZ])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You must be in your house.");
		    Player[playerid][Spawn] = 1;
			Player[playerid][SpawnX] = House[id][ExitX];
			Player[playerid][SpawnY] = House[id][ExitY];
			Player[playerid][SpawnZ] = House[id][ExitZ];
			Player[playerid][SpawnInt] = House[id][IntID];
			Player[playerid][SpawnVW] = House[id][VW];
			SCM(playerid,-1,"Spawn has been changed to a specific location.");
		return 1;
}
this Public onplayerspawn

Код:
public OnPlayerSpawn(playerid)
{
	new Random = random(sizeof(RandomSpawns));
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);



	SetPlayerAttachedObject(playerid, 3, 1609, 2); //Attach a turtle to the playerid's head, in slot 3
	// example of using colors on an object being attached to the player:
	SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFF00FF00);

    PlayerInfo[playerid][SpawnDance] = true; //to not execute to much timers
    KillTimer( PlayerInfo[playerid][SpawnTimer] ); //to kill it, since its useless now
    PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0); // (blank sound) to shut the music up
    SetCameraBehindPlayer(playerid); //to prevent some bugs


if(Player[playerid][Spawn] == 1)
{
	SetPlayerPos(playerid,Player[playerid][SpawnX],Player[playerid][SpawnY],Player[playerid][SpawnZ]);
	SetPlayerInterior(playerid,Player[playerid][SpawnInt]);
	SetPlayerVirtualWorld(playerid,Player[playerid][SpawnVW]);
}

	return 1;
sell command is in dialog so i will give you all the dialog info

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
			case DIALOG_HOUSE:
			{
            if(!response) return 1;
			new
				string[200];
				switch(listitem)
				{
				case 0: {
    			new id = Player[playerid][Houseid];
				if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have a house");
				if(!IsPlayerInRangeOfPoint(playerid,3.0,House[id][EnterX],House[id][EnterY],House[id][EnterZ])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not near your house");
				format(House[id][Owner], 32, "Apartment");
				if(House[id][hCar] > 0) format(HouseOwner[House[id][hCar]],64,"Apartment");
				House[id][On_Sell] = 1;
				Player[playerid][Houseid] = 999;
				GivePlayerMoney(playerid,House[id][Price]/2);
				DestroyDynamicPickup(House[id][PickupU]);
				House[id][PickupU] = CreateDynamicPickup(1273, 23,  House[id][EnterX],House[id][EnterY],House[id][EnterZ],-1,-1,-1,100.0);
				DestroyDynamicMapIcon(House[id][Icon]);
				House[id][Icon] = CreateDynamicMapIcon(House[id][EnterX],House[id][EnterY],House[id][EnterZ], 31, 0, -1, -1, -1, 100.0);
				CheckHouse(id);
				UpdatePlayerInformation(playerid);
				format(string,sizeof(string),"{29CC3F}Owner: "COL_WHITE"Apartment\n{29CC3F}House Name: "COL_WHITE"%s\n{29CC3F}Price: "COL_WHITE"%d\n{29CC3F}Level: "COL_WHITE"%d\n{29CC3F}Address: "COL_WHITE"%s\n (/buyhouse)",House[id][HouseName],House[id][Price],House[id][Level],House[id][Address]);
        		UpdateDynamic3DTextLabelText(House[id][DLabel],-1,string);
				}
				case 1: {
				ShowPlayerDialog(playerid,DIALOG_HOUSE+1,DIALOG_STYLE_INPUT,"Rent house","Type rent price","Put","Close"); }
				case 2:
				{
				new id = Player[playerid][Houseid];
				foreach (Player, i)
				{
					if(i != playerid)
					{
					if(strcmp(House[id][Player_Rent],GetName(playerid), false ) == 0) {SCM(i,COLOR_RED,"You have been evicted from house");}
					format(House[id][Player_Rent],48,"Nobody");
					}
					}
					}
				case 3: {
						ShowPlayerDialog(playerid,DIALOG_HOUSE+2,DIALOG_STYLE_INPUT,"House name",""COL_WHITE"Type new name of house","Name","Close");
						}
				case 4: {
						ShowPlayerDialog(playerid,DIALOG_HOUSE+3,DIALOG_STYLE_INPUT,"Lock Password (numbers only)",""COL_WHITE"Type new password","Insert","Close");
						}
					}
				}
		   case DIALOG_HOUSE+1:
		   {
			if(!response) return 1;
			new string[210];
			new id = Player[playerid][Houseid];
			if(strval(inputtext) <= 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Price can't be less 1");
			House[id][RentPrice] = strval(inputtext);
			format(string,sizeof(string),"New rent price is $%d",strval(inputtext)); SCM(playerid,-1,string);
			format(string,sizeof(string),"{E0BC1B}Owner: "COL_WHITE"%s\n{E0BC1B}House name: "COL_WHITE"%s\n{E0BC1B}Price: "COL_WHITE"%d\n{E0BC1B}Level: "COL_WHITE"%d\n{E0BC1B}Rent price: "COL_WHITE"%d\n{E0BC1B}Address: "COL_WHITE"%s\n (/renthouse)",House[id][Owner],House[id][HouseName],House[id][Price],House[id][Level],House[id][RentPrice],House[id][Address]);
        	UpdateDynamic3DTextLabelText(House[id][DLabel],-1,string);
			CheckHouse(id);
		   }
		   case DIALOG_HOUSE+2:
		   {
			if(!response) return 1;
			new string[210];
			new id = Player[playerid][Houseid];
			format(House[id][HouseName], 32, "%s", inputtext);
			format(string,sizeof(string),"{E0BC1B}Owner: "COL_WHITE"%s\n{E0BC1B}House name: "COL_WHITE"%s\n{E0BC1B}Price: "COL_WHITE"%d\n{E0BC1B}Level: "COL_WHITE"%d\n{E0BC1B}Rent price: "COL_WHITE"%d\n{E0BC1B}Address: "COL_WHITE"%s\n (/renthouse)",House[id][Owner],House[id][HouseName],House[id][Price],House[id][Level],House[id][RentPrice],House[id][Address]);
        	UpdateDynamic3DTextLabelText(House[id][DLabel],-1,string);
			CheckHouse(id);
		   }
		   case DIALOG_HOUSE+3:
		   {
			if(!response) return 1;
			new string[128];
			new id = Player[playerid][Houseid];
			if(strlen(inputtext) >= 5 || strlen(inputtext) < 4) return ShowPlayerDialog(playerid,DIALOG_HOUSE+3,DIALOG_STYLE_INPUT,""COL_WHITE"Lock Password","Type new password","Insert","Close"),SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just four numbers");
			format(House[id][LockPass],5,"%d",strval(inputtext));
			format(string,sizeof(string),"New password is %d",strval(inputtext)); SCM(playerid,-1,string);
			CheckHouse(id);
		   }
		   }
	return 1;
}
Quote:
Originally Posted by nmader
Посмотреть сообщение
Well, as ABKPot has stated, /changespawn is changing the value of a variable so the script knows where to spawn the player. So you need to set the owner's new spawn to the default spawn you want them to spawn, otherwise the server is going to still assign the same spawn location.

i don't understand what do you mean ? can you explain more ?
Reply
#5

This should work:

pawn Код:
public OnPlayerSpawn(playerid)
{
    new Random = random(sizeof(RandomSpawns));
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);

    SetPlayerAttachedObject(playerid, 3, 1609, 2); //Attach a turtle to the playerid's head, in slot 3
    // example of using colors on an object being attached to the player:
    SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFF00FF00);

    PlayerInfo[playerid][SpawnDance] = true; //to not execute to much timers
    KillTimer( PlayerInfo[playerid][SpawnTimer] ); //to kill it, since its useless now
    PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0); // (blank sound) to shut the music up
    SetCameraBehindPlayer(playerid); //to prevent some bugs


    new houseid = Player[playerid][Houseid];
    if(Player[playerid][Spawn] == 1 && houseid != 999)
    {
        SetPlayerPos(playerid,Player[playerid][SpawnX],Player[playerid][SpawnY],Player[playerid][SpawnZ]);
        SetPlayerInterior(playerid,Player[playerid][SpawnInt]);
        SetPlayerVirtualWorld(playerid,Player[playerid][SpawnVW]);
    }
    return 1;
}
Reply
#6

let me test it

Edit : thanks brother your code is working with me now i can say this topic can be locked and move to archive and thanks for help brother i'll rep you
Reply
#7

Alright, np.. Thanks for the rep, btw!
Reply
#8

AFKpot i was testing your codes and i found bug in the codes you gave me, the code you gave me made the script do the following (when i buyhouse and changespawn then sell that house and buy new house without using changespawn command it spawn me in the old house spawn that i had before this house and i don't want this) what i want when i buy new house and didn't use /changehouse yet use the normal spawn
Reply
#9

How about this? I think this is what you mean.

pawn Код:
public OnPlayerSpawn(playerid)
{
    new Random = random(sizeof(RandomSpawns));
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);

    SetPlayerAttachedObject(playerid, 3, 1609, 2); //Attach a turtle to the playerid's head, in slot 3
    // example of using colors on an object being attached to the player:
    SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFF00FF00);

    PlayerInfo[playerid][SpawnDance] = true; //to not execute to much timers
    KillTimer( PlayerInfo[playerid][SpawnTimer] ); //to kill it, since its useless now
    PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0); // (blank sound) to shut the music up
    SetCameraBehindPlayer(playerid); //to prevent some bugs


    new houseid = Player[playerid][Houseid];
    if(Player[playerid][Spawn] == 1 && houseid != 999) //The player is spawning, and player owns a house
    {
        SetPlayerPos(playerid,Player[playerid][SpawnX],Player[playerid][SpawnY],Player[playerid][SpawnZ]);
        SetPlayerInterior(playerid,Player[playerid][SpawnInt]);
        SetPlayerVirtualWorld(playerid,Player[playerid][SpawnVW]);
    }
    else if(houseid == 999 || Player[playerid][Spawn] == 0) //Player doesnt have a house or is not spawning...
    {
        new Random = random(sizeof(RandomSpawns));
        SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
        SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
    }
    return 1;
}
Reply
#10

yea this what i want thanks bro also check your forum pm inbox
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)