NPC welcomes new players?
#1

hello..

I've seen on an webpage that there's possible to make bot welcome new players. I mean: player connects, bot says: "Hello, %s!" but I can't find that webpage again
does anyone know how can I do that? sry for my bad english..
Reply
#2

Could possibly be something to do with OnPlayerConnect or OnPlayerSpawn, no idea how you would go about coding it, but yeh.
Reply
#3

Under OnPlayerConnect:

pawn Код:
new str[128];
GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
format(str, 128, "Hello %s!!!", pName);
SendPlayerMessageToAll(0, str); //Change the 0 to the ID of your NPC
Say if there are bugs. ^^
Reply
#4

it will be something like this?
Reply
#5

How would I go about making it random messages from the NPC? My way didn't work out to well. :/
Reply
#6

Just try the code. -_-
Reply
#7

thank you it works
Reply
#8

No problem. Have fun.
Reply
#9

Jeffry, would you know how to set it up so it's a different message each time? I've tried to mess around with the random function but with no luck. Any ideas? Thanks.
Reply
#10

Код:
new str[128];
		GetPlayerName(playerid,pname, MAX_PLAYER_NAME);
		new RandR = random (8);
		if(RandR == 1)
		{
			format(str, 128, "Hello, %s!", pname);
			SendPlayerMessageToAll(0, str);
		}
		else if(RandR == 2)
		{
		    format(str, 128, "%s, what's up?", pname);
			SendPlayerMessageToAll(0, str);
		}
...
this should work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)