Same text.
#1

Hello!
If a player type " I am CJ" then he should get a minigun. How to do that?
Reply
#2

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

But it should show first one who type " I am CJ" will get a minigun. this message should show in a particular time.
Reply
#4

You could always use GameTextForPlayer
Reply
#5

Quote:
Originally Posted by Kyle_Olsen
Посмотреть сообщение
You could always use GameTextForPlayer
Why?

PHP код:
new gVar[MAX_PLAYERS];
public 
OnPlayerTextplayeridtext[ ] ) //Bakr's Code
{
    if( !
strcmptext"I am CJ"true ) )
       {
        if(
gVar[playerid] == 0)
        {
              
GivePlayerWeaponplayerid38500 );
            new 
name[MAX_PLAYER_NAME], string[64];
            
GetPlayerName(playeridnamesizeof(name);
            
format(stringsizeof(string), "%s has type 'I AM CJ!'"name);
            
SendClientMessageToAll(-1string);
            
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.
Reply
#6

but this message should show every 60 seconds
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)