SA-MP Forums Archive
Special spawn for SAPD - 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: Special spawn for SAPD (/showthread.php?tid=358185)



Special spawn for SAPD - backnot - 09.07.2012

All factions are spawned in one civilian spawn .
I have to create special spawn for SAPD , so when they connect they will be spawned there .
Код:
public OnGameModeInit()
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
...
That's my spawn.
Код:
public OnPlayerSpawn(playerid)
{
	// Anti F4 Bug - Logging/Registering
	if(!PlayerInfo[playerid][pLoggedIn] && !IsPlayerNPC(playerid))
	{
		if(IsPlayerNPC(playerid)) return 1;
		SetPlayerPos(playerid, 1975.203002, 3779.311523, -50.243506);
		SetPlayerCameraPos(playerid, 1975.203002, 3779.311523, 100.243506);
		SetPlayerCameraLookAt(playerid, 1975.203002, 3779.311523, -0.243506);
	    SetSpawnInfo( playerid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	    new file[64];
		format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
	    // Player isn't banned
	    if(dini_Int(file, "AdminAccount") == 1)
		{
		    format(file, sizeof(file), "users/%s.ini",RPNU(playerid));
		    SetPlayerName(playerid, dini_Get(file, "OldName"));
		    format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
		    ShowDialog(playerid, 2);
		}
		if(!dini_Exists(file))
		{
		    ShowDialog(playerid, 1);
		    return 1;
		}
		else
		{
			ShowDialog(playerid, 2);
		}
		return 1;
	}
	if(!IsACop(playerid))
	{
	AddPlayerClass(0,246.4809,86.6398,1003.6406,183.7600,0,0,0,0,0,0); // sapd spawn
	return 1;
 	}
	// Actual Spawning
    ResetPlayerWeapons(playerid);
    SetPlayerSkin(playerid, 1);
	if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
	{
	  new npcname[MAX_PLAYER_NAME];
	  GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
	  if(!strcmp(npcname, "BusDriver", true)) //Checking if the NPC's name is BusDriver
	  {
	    PutPlayerInVehicle(playerid, NPCBus, 0); //Putting the NPC into the vehicle we created for it.
	    return 1;
	  }
	  return 1;
	}
    if(PlayerInfo[playerid][pLoggedIn] && PlayerInfo[playerid][pSpawn])
    {
        FalseBan[playerid] = 0;
        SetTimerEx("FalseBanFix", 6000, false, "i", playerid);
    	SpawnChar(playerid);
    }
	return 1;
}
Legend: Bold-ed lines is my modification that I tried .

I tried several time but my pawn crashes xD.
Anybody ?


Re: Special spawn for SAPD - backnot - 09.07.2012

I fixed it ..
Код:
public OnPlayerSpawn(playerid)
{
	// Anti F4 Bug - Logging/Registering
	if(!PlayerInfo[playerid][pLoggedIn] && !IsPlayerNPC(playerid))
	{
		if(IsPlayerNPC(playerid)) return 1;
		SetPlayerPos(playerid, 1975.203002, 3779.311523, -50.243506);
		SetPlayerCameraPos(playerid, 1975.203002, 3779.311523, 100.243506);
		SetPlayerCameraLookAt(playerid, 1975.203002, 3779.311523, -0.243506);
	    SetSpawnInfo( playerid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	    new file[64];
		format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
	    // Player isn't banned
	    if(dini_Int(file, "AdminAccount") == 1)
		{
		    format(file, sizeof(file), "users/%s.ini",RPNU(playerid));
		    SetPlayerName(playerid, dini_Get(file, "OldName"));
		    format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
		    ShowDialog(playerid, 2);
		}
		if(!dini_Exists(file))
		{
		    ShowDialog(playerid, 1);
		    return 1;
		}
		else
		{
			ShowDialog(playerid, 2);
		}
		return 1;
	}
	// Actual Spawning
    ResetPlayerWeapons(playerid);
    SetPlayerSkin(playerid, 1);
	if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
	{
	  new npcname[MAX_PLAYER_NAME];
	  GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
	  if(!strcmp(npcname, "BusDriver", true)) //Checking if the NPC's name is BusDriver
	  {
	    PutPlayerInVehicle(playerid, NPCBus, 0); //Putting the NPC into the vehicle we created for it.
	    return 1;
	  }
	  return 1;
	}
    if(PlayerInfo[playerid][pLoggedIn] && PlayerInfo[playerid][pSpawn])
    {
        FalseBan[playerid] = 0;
        SetTimerEx("FalseBanFix", 6000, false, "i", playerid);
    	SpawnChar(playerid);
   	if(PlayerInfo[playerid][pFac] == 1)
	{
	AddPlayerClass(266,246.4809,86.6398,1003.6406,183.7600,0,0,0,0,0,0); // sapd spawn
	SetPlayerPos(playerid, 246.4809,86.6398,1003.6406);
	return 1;
 	}
    	SetPlayerSkin(playerid, 1);
    }
	return 1;
}
if(PlayerInfo[playerid][pFac] == 1) = IsACop


Re: Special spawn for SAPD - kepa333 - 09.07.2012

mybe u fixed 2nd part but prob is in first part...

Код:
public OnGameModeInit()// try like this
{
     OnPlayerSpawn(playerid);
...
if i helpd rep i need it for ad my server.