SA-MP Forums Archive
2NPC'S ONE FS - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 2NPC'S ONE FS (/showthread.php?tid=150105)



2NPC'S ONE FS - luckie12 - 24.05.2010

hi all!

i have some problems with this script:

Код:
#define FILTERSCRIPT

#include <a_samp>
#include <a_npc>


#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_RED 0xFF0000FF

new CopLS;
new busss;

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
  ConnectNPC("Security","copcar");
  ConnectNPC("Busjuh","buss");
    //Vehicles
  	CopLS = CreateVehicle(599, 0.0, 0.0, 5.0, 0.0, 0, 0, 5000);
  	busss = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 0, 0, 5003);
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}


main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}


public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid)) 
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "Security", true)) 
    {
      PutPlayerInVehicle(playerid, CopLS, 0);
      SetPlayerSkin(playerid, 255);
			ResetPlayerWeapons(playerid);
    }
	    if(!strcmp(npcname, "busjuh", true))
    {
      PutPlayerInVehicle(playerid, busss, 0);
			SetPlayerSkin(playerid, 255);
			ResetPlayerWeapons(playerid);
      return 1;
    }
    return 1;
  }

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/Gotobus", cmdtext, true, 3) == 0)
	{
		if(!IsPlayerAdmin(playerid))
		{
			SendClientMessage(playerid, COLOR_RED, "You are not authorised to use this command.");
			return 1;
		}
		PutPlayerInVehicle(playerid, busss, 2);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You were teleported into the bus");
    return 1;
	}
	if (strcmp("/Gotocar", cmdtext, true, 3) == 0)
 {
		if(!IsPlayerAdmin(playerid))
		{
			SendClientMessage(playerid, COLOR_RED, "You are not authorised to use this command.");
			return 1;
 }
		PutPlayerInVehicle(playerid, busss, 2);
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You were teleported into the bus");
    return 1;
	}
	return 0;
}
when i want to compile it i get this
Код:
C:\Documents and Settings\Luc\Bureaublad\pwn\filterscripts\npc.pwn(73) : warning 217: loose indentation
C:\Documents and Settings\Luc\Bureaublad\pwn\filterscripts\npc.pwn(80) : warning 217: loose indentation
C:\Documents and Settings\Luc\Bureaublad\pwn\filterscripts\npc.pwn(82) : warning 209: function "OnPlayerSpawn" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
LINE


Re: 2NPC'S ONE FS - [HiC]TheKiller - 24.05.2010

pawn Код:
public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid))
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "Security", true))
    {
      PutPlayerInVehicle(playerid, CopLS, 0);
      SetPlayerSkin(playerid, 255);
      ResetPlayerWeapons(playerid);
    }
    if(!strcmp(npcname, "busjuh", true))
    {
      PutPlayerInVehicle(playerid, busss, 0);
      SetPlayerSkin(playerid, 255);
      ResetPlayerWeapons(playerid);
    }
  }
  return 1;
}
Indent =].

EDIT: It's not really indented in the post =D.