Simple question.
#1

Hai.

Iґve recently scripted a greeting-bot. This is what Iґve got:

Код:
new GREETING[][] = {"Yo %s!","Whatґs up %s?","Hi there %s","Welcome, %s!","Hey %s!","Wassup %s?"};
Код:
	new string[128],name[24];
	GetPlayerName(playerid,name,sizeof(name));
	format(string,sizeof(string),"Megan: %s",GREETING[random(sizeof(GREETING))]
	SendClientMessageToAll(WHITE,string);
Whats wrong? The name is not getting displayed.
Reply
#2

hnmm, i know whats wrong but i don't know how to fix it. I'll tell u the problem, maybe u can fix it yourself?


thew "new greetings" string hasnt been assigned to getplayername. I hope u understand.
Reply
#3

Yes Iґve thought that before, but I dont know where to place the name.
Reply
#4

Anyone? It shouldnt be that hard, Im just too dumb atm to fix it myself..
Reply
#5

try summing like this?

pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));

Reply
#6

Oh god.. you didnt even read my problem, did you?
Reply
#7

Simple fix.

pawn Код:
new string[128]; //Only 1 string is needed for this.
  GetPlayerName(playerid,string,sizeof(string));
  format(string,sizeof(string),GREETING[random(sizeof(GREETING))],string);
  strins(string,"Megan: ",0);
  SendClientMessageToAll(WHITE,string);
Reply
#8

Quote:
Originally Posted by Mo3
Oh god.. you didnt even read my problem, did you?
idk what u want it send the msg every 1 minute or so? well this is what i think you need

pawn Код:
forward GreetingsBot(playerid);

SetTimer(GreetingsBot, 60000, true); // 60 000 = 1 minute , 1 = 1 milisecond e.t.c. 1000 = 1 second...

public GreetingsBot(playerid)
{
   new PlrName[MAX_PLAYER_NAME];
   new format_string[255]; // 255 = LNENGHT 255 is max
   GetPlayerName(playerid, PlrName, sizeof(PlrName));
   format(format_string,sizeof(format_string),"Jeffry : Hey There %s !", PlrName);
   SendClientMessageToAll(0xAA000AA, PlrName);
}
REMEMBER : untested :] good luck
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)