Hat problem
#1

I want to set that players get this hat when spawning,so i put it on OnPlayerSpawn.But it doesnt show,what am I doing wrong?

Код:
SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
Reply
#2

SetPlayerAttachedObject( playerid, 1,19065, 2, 0.094485, 0.007215, 0.0, 0.000000, 0.000000, 0.000000, 1.200000, 1.200000, 1.200000 );

Try this one.
Reply
#3

Again no hat...
Reply
#4

Show me OnPlayerSpawn code
Reply
#5

Код:
// This callback gets called when a player spawns somewhere
public OnPlayerSpawn(playerid)
{
	//Kapica
	SetPlayerAttachedObject( playerid, 1,19065, 2, 0.094485, 0.007215, 0.0, 0.000000, 0.000000, 0.000000, 1.200000, 1.200000, 1.200000 );

	// Always allow NPC's to spawn without logging in
	if (IsPlayerNPC(playerid))
		return 0;

	// Check if the player properly logged in by typing his password
	if (APlayerData[playerid][LoggedIn] == false)
	{
		SendClientMessage(playerid, 0xFFFFFFFF, TXT_FailedLoginProperly);
	    Kick(playerid); // Kick the player if he didn't log in properly
	}

	// Setup local variables
	new missiontext[200];

	// Spawn the player in the global world (where everybody plays the game)
    SetPlayerVirtualWorld(playerid, 0);
	SetPlayerInterior(playerid, 0);
	// Also set a variable that tracks in which house the player currently is
	APlayerData[playerid][CurrentHouse] = 0;

	// Disable the clock
	TogglePlayerClock(playerid, 0);

	// Delete all weapons from the player
	ResetPlayerWeapons(playerid);

	// Set the missiontext based on the chosen class
	switch (APlayerData[playerid][PlayerClass])
	{
		case ClassTruckDriver: // Truck-driver class
		{
			format(missiontext, sizeof(missiontext), Trucker_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassTruckDriver); // Set the playercolor (chatcolor for the player and color on the map)
		}
		case ClassBusDriver: // Bus-driver class
		{
			format(missiontext, sizeof(missiontext), BusDriver_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassBusDriver); // Set the playercolor (chatcolor for the player and color on the map)
		}
		case ClassPilot: // Pilot class
		{
			format(missiontext, sizeof(missiontext), Pilot_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassPilot); // Set the playercolor (chatcolor for the player and color on the map)
		}
		case ClassPolice: // Police class
		{
			format(missiontext, sizeof(missiontext), Police_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassPolice); // Set the playercolor (chatcolor for the player and color on the map)
			// Start the PlayerCheckTimer to scan for wanted players (be sure the timer has been destroyed first)
			KillTimer(APlayerData[playerid][PlayerCheckTimer]);
			APlayerData[playerid][PlayerCheckTimer] = SetTimerEx("Police_CheckWantedPlayers", 1000, true, "i", playerid);
			// Check if the police player can get weapons
			if (PoliceGetsWeapons == true)
			{
			    // Give up to 12 weapons to the player
				for (new i; i < 6; i++)
				    GivePlayerWeapon(playerid, APoliceWeapons[i], PoliceWeaponsAmmo);
			}
		}
		case ClassMafia: // Mafia class
		{
			format(missiontext, sizeof(missiontext), Mafia_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassMafia); // Set the playercolor (chatcolor for the player and color on the map)
			// Start the PlayerCheckTimer to scan for players that carry mafia-loads (be sure the timer has been destroyed first)
			KillTimer(APlayerData[playerid][PlayerCheckTimer]);
			APlayerData[playerid][PlayerCheckTimer] = SetTimerEx("Mafia_CheckMafiaLoads", 1000, true, "i", playerid);
   			if (APlayerData[playerid][PlayerScore] < 100)
		    {
			   	// Give up to 12 weapons to the player
				for (new i; i < 2; i++)
			   GivePlayerWeapon(playerid, AMafiaWeapons[i], PoliceWeaponsAmmo);
			}
		}
		case ClassMedic: // Pilot class
		{
			format(missiontext, sizeof(missiontext), Medic_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassMedic); // Set the playercolor (chatcolor for the player and color on the map)
		}
		case ClassCourier: // Courier class
		{
			format(missiontext, sizeof(missiontext), Courier_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassCourier); // Set the playercolor (chatcolor for the player and color on the map)
		}
		case ClassAssistance: // Assistance class
		{
			format(missiontext, sizeof(missiontext), Assistance_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassAssistance); // Set the playercolor (chatcolor for the player and color on the map)
			// Start the PlayerCheckTimer to scan for players who need assistance (be sure the timer has been destroyed first)
			KillTimer(APlayerData[playerid][PlayerCheckTimer]);
			APlayerData[playerid][PlayerCheckTimer] = SetTimerEx("Assistance_CheckPlayers", 1000, true, "i", playerid);
		}
		case ClassRoadWorker: // Roadworker class
		{
			format(missiontext, sizeof(missiontext), RoadWorker_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassRoadWorker); // Set the playercolor (chatcolor for the player and color on the map)
	     }
		case ClassTashMaster: // Courier class
		{
			format(missiontext, sizeof(missiontext), TashMaster_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassTashMaster); // Set the playercolor (chatcolor for the player and color on the map)
		}
		case ClassTaxi: // Bus-driver class
		{
			format(missiontext, sizeof(missiontext), Taxi_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassTaxi); // Set the playercolor (chatcolor for the player and color on the map)
		}
		case ClassMilitary: //
		{
					    // Give up to 12 weapons to the player
			format(missiontext, sizeof(missiontext), Military_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassMilitary); // Set the playercolor (chatcolor for the player and color on the map)
			for (new i; i < 4; i++)
  			{
   			GivePlayerWeapon(playerid, AMPWeapons[i], PoliceWeaponsAmmo);
			}
		}
		case ClassRibar: // Pilot class
		{
			format(missiontext, sizeof(missiontext), Medic_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassRibar); // Set the playercolor (chatcolor for the player and color on the map)
		}
		case ClassIce: // Pilot class
		{
			format(missiontext, sizeof(missiontext), Medic_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassIce); // Set the playercolor (chatcolor for the player and color on the map)
		}
		case ClassFarmer: // Pilot class
		{
			format(missiontext, sizeof(missiontext), Medic_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassFarmer); // Set the playercolor (chatcolor for the player and color on the map)
		}
		case ClassDiler: // Pilot class
		{
			format(missiontext, sizeof(missiontext), Diler_NoJobText); // Preset the missiontext
			SetPlayerColor(playerid, ColorClassDiler); // Set the playercolor (chatcolor for the player and color on the map)
			for (new i; i < 2; i++)
  			{
			GivePlayerWeapon(playerid, AMafiaWeapons[i], PoliceWeaponsAmmo);
			}
		}
	}
	// Set the missiontext
	TextDrawSetString(APlayerData[playerid][MissionText], missiontext);
	// Show the missiontext for this player
	TextDrawShowForPlayer(playerid, APlayerData[playerid][MissionText]);

	if(APlayerData[playerid][VIPLevel] >= 1)
	{
	    Tekstovi[playerid] = Create3DTextLabel("", COLOR_RED, 30.0, 40.0, 50.0, 40.0, 0);
		Attach3DTextLabelToPlayer(Tekstovi[playerid], playerid, 0.0, 0.0, 0.7);
	}
	// If the player spawns and his jailtime hasn't passed yet, put him back in jail
	if (APlayerData[playerid][PlayerJailed] != 0)
	    Police_JailPlayer(playerid, APlayerData[playerid][PlayerJailed]);

	return 1;
}
Reply
#6

This code is working fine:
Код:
SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
Reply
#7

Why doesnt it work for me?
Reply
#8

Quote:
Originally Posted by xxxSpeedxxx
Посмотреть сообщение
Why doesnt it work for me?
Maybe because you using this code
Код:
SetPlayerAttachedObject( playerid, 1,19065, 2, 0.094485, 0.007215, 0.0, 0.000000, 0.000000, 0.000000, 1.200000, 1.200000, 1.200000 );
instead of this:
Код:
SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
Reply
#9

No,I used your's but still it's not working.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)