SA-MP Forums Archive
How to sbug the spawn - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to sbug the spawn (/showthread.php?tid=322015)



How to sbug the spawn - Sk1lleDxx - 29.02.2012

Hi all,
When the GM was hosted at home PC when a player die, he respawn at the church.
Now when we have hosted when a player die and press "Spawn" comes a blank screen saying stay within the world bordies, or something like that.
The code is this:
Код:
public OnPlayerSpawn(playerid)
{
	if(PlayerInfo[playerid][pClan] < 255)
	{
		/*GangZoneShowForPlayer(playerid,gang1,COLOR_RED);
		GangZoneShowForPlayer(playerid,gang2,COLOR_LIGHTGREEN);
		GangZoneShowForPlayer(playerid,gang3,COLOR_DBLUE);
		GangZoneShowForPlayer(playerid,gang4, 0x00CACA96);
		GangZoneShowForPlayer(playerid,gang5, 0xFF80FF96);
		GangZoneShowForPlayer(playerid,gang6, 0xFF800096);
		GangZoneShowForPlayer(playerid,gang7,0xFFFF0096);*/
		/*CreateMapIcon(23,267, -2906.0000,940.0000,6.2221); // GANG 1
		CreateMapIcon(23,268, -2673.0000,904.0000,79.6819); // GANG 2
		CreateMapIcon(23,269, -2084.1042,387.5462,35.1719); // GANG 3
		CreateMapIcon(23,270, -1841.5540,1017.3223,45.7130); // GANG 4
		CreateMapIcon(23,271, -1843.0000,-108.0000,5.6484); // GANG 5
		CreateMapIcon(23,272, -2209.5266,48.0723,35.3203); // GANG 6
		CreateMapIcon(23,273, -2656.7739,-127.6285,4.0041); // GANG 7*/
	}
    TextDrawShowForPlayer(playerid, txt_logo);
    SetPlayerColor(playerid,COLOR_CIVILIAN);

 //Aggiungi questo in OnPlayerSpawn
    SetPlayerHealth(playerid,100);
	SetPlayerDrunkLevel(playerid,0);
	if(RespawnOspedale[playerid] == 0)
	{
	    SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
	    SetPlayerSpawn(playerid);
		TextDrawHideForPlayer(playerid, Textdraw5);
		TextDrawHideForPlayer(playerid, Textdraw6);
		PlayerPlaySound(playerid, 1069, 0.0, 0.0, 0.0);
	}
	else if(RespawnOspedale[playerid] == 1)
	{
	    if(GetPlayerCash(playerid) >= 100)
	    {
	        DisablePlayerCheckpoint(playerid);
	        ImportazioneMafia[playerid] = 0;
	        SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
	        SetPlayerColor(playerid,COLOR_CIVILIAN);
	    	SetTimerEx("RespawnDopoMorte",30000,false,"i",playerid);
        	SetPlayerInterior(playerid,0);
	    	SetPlayerVirtualWorld(playerid,playerid);
			SetPlayerPos(playerid, 367.317779,2318.205322,1891.577880);
			SetPlayerFacingAngle(playerid, 359.1555);
			WantedPoints[playerid] = 0;
			GivePlayerCash(playerid,-100);
			SetTimerEx("AnimMorte", 2000, false, "i", playerid);
			SendClientMessage(playerid, COLOR_WHITE, "--------------------=[Sei Stato Ucciso, La Fine?]=--------------------------------------");
			SendClientMessage(playerid, 0xd368ffff, "Sei stato ucciso, fra pochi secondi ti ritroverai nel tuo punto di spawn");
			SendClientMessage(playerid, 0xd368ffff, "Ricorda di non uccidere colui che ti ha ucciso sennт commetti un Revenge Kill");
            SendClientMessage(playerid, 0xd368ffff, "Non hai perso la tua attuale fazione-clan-lavoro, Hai solo perso 100$");
            SendClientMessage(playerid, COLOR_WHITE, "--------------------------------------------------------------------------------------------------");
			TextDrawHideForPlayer(Rapinatore, Textdraw14);
			TextDrawHideForPlayer(Rapinatorec, Textdraw14);
			ResetPlayerWeapons(playerid);
			RemovePlayerAttachedObject(playerid, 3);
			SetPlayerArmour(playerid, 0);
			ResetPlayerWantedLevelEx(playerid);
			SetGravity(0.008);
}
		else
		{
		    RemovePlayerAttachedObject(playerid, 3);
			SetPlayerArmour(playerid, 0);
			ResetPlayerWantedLevelEx(playerid);
		    ResetPlayerWeapons(playerid);
		    TextDrawHideForPlayer(Rapinatore, Textdraw14);
		    TextDrawHideForPlayer(Rapinatorec, Textdraw14);
			DisablePlayerCheckpoint(playerid);
			ImportazioneMafia[playerid] = 0;
		    TogglePlayerControllable(playerid, 0);
	        SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
	        SetPlayerColor(playerid,COLOR_CIVILIAN);
	    	SetTimerEx("RespawnDopoMorte",30000,false,"i",playerid);
	    	SetTimerEx("AnimMorte", 2000, false, "i", playerid);
        	SetPlayerInterior(playerid,0);
        	WantedPoints[playerid] = 0;
	    	SetPlayerVirtualWorld(playerid,playerid);
			SetPlayerPos(playerid, 367.317779,2318.205322,1891.577880);
			SetPlayerFacingAngle(playerid, 359.1555);
			SendClientMessage(playerid, COLOR_WHITE, "--------------------=[Sei Stato Ucciso, La Fine?]=--------------------------------------");
			SendClientMessage(playerid, 0xd368ffff, "Sei stato ucciso, fra pochi secondi ti ritroverai nel tuo punto di spawn");
			SendClientMessage(playerid, 0xd368ffff, "Ricorda di non uccidere colui che ti ha ucciso sennт commetti un Revenge Kill");
            SendClientMessage(playerid, 0xd368ffff, "Non hai perso la tua attuale fazione-clan-lavoro, Non hai speso i 100$ perchи hai pochi soldi in tasca");
            SendClientMessage(playerid, COLOR_WHITE, "--------------------------------------------------------------------------------------------------");
            SetGravity(0.008);
		}
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
		PlayerInfo[playerid][pInvWeapon] = 0;
		PlayerInfo[playerid][pInvAmmo] = 0;
		new string[256];
        for(new n = 0; n < sizeof(GangZoneInfo); n++)
		{
  			if(PlayerToPoint(25, playerid,GangZoneInfo[n][EnterX], GangZoneInfo[n][EnterY], GangZoneInfo[n][EnterZ]))
			{
				if(CapoGang[playerid] == GangZoneInfo[n][gzOwned] && InizioGangWar[playerid] == 1)
				{
					format(string, sizeof(string), "%s ti ha ucciso, hai perso il tuo territorio",GetPlayerNameEx(killerid));
	        		SendClientMessage(playerid,COLOR_LIGHTBLUE, string);
	        		GangZoneInfo[n][gzOwned] = PlayerInfo[killerid][pClan];
	        		strmid(GangZoneInfo[n][gzOwner],Clan[PlayerInfo[killerid][pClan]][cName], 0, strlen(Clan[PlayerInfo[killerid][pClan]][cName]), 999);
	        		format(string, sizeof(string), "%s ha ucciso %s il capo clan della gang, Avete vinto la gang war!",GetPlayerNameEx(killerid),GetPlayerNameEx(playerid));
	        		SendClanMessage(PlayerInfo[killerid][pClan],COLOR_LIGHTBLUE, string);
                    SaveGangZones();
				}
				else if(CapoGang[playerid] == PlayerInfo[playerid][pClan] && InizioGangWar[playerid] == 1)
				{
				    format(string, sizeof(string), "%s ti ha ucciso, hai perso l'attacco al territorio",GetPlayerNameEx(killerid));
	        		SendClientMessage(playerid,COLOR_LIGHTBLUE, string);
	        		format(string, sizeof(string), "%s ha ucciso %s il capo clan della gang, Avete vinto la gang war!",GetPlayerNameEx(killerid),GetPlayerNameEx(playerid));
	        		SendClanMessage(PlayerInfo[killerid][pClan],COLOR_LIGHTBLUE, string);
                }
                else if(Difendere[playerid] == playerid || Attaccare[playerid] == playerid && InizioGangWar[playerid] == 1)
                {
                    format(string, sizeof(string), "%s и stato annientato!",GetPlayerNameEx(playerid));
	        		SendClanMessage(PlayerInfo[playerid][pClan],COLOR_WHITE, string);
	        		Difendere[playerid] = 0;
	        		Attaccare[playerid] = 0;
	        	}
	        	CapoGang[playerid] = 255;
			}
		}
    	if(IDContratto == playerid)
    	{
    	    if(PlayerInfo[killerid][pFaction] == 8)
    	    {
            	GivePlayerCash(killerid, SoldiContratto);
				for(new i=0; i<MAX_PLAYERS; i++)
				{
                    if(PlayerInfo[i][pFaction] == 8)
                    {
                        SendClientMessage(i,BLUE, "[INFO:] Contratto sciolto motivo: Contrattato morto");
                        return 1;
					}
				}
			}
			IDKiller = 999;
			IDContratto = 999;
			SoldiContratto = 0;
		}
		if(Rapinatorec == playerid)
		{
		    new f = maxobjm+1;
			for(new a = 0; a < sizeof(ObjSCoords); a++)
			{
				if(ObjSCoords[a][0] == 0.0) f = a;
			}
			if(f == maxobjm+1) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERRORE:]Non puoi gettare la tua sacca a terra");
			else
			{
				
				if(Bottino[playerid] > 0)
				{
					RemovePlayerAttachedObject(playerid, 3);
					GetPlayerPos(playerid, ObjSCoords[f][0], ObjSCoords[f][1], ObjSCoords[f][2]);
					objectsacca[f] = CreateDynamicObject(1550,ObjSCoords[f][0],ObjSCoords[f][1],ObjSCoords[f][2]-1,93.7,120.0,120.0);
					SaccaDropped[f] = Bottino[playerid];
				}
				Rapinatorec = 255;
				CasJobTime = -1;
				Bottino[playerid] = 0;
				TextDrawHideForPlayer(playerid, Textdraw14);
   			}
		}
		if(Rapinatore == playerid)
    	{
    	    new f = maxobjm+1;
			for(new a = 0; a < sizeof(ObjSCoords); a++)
			{
				if(ObjSCoords[a][0] == 0.0) f = a;
			}
			if(f == maxobjm+1) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERRORE:]Non puoi gettare la tua sacca a terra");
			else
			{
			    if(Bottino[playerid] > 0)
				{
					SaccaDropped[f] = Bottino[playerid];
					RemovePlayerAttachedObject(playerid, 3);
					GetPlayerPos(playerid, ObjSCoords[f][0], ObjSCoords[f][1], ObjSCoords[f][2]);
					objectsacca[f] = CreateDynamicObject(1550,ObjSCoords[f][0],ObjSCoords[f][1],ObjSCoords[f][2]-1,93.7,120.0,120.0);
				}
				/*format(string, sizeof(string), "[BANCA:]Il rapinatore della banca non ha riuscito a portare il bottino in salvo");
	        	SendClientMessageToAll(COLOR_LIGHTBLUE, string);
	        	format(string, sizeof(string), "=> Hai perso $%d della rapina", Bottino[playerid]);
	 			SendClientMessage(playerid,COLOR_YELLOW2,string);*/
	        	Rapinatore = 255;
				BankJobTime = -1;
				Bottino[playerid] = 0;
				TextDrawHideForPlayer(playerid, Textdraw14);
   			}
    	}
		RespawnOspedale[playerid] = 1;
		//GETTA L'ARMA ALLA MORTE
			new gunID = GetPlayerWeapon(playerid);
			new gunAmmo = GetPlayerAmmo(playerid);
			if(gunID != 0 && gunAmmo != 0)
			{
				new f = maxobj+1;
				for(new a = 0; a < sizeof(ObjCoords); a++)
				{
					if(ObjCoords[a][0] == 0.0) f = a;
				}

				if(f == maxobj+1) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERRORE:]Non puoi gettare armi a terra, prova piщ tardi!!");
   				else
   				{
						RemovePlayerWeapon(playerid, gunID);
						ObjectID[f][0] = gunID;
						ObjectID[f][1] = gunAmmo;
		        		GetPlayerPos(playerid, ObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
		        		object[f] = CreateDynamicObject(GunObjects[gunID][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0);
		        }
		    }
			return 1;
}
What can I do?