How can i do this? (random word in the connect message) - 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: How can i do this? (random word in the connect message) (
/showthread.php?tid=247138)
How can i do this? (random word in the connect message) -
chaosnz - 08.04.2011
Heres what i got..
Код:
new stringsys [128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(stringsys, sizeof(stringsys), "[SYSTEM] Your Majesty %s has connected ", pName);
SendClientMessageToAll(COLOR_YELLOW, stringsys);
Now what i want to do is change "Your Majesty" into a random phrase defined at the top of the script. But im not sure of how to go about this, i tried creating a random float with different phrases in it, but im unsure of how to actually get the phrases into the above line. Could someone possibly help me out with this?
Re: How can i do this? (random word in the connect message) -
grand.Theft.Otto - 08.04.2011
pawn Код:
new RandomMSG[][] =
{
"You majesty %s has connected!",
"Welcome king or queen, %s!",
"The master has connected. Say hi to %s."
};
public OnPlayerConnect(playerid)
{
new randMSG = random(sizeof(RandomMSG)); //calculates the size of RandomMSG (which is 3)
GetPlayerName(playerid, pName, sizeof(pName));
format(string,sizeof(string),"%s",pName,playerid);
SendClientMessageToAll(0x33CCFFAA, RandomMSG[randMSG]); // Replace the color with your defined color.
return 1;
}
Try this I guess...