SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 22/01/2010, 02:14 AM   #621
Lucas Giovanni
Big Clucker
 
Join Date: Jul 2008
Posts: 65
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

That I do not know to answer
Lucas Giovanni is offline   Reply With Quote
Old 23/01/2010, 09:22 PM   #622
Samy Romafia
Little Clucker
 
Join Date: Dec 2009
Posts: 44
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

Please help me

my gm
Code:
public OnPlayerSpawn(playerid)
{
 if(IsPlayerNPC(playerid)) //Verifica daca playerul este NPC
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname)); //Luam numele NPCului
    if(!strcmp(npcname, "SamyRomafiaDrift", true)) //Verificam daca numele NPCului este "NUME"
    {
      PutPlayerInVehicle(playerid, NPCvehicle, 562); //Punem NPCul in vehicul
    }
    return 1;
  }

  //Celelalte lucruri din OnPlayerSpawn

  return 1;
  }
	SetPlayerHealth(playerid,9000.0);
	SendClientMessage(playerid, 0x1111AAFF, "Divertiti!");
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	GameTextForPlayer(playerid,"~w~SEI MORTO",1000,1);
	return 0;
}
and error
Code:
C:\Users\HP\Desktop\tutto\Programmi\Gta\server\Drift - Copia\gamemodes\ClanDrift.pwn(910) : warning 217: loose indentation
C:\Users\HP\Desktop\tutto\Programmi\Gta\server\Drift - Copia\gamemodes\ClanDrift.pwn(912) : error 021: symbol already defined: "SetPlayerHealth"
C:\Users\HP\Desktop\tutto\Programmi\Gta\server\Drift - Copia\gamemodes\ClanDrift.pwn(914) : error 010: invalid function or declaration
Samy Romafia is offline   Reply With Quote
Old 23/01/2010, 09:33 PM   #623
Samy Romafia
Little Clucker
 
Join Date: Dec 2009
Posts: 44
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

Quote:
Originally Posted by Samy Romafia
Please help me

my gm
Code:
public OnPlayerSpawn(playerid)
{
 if(IsPlayerNPC(playerid)) //Verifica daca playerul este NPC
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname)); //Luam numele NPCului
    if(!strcmp(npcname, "SamyRomafiaDrift", true)) //Verificam daca numele NPCului este "NUME"
    {
      PutPlayerInVehicle(playerid, NPCvehicle, 562); //Punem NPCul in vehicul
    }
    return 1;
  }

  //Celelalte lucruri din OnPlayerSpawn

  return 1;
  }
	SetPlayerHealth(playerid,9000.0);
	SendClientMessage(playerid, 0x1111AAFF, "Divertiti!");
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	GameTextForPlayer(playerid,"~w~SEI MORTO",1000,1);
	return 0;
}
and error
Code:
C:\Users\HP\Desktop\tutto\Programmi\Gta\server\Drift - Copia\gamemodes\ClanDrift.pwn(910) : warning 217: loose indentation
C:\Users\HP\Desktop\tutto\Programmi\Gta\server\Drift - Copia\gamemodes\ClanDrift.pwn(912) : error 021: symbol already defined: "SetPlayerHealth"
C:\Users\HP\Desktop\tutto\Programmi\Gta\server\Drift - Copia\gamemodes\ClanDrift.pwn(914) : error 010: invalid function or declaration
Please help
Samy Romafia is offline   Reply With Quote
Old 24/01/2010, 01:36 AM   #624
bluray
Big Clucker
 
Join Date: Nov 2009
Posts: 96
Reputation: 7
Default Re: Tutorial -> Creating a new NPC

ok it would really help if the numbers of the lines were shown.

im guessing that the lose indentation is from here:

Code:
 
if(IsPlayerNPC(playerid)) //Verifica daca playerul este NPC
    {
        new npcname[MAX_PLAYER_NAME];
change this to

Code:
 
if(IsPlayerNPC(playerid)) //Verifica daca playerul este NPC
{   // this bracket has to be under if
        new npcname[MAX_PLAYER_NAME];
bluray is offline   Reply With Quote
Old 24/01/2010, 01:43 AM   #625
bluray
Big Clucker
 
Join Date: Nov 2009
Posts: 96
Reputation: 7
Default Re: Tutorial -> Creating a new NPC

youre thing is really confusing i'm guessing that the SetPlayerHealth is not for npc but the norm players so maybe do this.
Code:
public OnPlayerSpawn(playerid)
{
   if(IsPlayerNPC(playerid)) //Verifica daca playerul este NPC
   {
       new npcname[MAX_PLAYER_NAME];
       GetPlayerName(playerid, npcname, sizeof(npcname)); //Luam numele NPCului
       if(!strcmp(npcname, "SamyRomafiaDrift", true)) //Verificam daca numele NPCului este "NUME"
       {
             PutPlayerInVehicle(playerid, NPCvehicle, 562); //Punem NPCul in vehicul
        }
    return 1;
    }

  //Celelalte lucruri din OnPlayerSpawn

  
   {
	SetPlayerHealth(playerid,9000.0);
	SendClientMessage(playerid, 0x1111AAFF, "Divertiti!");
	
   }
   return 1;
}
bluray is offline   Reply With Quote
Old 24/01/2010, 06:33 AM   #626
deather
Huge Clucker
 
deather's Avatar
 
Join Date: Dec 2009
Location: India
Posts: 360
Reputation: 2
Default Re: Tutorial -> Creating a new NPC

I have doen all things perfect. But my bot stands in the same place. I dont know why.
Code:
#include <a_samp>
#define COLOR_WEED 0x90EE90FF
new taxiv;

public OnFilterScriptInit()
{
  ConnectNPC("TDriver-Matthew","taxi1");
  taxiv = AddStaticVehicle(420, 2051.0278,864.7225,6.7714,0,0, 500);
  return 1;
}
public OnFilterScriptExit()
{
	return 1;
}
main()
{
	print("\n----------------------------------");
	print(" Taxi NPCs By DEATHER - Dare to Die");
	print("----------------------------------\n");
}

public OnPlayerConnect(playerid)
{
	if(IsPlayerNPC(playerid)) {
	  new ip_addr_npc[64+1];
	  new ip_addr_server[64+1];
	  GetServerVarAsString("bind",ip_addr_server,64);
	  GetPlayerIp(playerid,ip_addr_npc,64);

		if(!strlen(ip_addr_server)) {
		  ip_addr_server = "127.0.0.1";
		}

		if(strcmp(ip_addr_npc,ip_addr_server,true) != 0) {
		  printf("NPC: Got a remote NPC connecting from %s and I'm kicking it.",ip_addr_npc);
		  Kick(playerid);
		  return 0;
		}
    printf("NPC: Connection from %s is allowed.",ip_addr_npc);
	}
	SendClientMessage(playerid,COLOR_WEED,"\n----------------------------------");
	SendClientMessage(playerid,COLOR_WEED," Taxi NPCs By DEATHER - Dare to Die");
	SendClientMessage(playerid,COLOR_WEED,"----------------------------------\n");
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	if(!IsPlayerNPC(playerid)) return 0; 
	new playername[64];
	GetPlayerName(playerid,playername,64);

 	if(!strcmp(playername,"TDriver-Matthew",true)) {
    SetSpawnInfo(playerid,69,217,2051.0278,864.7225,6.7714,0.0,-1,-1,-1,-1,-1,-1);
    }
  return 1;
}

public OnPlayerSpawn(playerid)
{
 if(IsPlayerNPC(playerid))
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "TDriver-Matthew", true))
    {
      PutPlayerInVehicle(playerid, taxiv, 0);
      return 1;
    }
 	}
 return 1;
}
deather is offline   Reply With Quote
Old 24/01/2010, 02:43 PM   #627
AlExAlExAlEx
Huge Clucker
 
Join Date: Nov 2008
Posts: 212
Reputation: 5
Default Re: Tutorial -> Creating a new NPC

Everything works fine but the NPC's name won't show over his head, why ?
AlExAlExAlEx is offline   Reply With Quote
Old 25/01/2010, 07:14 PM   #628
x.X.LEGENDARIO.X.x
Big Clucker
 
Join Date: Jan 2010
Posts: 85
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

i need some help what is the npc_record FS? can somebody send it to me or post a links for download?
x.X.LEGENDARIO.X.x is offline   Reply With Quote
Old 26/01/2010, 12:34 AM   #629
bluray
Big Clucker
 
Join Date: Nov 2009
Posts: 96
Reputation: 7
Default Re: Tutorial -> Creating a new NPC

Quote:
Originally Posted by x.X.LEGENDARIO.X.x
i need some help what is the npc_record FS? can somebody send it to me or post a links for download?
it comes with the normal samp server. it should be in ur fs list.
bluray is offline   Reply With Quote
Old 26/01/2010, 12:38 AM   #630
x.X.LEGENDARIO.X.x
Big Clucker
 
Join Date: Jan 2010
Posts: 85
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

Quote:
Originally Posted by bluray
Quote:
Originally Posted by x.X.LEGENDARIO.X.x
i need some help what is the npc_record FS? can somebody send it to me or post a links for download?
it comes with the normal samp server. it should be in ur fs list.
nope. i downloaded the samp server again and it does not have it
x.X.LEGENDARIO.X.x is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with NPC creating the_zande Help Archive 2 09/07/2010 11:44 PM
help creating a new gm Lookin Help Archive 8 16/06/2010 03:23 PM
I need a tut on creating kujox32 Help Archive 0 05/05/2010 02:16 AM
Creating Box VirSpectorX Help Archive 5 15/04/2010 02:47 PM
Help creating my own... x.X.LEGENDARIO.X.x Everything and Nothing 20 06/02/2010 03:40 PM


All times are GMT. The time now is 04:13 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.