SA-MP Forums Archive
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: Spawn (/showthread.php?tid=607429)



Spawn - justjamie - 19.05.2016

Hello,
when i join my server, my script keeps prompting me the spawn selection and it is driving me nuts, i can't find it anywhere.

Someone any idea where it can be?


Re: Spawn - BloodyRP - 19.05.2016

u need to show us OnPlayerRequestClass public and OnPlayerSpawn.


Re: Spawn - justjamie - 20.05.2016

Quote:
Originally Posted by BloodyRP
Посмотреть сообщение
u need to show us OnPlayerRequestClass public and OnPlayerSpawn.
i don't have a onplayerrequestclass.


This is my OnPlayerSpawn:
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "Tram_Driver", true))//Trams_Driver = 956 Tram_Driver = 360
        {
            PutPlayerInVehicle(playerid, 360, 0);
        }
        if(!strcmp(npcname, "Trams_Driver", true))
        {
            PutPlayerInVehicle(playerid, 956, 0);
        }
        return 1;
    }
    if (PLAYERLIST_authed[playerid])
    {
//      new nome[ 256 ];
//      format(nome, sizeof(nome),"14[SPAWNED] [%s - %d] %s[%d] has spawned.",AdminLevelName(playerid),PlayerInfo[playerid][power], PlayerName(playerid),playerid);
//      iEcho( nome );
        StopAudioStreamForPlayer(playerid);
        Killing_Spree_Count[playerid] = 0;
        //SetTimerEx("StopSpectate", 100, false, "d", playerid);
        //SetTimerEx("JustSpawned", 180000, false, "dd", playerid,0);
        if(!gPlayerAnimLibsPreloaded[playerid])
        {
            PreloadAnimLib(playerid,"BOMBER");
            PreloadAnimLib(playerid,"RAPPING");
            PreloadAnimLib(playerid,"SHOP");
            PreloadAnimLib(playerid,"BEACH");
            PreloadAnimLib(playerid,"SMOKING");
            PreloadAnimLib(playerid,"FOOD");
            PreloadAnimLib(playerid,"ON_LOOKERS");
            PreloadAnimLib(playerid,"DEALER");
            PreloadAnimLib(playerid,"CRACK");
            PreloadAnimLib(playerid,"CARRY");
            PreloadAnimLib(playerid,"COP_AMBIENT");
            PreloadAnimLib(playerid,"PARK");
            PreloadAnimLib(playerid,"INT_HOUSE");
            PreloadAnimLib(playerid,"FOOD");
            PreloadAnimLib(playerid,"PED");
            gPlayerAnimLibsPreloaded[playerid] = 1;
        }
        StopPlayerHoldingObjectEx(playerid);
        SetPVarInt(playerid, "Tazer", 0);
        SetPVarInt(playerid, "BriefCaseTill", 0);
        if(GetPVarInt(playerid, "SkinSelect") == 1)
        {
            SetTimerEx("SetPlayerBack", 350, false, "dd", playerid,1);
            new tmpid=IsPlayerInBiz(playerid);
            if(tmpid!=-1)
            {
                new filename[50],tmpbank;
                format(filename,sizeof(filename),"%s.txt",biz[tmpid][bizname]);
                tmpbank=dini_Int(filename,"bizcash");
                dini_IntSet(filename,"bizcash",tmpbank+1000);
                GivePlayerMoneyEx(playerid,-1000);
                PlayerTemp[playerid][spawnrdy]=0;
            }
            return 1;
        }
        TextDrawHideForPlayer(playerid, plrwarning[playerid]);
        TextDrawHideForPlayer(playerid, jailtd[playerid]);
        TextDrawHideForPlayer(playerid, InjuredTD);
        PlayerTemp[playerid][HasRedScreen] = 0;
        SetPVarInt(playerid, "GarageID", -1);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 1);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
        TextDrawHideForPlayer(playerid, PlayerTemp[playerid][InfoBox]);
        TextDrawHideForPlayer(playerid, LocationTD[playerid]);
        TextDrawHideForPlayer(playerid, Harvest[playerid]);
        TextDrawHideForPlayer(playerid, Cargo[playerid]);
        if(PlayerTemp[playerid][deaded]==2){
        PlayerTemp[playerid][deaded]=0;
        return 1;
        }
        if(PlayerTemp[playerid][adminduty])
        {
            SendClientMessage(playerid, COLOR_LIGHTGREY, " Info: You are still on adminduty! You cannot roleplay!");
            SetTimerEx("AdminDutyFunction", 1200, false, "d", playerid);
        }
        if(PlayerTemp[playerid][helperduty])
        {
            SendClientMessage(playerid, COLOR_LIGHTGREY, " Info: You are still on helperduty! You cannot roleplay!");
            SetTimerEx("AdminDutyFunction", 1200, false, "d", playerid);
        }
        SetPlayerArmour(playerid, 0.0);
        TextDrawShowForPlayer(playerid, PlayerTemp[playerid][Status]);
        TextDrawShowForPlayer(playerid, LocationTD[playerid]);
        TextDrawShowForPlayer(playerid, TextDraw__News);
        TextDrawShowForPlayer(playerid, IMtxt);
        TextDrawHideForPlayer(playerid, TellTD);
        TextDrawHideForPlayer(playerid, TextDraw__Top1);
        TextDrawHideForPlayer(playerid, TextDraw__Bottom1);
        new Float:px,Float:py,Float:pz;
        if(MoneyCheckEx(playerid)) return 1;
        GetPlayerPos(playerid,px,py,pz);
        PlayerPlaySound(playerid,SOUND_GOGO_TRACK_STOP,px,py,pz);
        SetPlayerHealth(playerid,100);
        for(new q; q < sizeof(Gangzones); q++)
        {
            GangZoneShowForPlayer(playerid, Gangzones[q][gID], GetFactionTurfColour(Gangzones[q][gFACTION]));
            TextDrawHideForPlayer(playerid, Gangzones[q][gDRAW]);
            if(Gangzones[q][gBLINK] == 1) GangZoneFlashForPlayer(playerid, Gangzones[q][gID], COLOR_WHITE);
        }

        if(PlayerInfo[playerid][jailtime]>1 || PlayerInfo[playerid][jail])
        {
            PlayerTemp[playerid][imprisoned] = 1;
            Jail(playerid,PlayerInfo[playerid][jailtime],PlayerInfo[playerid][bail],PlayerInfo[playerid][jailreason]);
            new id = random(sizeof(PrisonCells));
            SetPlayerPos(playerid, PrisonCells[id][0], PrisonCells[id][1], PrisonCells[id][2]);
            SetTimerEx("Freeze123", 1000, 0, "i", playerid);
            TogglePlayerControllable(playerid, false);
            SetPlayerInterior(playerid,3);
            return 1;
        }
        else
        {
            if(IsPlayerInPaintball(playerid))
            {
                SetPlayerPaintBall(playerid, PlayerTemp[playerid][onpaint], PlayerTemp[playerid][pbteam]);
                return 1;
            }
            SetTimerEx("CheckCrash", 750, false, "d", playerid);
            if(PlayerInfo[playerid][housenum]==-1) DefaultSpawn(playerid);
            else HouseSpawn(playerid, PlayerInfo[playerid][housenum]);
        }
    }
    else
    {
        switch(random(2))
        {
            case 0:
            {
                SetPlayerCameraPos(playerid,967.4384,2559.5483,10.7003);
                SetPlayerCameraLookAt(playerid,982.4874,2561.6409,22.5239);
                SetPlayerPos(playerid,967.4384,2559.5483,5.7003);
            }
        }
        SetPlayerInterior(playerid,0);
        SetPlayerColor(playerid, COLOR_RED);
        TogglePlayerControllable(playerid,false);
        return 1;
    }
    return 0;
}



Re: Spawn - luke49 - 20.05.2016

You are not able to edit SPAWN buttons - you can either use TogglePlayerControllable function (set true) or put timer. Also, you can use functions, such as SpawnPlayer or SetSpawnInfo - this will not show you any SPAWN buttons.


Re: Spawn - MBilal - 20.05.2016

Код:
public OnPlayerSpawn(playerid)
{
	if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "Tram_Driver", true))//Trams_Driver = 956 Tram_Driver = 360
        {
            PutPlayerInVehicle(playerid, 360, 0);
        }
        if(!strcmp(npcname, "Trams_Driver", true))
        {
            PutPlayerInVehicle(playerid, 956, 0);
        }
        return 1;
    }
	if (PLAYERLIST_authed[playerid])
	{
//	    new nome[ 256 ];
//		format(nome, sizeof(nome),"14[SPAWNED] [%s - %d] %s[%d] has spawned.",AdminLevelName(playerid),PlayerInfo[playerid][power], PlayerName(playerid),playerid);
//		iEcho( nome );
	    StopAudioStreamForPlayer(playerid);
	    Killing_Spree_Count[playerid] = 0;
		//SetTimerEx("StopSpectate", 100, false, "d", playerid);
	    //SetTimerEx("JustSpawned", 180000, false, "dd", playerid,0);
		if(!gPlayerAnimLibsPreloaded[playerid])
		{
			PreloadAnimLib(playerid,"BOMBER");
			PreloadAnimLib(playerid,"RAPPING");
			PreloadAnimLib(playerid,"SHOP");
			PreloadAnimLib(playerid,"BEACH");
			PreloadAnimLib(playerid,"SMOKING");
			PreloadAnimLib(playerid,"FOOD");
			PreloadAnimLib(playerid,"ON_LOOKERS");
			PreloadAnimLib(playerid,"DEALER");
			PreloadAnimLib(playerid,"CRACK");
			PreloadAnimLib(playerid,"CARRY");
			PreloadAnimLib(playerid,"COP_AMBIENT");
			PreloadAnimLib(playerid,"PARK");
			PreloadAnimLib(playerid,"INT_HOUSE");
			PreloadAnimLib(playerid,"FOOD");
			PreloadAnimLib(playerid,"PED");
			gPlayerAnimLibsPreloaded[playerid] = 1;
		}
	    StopPlayerHoldingObjectEx(playerid);
	    SetPVarInt(playerid, "Tazer", 0);
	    SetPVarInt(playerid, "BriefCaseTill", 0);
	    if(GetPVarInt(playerid, "SkinSelect") == 1)
		{
	        SetTimerEx("SetPlayerBack", 350, false, "dd", playerid,1);
	        new tmpid=IsPlayerInBiz(playerid);
			if(tmpid!=-1)
			{
				new filename[50],tmpbank;
				format(filename,sizeof(filename),"%s.txt",biz[tmpid][bizname]);
				tmpbank=dini_Int(filename,"bizcash");
				dini_IntSet(filename,"bizcash",tmpbank+1000);
				GivePlayerMoneyEx(playerid,-1000);
				PlayerTemp[playerid][spawnrdy]=0;
			}
	        return 1;
		}
		TextDrawHideForPlayer(playerid, plrwarning[playerid]);
		TextDrawHideForPlayer(playerid, jailtd[playerid]);
		TextDrawHideForPlayer(playerid, InjuredTD);
		PlayerTemp[playerid][HasRedScreen] = 0;
	    SetPVarInt(playerid, "GarageID", -1);
	    SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 1);
	    SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
	    TextDrawHideForPlayer(playerid, PlayerTemp[playerid][InfoBox]);
	    TextDrawHideForPlayer(playerid, LocationTD[playerid]);
	    TextDrawHideForPlayer(playerid, Harvest[playerid]);
	    TextDrawHideForPlayer(playerid, Cargo[playerid]);
	    if(PlayerTemp[playerid][deaded]==2){
	    PlayerTemp[playerid][deaded]=0;
      	return 1;
 		}
	    if(PlayerTemp[playerid][adminduty])
	    {
	        SendClientMessage(playerid, COLOR_LIGHTGREY, " Info: You are still on adminduty! You cannot roleplay!");
	        SetTimerEx("AdminDutyFunction", 1200, false, "d", playerid);
	    }
   	    if(PlayerTemp[playerid][helperduty])
	    {
	        SendClientMessage(playerid, COLOR_LIGHTGREY, " Info: You are still on helperduty! You cannot roleplay!");
	        SetTimerEx("AdminDutyFunction", 1200, false, "d", playerid);
	    }
	    SetPlayerArmour(playerid, 0.0);
	    TextDrawShowForPlayer(playerid, PlayerTemp[playerid][Status]);
	    TextDrawShowForPlayer(playerid, LocationTD[playerid]);
    	TextDrawShowForPlayer(playerid, TextDraw__News);
    	TextDrawShowForPlayer(playerid, IMtxt);
    	TextDrawHideForPlayer(playerid, TellTD);
   		TextDrawHideForPlayer(playerid, TextDraw__Top1);
		TextDrawHideForPlayer(playerid, TextDraw__Bottom1);
		new Float:px,Float:py,Float:pz;
		if(MoneyCheckEx(playerid)) return 1;
		GetPlayerPos(playerid,px,py,pz);
		PlayerPlaySound(playerid,SOUND_GOGO_TRACK_STOP,px,py,pz);
		SetPlayerHealth(playerid,100);
		for(new q; q < sizeof(Gangzones); q++)
		{
			GangZoneShowForPlayer(playerid, Gangzones[q][gID], GetFactionTurfColour(Gangzones[q][gFACTION]));
			TextDrawHideForPlayer(playerid, Gangzones[q][gDRAW]);
			if(Gangzones[q][gBLINK] == 1) GangZoneFlashForPlayer(playerid, Gangzones[q][gID], COLOR_WHITE);
		}

 		if(PlayerInfo[playerid][jailtime]>1 || PlayerInfo[playerid][jail])
	 	{
	 	    PlayerTemp[playerid][imprisoned] = 1;
		    Jail(playerid,PlayerInfo[playerid][jailtime],PlayerInfo[playerid][bail],PlayerInfo[playerid][jailreason]);
   			new id = random(sizeof(PrisonCells));
			SetPlayerPos(playerid, PrisonCells[id][0], PrisonCells[id][1], PrisonCells[id][2]);
			SetTimerEx("Freeze123", 1000, 0, "i", playerid);
			TogglePlayerControllable(playerid, false);
			SetPlayerInterior(playerid,3);
		    return 1;
		}
		else
		{
		    if(IsPlayerInPaintball(playerid))
		    {
				SetPlayerPaintBall(playerid, PlayerTemp[playerid][onpaint], PlayerTemp[playerid][pbteam]);
				return 1;
			}
			SetTimerEx("CheckCrash", 750, false, "d", playerid);
			if(PlayerInfo[playerid][housenum]==-1) DefaultSpawn(playerid);
			else HouseSpawn(playerid, PlayerInfo[playerid][housenum]);
		}
	}
	else
	{
		switch(random(2))
		{
			case 0:
			{
				SetPlayerCameraPos(playerid,967.4384,2559.5483,10.7003);
				SetPlayerCameraLookAt(playerid,982.4874,2561.6409,22.5239);
				SetPlayerPos(playerid,967.4384,2559.5483,5.7003);
            }
		}
		SetPlayerInterior(playerid,0);
		SetPlayerColor(playerid, COLOR_RED);
		TogglePlayerControllable(playerid,false);
		return 1;
	}
	return 1;
}
Try this code em sure it will work

OnPlayerspawn should not return 0;

it should return 1.

Hope it will help you Budy.


Re: Spawn - justjamie - 20.05.2016

nope didnt work.
Still got prompted to << SPAWN >>


Re: Spawn - denNorske - 20.05.2016

Hello Justjamie!

Take a look here, it has already been answered:

http://forum.sa-mp.com/showpost.php?...45&postcount=6


OnPlayerRequestSpawn should just toggle the player spectating, then you toggle it back off to make the player spawn. This way you avoid having the buttons visible.

Hope it helped.