Problema House Spawn
#1

Salutare sunt nou pe aceasta comunitate si nou in scripting as avea si eu o problema cu un gm .. lucrez la el de ceva vreme totul bine si frumos pana acum cateva zile cand am implementat PPC_House .

Acest system are functia urmatoare

Код:
new bool:SpawnAtHouse = true;
Ei bine nu prea functioneaza .. asa cum mi-am dorit, eu unu cred ca-i din OnPlayerSpawn si probabil este in conflict cu gm-ul meu .. si m-am cam blocat la aceasta faza ... va rog sa ma ajutati .

Acesta este OnPlayerSpawn din fs ( PPC_House )

Код:
// This callback gets called when a player spawns somewhere
public OnPlayerSpawn(playerid)
{
	// Setup local variables
	new HouseID;

	// Reset the HouseID where the player is located
	APlayerData[playerid][CurrentHouse] = 0;

	// If SpawnAtHouse is set to "true", re-position the player at the first house in his list of owned houses
	if (SpawnAtHouse == true)
	{
		// Get the first HouseID in your list of owned houses
		HouseID = APlayerData[playerid][Houses][0];
		// Check if the player has a house in this first slot
		if (HouseID != 0)
		{
			// Re-position the player at the house's coordinates
			SetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]);
		}
	}

	return 1;
}

// This callback gets called whenever a player dies
public OnPlayerDeath(playerid, killerid, reason)
{
	// Reset the HouseID where the player is located
	APlayerData[playerid][CurrentHouse] = 0;

	return 1;
}

// This callback gets called when the player is selecting a class (but hasn't clicked "Spawn" yet)
public OnPlayerRequestClass(playerid, classid)
{
	// Reset the HouseID where the player is located
	APlayerData[playerid][CurrentHouse] = 0;

	return 1;
}

// This callback is called when the player attempts to spawn via class-selection
public OnPlayerRequestSpawn(playerid)
{
	// Reset the HouseID where the player is located
	APlayerData[playerid][CurrentHouse] = 0;

    return 1;
}
Acesta este OnPlayerSpawn din GM

Код:
public OnPlayerSpawn(playerid)
{
    if(TurfInfo[1][Owner] == 6)
	{
	   	GangZoneShowForPlayer(playerid,TurfID[1], 0x006C0090);
	   	if(TurfAttackedLY == 1)
		{
		    if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
		    {
		    	GangZoneFlashForPlayer(playerid, TurfID[1], 0xFF0000C7);
		    	InRWarPlayer[playerid] = 1;
			}
		}
	}
	if(TurfInfo[1][Owner] == 5)
	{
		GangZoneShowForPlayer(playerid,TurfID[1], 0xFF680090);
	   	if(TurfAttackedLY == 1)
		{
		    if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
		    {
		    	GangZoneFlashForPlayer(playerid, TurfID[1], 0xFF0000C7);
		    	InRWarPlayer[playerid] = 1;
			}
		}
	}
	if(TurfInfo[2][Owner] == 13)
	{
		GangZoneShowForPlayer(playerid,TurfID[2], 0xFFA8D38E);
	   	if(TurfAttackedCB == 2)
		{
		    if(PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12 || PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
		    {
		    	GangZoneFlashForPlayer(playerid, TurfID[2], 0xFF0000C7);
		    	InRWarPlayer[playerid] = 1;
			}
		}
	}
	if(TurfInfo[2][Owner] == 12)
	{
		GangZoneShowForPlayer(playerid,TurfID[2], 0x003C7B88);
	   	if(TurfAttackedCB == 2)
		{
		    if(PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12 || PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
		    {
		    	GangZoneFlashForPlayer(playerid, TurfID[2], 0xFF0000C7);
		    	InRWarPlayer[playerid] = 1;
			}
		}
	}
	if(TurfInfo[3][Owner] == 14)
	{
		GangZoneShowForPlayer(playerid,TurfID[3], 0x48F1FF97);
	   	if(TurfAttackedSN == 3)
		{
		    if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14 || PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pLeader] == 15)
		    {
		    	GangZoneFlashForPlayer(playerid, TurfID[3], 0xFF0000C7);
		    	InRWarPlayer[playerid] = 1;
			}
		}
	}
	if(TurfInfo[3][Owner] == 15)
	{
		GangZoneShowForPlayer(playerid,TurfID[3], 0xFFB50093);
	   	if(TurfAttackedSN == 3)
		{
		    if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14 || PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pLeader] == 15)
		    {
		    	GangZoneFlashForPlayer(playerid, TurfID[3], 0xFF0000C7);
		    	InRWarPlayer[playerid] = 1;
		    }
		}
	}
    if(PlayerInfo[playerid][pCash] + PlayerInfo[playerid][pAccount] >= 200000000)
	{
	    AC_BS_ResetPlayerMoney(playerid);
	    PlayerInfo[playerid][pAccount] = 0;
	    SendClientMessage(playerid, COLOR_WHITE,"{FFFF00}Server: {FFFFFF}Pentru ca ai mai mult de {00FF40}200.000.000$ {FFFFFF}Money Cash & Bank o sa ai bani pe {FF0000}0$");
	}
	if(gPlayerAccount[playerid] == 1)
	{
    	SendClientMessage(playerid, COLOR_WHITE, "{31CFFF}Anti-SpawnKill: {FFFFFF}Ai fost blocat timp de {F3FF02}3 Secunde {FFFFFF}!");
		TogglePlayerControllable(playerid, 0);
		SetTimerEx("AntiSpawnKill",3000,0,"d", playerid);
	}
	InitLockDoors(playerid);
	STDPlayer[playerid] = 0;
	TextDrawShowForPlayer(playerid, Date);
	TextDrawShowForPlayer(playerid, Time);
 	TextDrawShowForPlayer(playerid, Logo);
	TextDrawShowForPlayer(playerid, Nume[playerid]);
	new wanted = WantedLevel[playerid];
 	SetPlayerWantedLevel(playerid, wanted);
 	if (PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
	{
		gTeam[playerid] = 2;
		PlayerInfo[playerid][pTeam] = 2;
	}
Reply
#2

Ce nu functioneaza ?
Reply
#3

Nu functioneaza spawn-ul .. in mod normal ar trebui sa-mi dea spawn la casa cumparata pe care o detin .. dar imi da spawn, in pd de exemplu daca sunt in PD , este doar un exemplu .
Reply
#4

ai functia setplayerspawn in gamemode ? daca da asta e cauza problemei tale
Reply
#5

Am gasit ceva legat de "setplayerspawn" in gm .. dar nu sunt sigur ca despre asta vorbesti imi poti da un exemplu te rog frumos ?
Reply
#6

daca gamemod-ul tau este GF edit sigur este vorba de cum zic eu, ca sa rezolvi problema trebuie sa implementezi sistemul in GM si
Код:
new HouseID;
	APlayerData[playerid][CurrentHouse] = 0;
	if (SpawnAtHouse == true)
	{
		HouseID = APlayerData[playerid][Houses][0];
		if (HouseID != 0)
		{
			SetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]);
		}
	}
sa pui la functia SetPlayerSpawn sub spawnareade la tutorial, puscarie si ce mai e pe acolo ..... daca nu te descurci arata-mi functia si ca sa ti-o aranjez sa vezi cum trebuie.
Reply
#7

N-am asa ceva in gm , iar gm-ul meu este RPG .. deja incerc de doua zile sa rezolv aceasta problema .. cu siguranta este ceva gresit in gm-ul meu , multumesc pentru ajutorul acordat .. mai astept sa vedem poate stie cineva .
Reply
#8

Quote:
Originally Posted by jamal1992
Посмотреть сообщение
daca gamemod-ul tau este GF edit sigur este vorba de cum zic eu, ca sa rezolvi problema trebuie sa implementezi sistemul in GM si
Код:
new HouseID;
	APlayerData[playerid][CurrentHouse] = 0;
	if (SpawnAtHouse == true)
	{
		HouseID = APlayerData[playerid][Houses][0];
		if (HouseID != 0)
		{
			SetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]);
		}
	}
sa pui la functia SetPlayerSpawn sub spawnareade la tutorial, puscarie si ce mai e pe acolo ..... daca nu te descurci arata-mi functia si ca sa ti-o aranjez sa vezi cum trebuie.
Cam asta am eu acolo :

Код:
public SetPlayerSpawn(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	    if(PlayerInfo[playerid][pTut] == 0)
	    {
			gOoc[playerid] = 1; gHSAY[playerid] = 1; gNews[playerid] = 1; gFam[playerid] = 1; gFamAll[playerid] = 1; gRadio[playerid] = 1; gDepartments[playerid] = 1;
			TogglePlayerControllable(playerid, 0);
			RegistrationStep[playerid] = 1;
			SendClientMessage(playerid, COLOR_WHITE, "Bine ati venit pe Bla bla bla Server, va rugam completati informatiile pentru a continua");
			SendClientMessage(playerid, COLOR_RED, "Esti Barbat sau Femeie ? (Scrieti in chat ( ex : Barbat)");
	    }
		new rand;
//      new house = PlayerInfo[playerid][pPhousekey];
		if(PlayerPaintballing[playerid] != 0)
		{
		    ResetPlayerWeapons(playerid);
		    rand = random(sizeof(PaintballSpawns));
			AC_BS_SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
		    return 1;
		}
		if(PlayerInfo[playerid][pJailed] == 1)
		{
            SetPlayerWantedLevel(playerid, 0);
			AC_BS_SetPlayerInterior(playerid, 6);
			AC_BS_SetPlayerPos(playerid,264.4472,86.6204,1001.0391);
			SendClientMessage(playerid, COLOR_LIGHTRED, "Incomplete Jail Sentence, back to jail");
			return 1;
		}
		if(PlayerInfo[playerid][pJailed] == 2)
		{
            SetPlayerWantedLevel(playerid, 0);
			AC_BS_SetPlayerInterior(playerid,17);
			AC_BS_SetPlayerPos(playerid,-959.5732,1955.2191,9.0000);
			SendClientMessage(playerid, COLOR_LIGHTRED, "Incomplete Prison Sentence, back to Prison");
			return 1;
		}
		if(MedicBill[playerid] == 1 && PlayerInfo[playerid][pJailed] == 0 && PlayerPaintballing[playerid] == 0)
		{
		    new string[256];
		    new cut = deathcost;
			//PlayerInfo[playerid][pLevel]*deathcost;
			AC_BS_GivePlayerMoney(playerid, -cut);
			format(string, sizeof(string), "{FF8282}Doctor: {FFFFFF}Factura ta medicala a costat {FF8282}%d${FFFFFF}, O zi Buna!", cut);
			SendClientMessage(playerid, COLOR_WHITE, string);
			MedicBill[playerid] = 0;
			MedicTime[playerid] = 0;
			NeedMedicTime[playerid] = 0;
		}
/*		if(house !=255)
		{
		    if(SpawnChange[playerid]) //If 1, then you get to your house, else spawn somewhere else
		    {
				SetPlayerToTeamColor(playerid);
				AC_BS_SetPlayerInterior(playerid,HouseInfo[house][hInt]);
				AC_BS_SetPlayerPos(playerid, HouseInfo[house][hExitx], HouseInfo[house][hExity],HouseInfo[house][hExitz]); // Warp the player
				PlayerInfo[playerid][pLocal] = house;
				PlayerInfo[playerid][pInt] = HouseInfo[house][hInt];
				return 1;
			}
		}*/
ultima parte eu i-am pus */ pentru ca facea parte din systemul meu vechi de case care era implementat in gm ..
Reply
#9

Uite daca pui tot ce ai in FS sa le copiezi in GM si la functia
Код:
public SetPlayerSpawn(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	    if(PlayerInfo[playerid][pTut] == 0)
	    {
			gOoc[playerid] = 1; gHSAY[playerid] = 1; gNews[playerid] = 1; gFam[playerid] = 1; gFamAll[playerid] = 1; gRadio[playerid] = 1; gDepartments[playerid] = 1;
			TogglePlayerControllable(playerid, 0);
			RegistrationStep[playerid] = 1;
			SendClientMessage(playerid, COLOR_WHITE, "Bine ati venit pe Bla bla bla Server, va rugam completati informatiile pentru a continua");
			SendClientMessage(playerid, COLOR_RED, "Esti Barbat sau Femeie ? (Scrieti in chat ( ex : Barbat)");
	    }
		new rand;
//      new house = PlayerInfo[playerid][pPhousekey];
		if(PlayerPaintballing[playerid] != 0)
		{
		    ResetPlayerWeapons(playerid);
		    rand = random(sizeof(PaintballSpawns));
			AC_BS_SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
		    return 1;
		}
		if(PlayerInfo[playerid][pJailed] == 1)
		{
            SetPlayerWantedLevel(playerid, 0);
			AC_BS_SetPlayerInterior(playerid, 6);
			AC_BS_SetPlayerPos(playerid,264.4472,86.6204,1001.0391);
			SendClientMessage(playerid, COLOR_LIGHTRED, "Incomplete Jail Sentence, back to jail");
			return 1;
		}
		if(PlayerInfo[playerid][pJailed] == 2)
		{
            SetPlayerWantedLevel(playerid, 0);
			AC_BS_SetPlayerInterior(playerid,17);
			AC_BS_SetPlayerPos(playerid,-959.5732,1955.2191,9.0000);
			SendClientMessage(playerid, COLOR_LIGHTRED, "Incomplete Prison Sentence, back to Prison");
			return 1;
		}
		if(MedicBill[playerid] == 1 && PlayerInfo[playerid][pJailed] == 0 && PlayerPaintballing[playerid] == 0)
		{
		    new string[256];
		    new cut = deathcost;
			//PlayerInfo[playerid][pLevel]*deathcost;
			AC_BS_GivePlayerMoney(playerid, -cut);
			format(string, sizeof(string), "{FF8282}Doctor: {FFFFFF}Factura ta medicala a costat {FF8282}%d${FFFFFF}, O zi Buna!", cut);
			SendClientMessage(playerid, COLOR_WHITE, string);
			MedicBill[playerid] = 0;
			MedicTime[playerid] = 0;
			NeedMedicTime[playerid] = 0;
		}
adaugi
Код:
new HouseID;
	APlayerData[playerid][CurrentHouse] = 0;
	if (SpawnAtHouse == true)
	{
		HouseID = APlayerData[playerid][Houses][0];
		if (HouseID != 0)
		{
			SetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]);
		}
	}
atunci o sa-ti functioneze sistemul. Momentan nu functioneaza pentru ca ai SetPlayerSpawn(playerid) in Functia OnPlayerSpawn din GM si nu-l poti scoate pt ca asa e conceput gf-ul de cacat .....
Reply
#10

Multumesc frate ! , acum incerc sa-l implementez in gm .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)