random text
#1

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
Reply
#2

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
Reply
#3

k thx, one more thing

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

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;
}
Reply
#5

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"
Reply
#6

Код:
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.
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)