NPC leaves 20 seconds after joining
#4

Sorry for the dubs but here is the NPC mini script:

FYI: The .rec file and the NPC mini script have the same file name.

pawn Код:
#include <a_npc>

#define RECORDING "searchnres" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot.

main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
Here is my script:

pawn Код:
#include <a_samp>
#include <a_npc>


main()
{
    print("\n----------------------------------");
    print("You are running Conshock");
    print("Made by iKlipse\n");
    print("\n----------------------------------");
}

new SearchAndRescueVehicle;

public OnGameModeInit()
{
    //Search and rescue NPC
    SearchAndRescueVehicle = CreateVehicle(497, 2834.17, -2042.44, 10.93, 0.0, 0, 1, -0);
    ConnectNPC("SearchAndRescue","searchnres");
    SetGameModeText("ConShock ALPHA");
    SetWeather(11); // (storm set)
    SetWorldTime(0); // (midnight)
    ShowPlayerMarkers(0);
    ShowNameTags(0);
    //Player classes
    AddPlayerClass(124, 3699.64, -3053.98, 0.11, 0, 0, 0, 0, 0, 0);
    //Giant lines of objects and pickups go here, I'm not posting them
  return 1;
}

public OnPlayerSpawn(playerid)
{
  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, "SearchAndRescue", true)) //Checking if the NPC's name is MyFirstNPC
    {
      PutPlayerInVehicle(playerid, SearchAndRescueVehicle, 0); //Putting the NPC into the vehicle we created for it.
    }
    return 1;
  }
  //Other stuff for normal players goes here!
  return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
  if(IsPlayerNPC(playerid)) return 1;
  SetPlayerPos(playerid, 3428.33, -3124.33, 16.82);
    SetPlayerCameraPos(playerid, 3427.11, -3127.62, 16.82);
    SetPlayerCameraLookAt(playerid, 3429.82, -3123.52, 16.82);
    return 1;
}

public OnPlayerConnect(playerid)
{
  new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(string, sizeof(string), "%s has entered The Island", pname);
  SendClientMessageToAll(0xAAAAAAAA, string);
  GameTextForPlayer(playerid,"~r~Welcome to ConShock~n~~w~By~n~~b~iKlipse",5000,5);
  SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
  SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
  return 1;
}
Reply


Messages In This Thread
NPC leaves 20 seconds after joining - by iklipse - 18.05.2010, 15:05
Re: NPC leaves 20 seconds after joining - by Conroy - 18.05.2010, 15:10
Re: NPC leaves 20 seconds after joining - by iklipse - 18.05.2010, 15:26
Re: NPC leaves 20 seconds after joining - by iklipse - 18.05.2010, 15:57

Forum Jump:


Users browsing this thread: 1 Guest(s)