SA-MP Forums Archive
random text - 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: random text (/showthread.php?tid=87092)



random text - tommy5933 - 18.07.2009

I wanna put in my gm, on like when a random message pops up like "first one to type XHDUWGWE21 gets a car". how can i configure that?

p.s. i seen this in some stunt servers


Re: random text - Rac3r - 18.07.2009

Search "Random Messages". From there, check the code to see how they did it.

Bascially, make a string array, then make a function that picks a random number from the array.

Y-Less made an advanced random text FS, but there are a lot more easier to understand scripts.

EDIT: Just found a tutorial with a simple 2 second search, don't be lazy.
http://forum.sa-mp.com/index.php?topic=92628.0


Re: random text - tommy5933 - 18.07.2009

k thx, one more thing

how can i make it where if they type "XHDUWGWE21" they get whatever it asked for?


Re: random text - Rac3r - 18.07.2009

What do you mean, what they asked for?

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/XHDUWGWE21", cmdtext, true) == 0)
	{
		Ban(playerid);
		SpawnPlayer(playerid);
		SetPlayerHealth(playerid,100.0);
		return 1;
	}
	return 0;
}



Re: random text - tommy5933 - 18.07.2009

Quote:
Originally Posted by [LSD
Rac3r ]
What do you mean, what they asked for?

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/XHDUWGWE21", cmdtext, true) == 0)
	{
		Ban(playerid);
		SpawnPlayer(playerid);
		SetPlayerHealth(playerid,100.0);
		return 1;
	}
	return 0;
}
yea somethin like that but without typing in the "/" just the "XHDUWGWE21"


Re: random text - Rac3r - 18.07.2009

Код:
public OnPlayerText(playerid, text[])
{
	if((strfind(text,"XHDUWGWE21",true)) != -1)
	{
		Ban(playerid);
		SpawnPlayer(playerid);
		SetPlayerHealth(playerid,100.0);
		return 0;
	}
	SendPlayerMessageToAll(playerid,text);
	return 0;
}
So everytime people chat, the server will scan the text for XHDUWGWE21.
I suggest keeping the / command text format.



Re: random text - tommy5933 - 18.07.2009

ok thx that worked, one small problem

when i typed it in the text appeared twice in the chat and everytime i type it in, it gets me what i want. I wanna make it where after the first person that typed it in can only get it and no one else until it appears again as a random message