SA-MP Forums Archive
Simple question. - 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: Simple question. (/showthread.php?tid=116566)



Simple question. - Striker_Moe - 29.12.2009

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.


Re: Simple question. - Tigerbeast11 - 29.12.2009

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.


Re: Simple question. - Striker_Moe - 29.12.2009

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


Re: Simple question. - Striker_Moe - 29.12.2009

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


Re: Simple question. - Tigerbeast11 - 29.12.2009

try summing like this?

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




Re: Simple question. - Striker_Moe - 29.12.2009

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


Re: Simple question. - Joe Staff - 29.12.2009

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);



Re: Simple question. - Micko9 - 24.01.2010

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