SA-MP Forums Archive
NPC problems - please help me - 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: NPC problems - please help me (/showthread.php?tid=156318)



NPC problems - please help me - Tyler_Idy - 22.06.2010

The script:

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


new MeanMSG[][] =
{
  "What kind of stunt are you trying to pull?",
  "Fuck off.",
  "Your an asshole.",
  "Go fuck yourself!",
  "Screw yourself!"
};

new QuestionMSG[][] =
{
  "What kind of stunt are you trying to pull?",
  "What the fuck is that?",
  "I dont have that.",
  "Sorry, i dont have it."
};

public OnNPCModeInit()
{
  print("NPC script loaded");
  return 1;
}

public OnNPCModeExit()
{
  print("NPC script unloaded");
  return 1;
}

public OnPlayerText(playerid, text[])
{
  new meanMSG = random(sizeof(MeanMSG));
  new questionMSG = random(sizeof(QuestionMSG));
  new Float:X,Float:Y,Float:Z;
  GetMyPos(X,Y,Z);
  if(IsPlayerInRangeOfPoint(playerid,10,X,Y,Z))
  {
  	if (strfind(text, "menu") != -1 || strfind(text, "food") != -1 || strfind(text, "sell") != -1)
  	{
  	  SendChat("I have hotdogs, corndogs, suasages and hamburgers. Everything is 2 bucks.");
  	}
  	if (strfind(text, "fuck you") != -1 || strfind(text, "asshole") != -1 || strfind(text, "doosh") != -1 || strfind(text, "cunt") != -1 || strfind(text, "fucker") != -1 || strfind(text, "fag") != -1 || strfind(text, "bitch") != -1 || strfind(text, "ho") != -1)
  	{
  	  SendChat(MeanMSG[meanMSG]);
		}
  	if(GetPlayerMoney(playerid) >= 2)
  	{
  		if (strfind(text, "hotdog") != -1)
  		{
  		  SendChat("Here is your hotdog. Thank you for your business!");
  		  GivePlayerMoney(playerid, -2);
  		  SetPlayerHealth(playerid, 100);
  		}
  		else if (strfind(text, "sausage") != -1)
  		{
  		  SendChat("Here is your sausage. Thank you for your business!");
  		  GivePlayerMoney(playerid, -2);
  		  SetPlayerHealth(playerid, 100);
  		}
  		else if (strfind(text, "corndog") != -1)
  		{
  		  SendChat("Here is your corndog. Thank you for your business!");
  		  GivePlayerMoney(playerid, -2);
  		  SetPlayerHealth(playerid, 100);
  		}
  		else if (strfind(text, "burger") != -1)
  		{
  		  SendChat("Here is your burger. Thank you for your business!");
  		  GivePlayerMoney(playerid, -2);
  		  SetPlayerHealth(playerid, 100);
  		}
  		else
  		{
  		  SendChat(QuestionMSG[questionMSG]);
			}
	 	}
		else
		{
		SendChat("Im sorry, you dont have enough money.");
		}
	}
  	return 1;
}
The errors:

Код:
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(23) : warning 235: public function lacks forward declaration (symbol "OnNPCModeInit")
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(29) : warning 235: public function lacks forward declaration (symbol "OnNPCModeExit")
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(40) : error 017: undefined symbol "GetMyPos"
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(45) : error 017: undefined symbol "SendChat"
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(49) : error 017: undefined symbol "SendChat"
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(55) : error 017: undefined symbol "SendChat"
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(61) : error 017: undefined symbol "SendChat"
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(67) : error 017: undefined symbol "SendChat"
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(73) : error 017: undefined symbol "SendChat"
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(79) : error 017: undefined symbol "SendChat"
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(84) : error 017: undefined symbol "SendChat"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


9 Errors.



Re: NPC problems - please help me - titanak - 22.06.2010

// Script top

pawn Код:
new GetMyPos;
new SendChat;

forward OnNPCModeInit();
forward OnNPCModeExit();



Re: NPC problems - please help me - Tyler_Idy - 22.06.2010

You have to declare that? I thought it already was??

EDIT:

More errors

Script:

Код:
#include <a_samp>

new GetMyPos;
new SendChat;

forward OnNPCModeInit();
forward OnNPCModeExit();


new MeanMSG[][] =
{
  "What kind of stunt are you trying to pull?",
  "Fuck off.",
  "Your an asshole.",
  "Go fuck yourself!",
  "Screw yourself!"
};

new QuestionMSG[][] =
{
  "What kind of stunt are you trying to pull?",
  "What the fuck is that?",
  "I dont have that.",
  "Sorry, i dont have it."
};

public OnNPCModeInit()
{
  print("NPC script loaded");
  return 1;
}

public OnNPCModeExit()
{
  print("NPC script unloaded");
  return 1;
}

public OnPlayerText(playerid, text[])
{
  new meanMSG = random(sizeof(MeanMSG));
  new questionMSG = random(sizeof(QuestionMSG));
  new Float:X,Float:Y,Float:Z;
45  GetMyPos(X,Y,Z);
  if(IsPlayerInRangeOfPoint(playerid,10,X,Y,Z))
  {
  	if (strfind(text, "menu") != -1 || strfind(text, "food") != -1 || strfind(text, "sell") != -1)
  	{
  	  SendChat("I have hotdogs, corndogs, suasages and hamburgers. Everything is 2 bucks.");
  	}
  	if (strfind(text, "fuck you") != -1 || strfind(text, "asshole") != -1 || strfind(text, "doosh") != -1 || strfind(text, "cunt") != -1 || strfind(text, "fucker") != -1 || strfind(text, "fag") != -1 || strfind(text, "bitch") != -1 || strfind(text, "ho") != -1)
  	{
  	  SendChat(MeanMSG[meanMSG]);
		}
  	if(GetPlayerMoney(playerid) >= 2)
  	{
  		if (strfind(text, "hotdog") != -1)
  		{
  		  SendChat("Here is your hotdog. Thank you for your business!");
  		  GivePlayerMoney(playerid, -2);
  		  SetPlayerHealth(playerid, 100);
  		}
  		else if (strfind(text, "sausage") != -1)
  		{
  		  SendChat("Here is your sausage. Thank you for your business!");
  		  GivePlayerMoney(playerid, -2);
  		  SetPlayerHealth(playerid, 100);
  		}
  		else if (strfind(text, "corndog") != -1)
  		{
  		  SendChat("Here is your corndog. Thank you for your business!");
  		  GivePlayerMoney(playerid, -2);
  		  SetPlayerHealth(playerid, 100);
  		}
  		else if (strfind(text, "burger") != -1)
  		{
  		  SendChat("Here is your burger. Thank you for your business!");
  		  GivePlayerMoney(playerid, -2);
  		  SetPlayerHealth(playerid, 100);
  		}
  		else
  		{
  		  SendChat(QuestionMSG[questionMSG]);
			}
	 	}
		else
		{
		SendChat("Im sorry, you dont have enough money.");
		}
	}
  	return 1;
}
Errors:

Код:
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(45) : error 012: invalid function call, not a valid address
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(45) : warning 215: expression has no effect
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(45) : warning 215: expression has no effect
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(45) : warning 215: expression has no effect
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(45) : error 001: expected token: ";", but found ")"
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(45) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Documents\SA-MP Server\npcmodes\Hotdogs.pwn(45) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: NPC problems - please help me - titanak - 22.06.2010

can you paste line 45 Here please.


Re: NPC problems - please help me - Tyler_Idy - 22.06.2010

GetMyPos(X,Y,Z);


Re: NPC problems - please help me - zallomallo - 22.06.2010

That won't work. You have to use GetPlayerPos(playerid, X, Y, Z);


Re: NPC problems - please help me - Tyler_Idy - 22.06.2010

Quote:
Originally Posted by zallomallo
That won't work. You have to use GetPlayerPos(playerid, X, Y, Z);
How do I get it to know wher the NPC's x,y,z are then? Just the playerid? wouldnt that return the player talking?


Re: NPC problems - please help me - titanak - 22.06.2010

hmm.


Re: NPC problems - please help me - Toni - 22.06.2010

Btw. You're messages might not work due to your array's If your gonna use them, add arrays.

// first array = how manny messages, 2nd array = How many characters in the array (or string)

Just a suggestion.


Re: NPC problems - please help me - titanak - 22.06.2010

Edited:

_________________________________________________
pawn Код:
new Float:X, Float:Y,Float:Z;
GetMyPos(X, Y, Z);