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; }
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;
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; }
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.
|
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;
}
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;
}