Same 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: Same text. (
/showthread.php?tid=277887)
Same text. -
Millionaire - 19.08.2011
Hello!
If a player type " I am CJ" then he should get a minigun. How to do that?
Re: Same text. -
Bakr - 19.08.2011
Compare the text they send to OnPlayerText with the desired string. If it matches, give them a minigun via the GivePlayerWeapon function.
pawn Код:
public OnPlayerText( playerid, text[ ] )
{
if( !strcmp( text, "I am CJ", true ) )
{
GivePlayerWeapon( playerid, 38, 500 );
}
return 1;
}
Re: Same text. -
Millionaire - 19.08.2011
But it should show first one who type " I am CJ" will get a minigun. this message should show in a particular time.
Re: Same text. -
Kyle_Olsen - 19.08.2011
You could always use
GameTextForPlayer
Re: Same text. -
Kush - 19.08.2011
Quote:
Originally Posted by Kyle_Olsen
|
Why?
PHP код:
new gVar[MAX_PLAYERS];
public OnPlayerText( playerid, text[ ] ) //Bakr's Code
{
if( !strcmp( text, "I am CJ", true ) )
{
if(gVar[playerid] == 0)
{
GivePlayerWeapon( playerid, 38, 500 );
new name[MAX_PLAYER_NAME], string[64];
GetPlayerName(playerid, name, sizeof(name);
format(string, sizeof(string), "%s has type 'I AM CJ!'", name);
SendClientMessageToAll(-1, string);
gVar[playerid] = 1;
}
else if(gVar[playerid] == 1) { return 0; }
return 1;
}
The first player to basically type "I am CJ" will receive a minigun. This will then set the global variable to a value (1) and if one, it returns the text as 0.
Untested.
Re: Same text. -
Millionaire - 19.08.2011
but this message should show every 60 seconds