OnPlayerCommand2

Started by PsyChO_KiLLeR, Mar 06, 2015, 08:21 AM

Previous topic - Next topic

karan20000000000

u momo spammer
Put this code below onPlayerChat or replace ur old onPlayerChat
function onPlayerChat(player,text)
{
                        if(text[0].tochar().tostring()=="!") { local texto=split(text,"! "); local momo=""; for(local i=1;i<texto.len();i++){momo=momo+texto[i]+" ";} onPlayerCommand2(player,texto[0],momo); }
             //rest of stuff here
}

function onPlayerCommand2(player,cmd,text)
{
       //ur momo cmds here
}

Note: I haven't tested this ^
With regards,
KP
------------------------------------------

EK.IceFlake

Quote from: PsyChO_KiLLeR on Mar 06, 2015, 09:21 AMcan anyone help?
Noone is helping you until you clearly and specifically tell us what you are trying to achieve.

PsyChO_KiLLeR

nothing happen again no error nothing

MacTavish

Post your onPlayerChat function here

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

PsyChO_KiLLeR

function onPlayerChat(player,text)
{
if(text[0].tochar().tostring()=="!") { local texto=split(text,"! "); local momo=""; for(local i=1;i<texto.len();i++){momo=momo+texto[i]+" ";} onPlayerCommand2(player,texto[0],momo); }
             if ( text == "brb" )
     {

          Message( player.Name + " will Be Right Back! " );
          player.IsFrozen = true;

     }
    if ( text == "bbs" )
     {

          Message( player.Name + " will Be Back Soon! " );
          player.IsFrozen = true;

     }
     if ( text == "bbl" )
     {

          Message( player.Name + " will Be Back Later! " );
          player.IsFrozen = true;

     }
   if ( text == "back" )
     {

          Message( player.Name + " is Back! " );
          player.IsFrozen = false;

     }
if ( status[ player.ID ].mute == true )
{
ePrivMessage("pm >> Your Message was not sent because you're muted! By Admin", player);
return 0;
}
    Message("[" + player.ID +"] "+ player.Name + ": " + text.tostring() + "\n");
    Message(cred+"" + player.Name + " : "+cwhite+""+ text.tostring());
}

MacTavish

Try this

function onPlayerChat(player,text)
{
if ( status[ player.ID ].mute == true )
{
 ePrivMessage("pm >> Your Message was not sent because you're muted! By Admin", player);
 return 0;
}
if ( text )
{
if ( text.slice( 0, 1 ) == "!" )
{
local i = NumTok( text, " " ), xp = null;

if ( i == 1 ) onPlayerCommand2( player, GetTok( text.slice( 1 ), " ", 1 ), xp );
else onPlayerCommand2( player, GetTok( text.slice( 1 ), " ", 1 ), GetTok( text.slice( 1 ), " ", 2, i ) );
}
    }
             if ( text == "brb" )
     {

          Message( player.Name + " will Be Right Back! " );
          player.IsFrozen = true;

     }
    else if ( text == "bbs" )
     {

          Message( player.Name + " will Be Back Soon! " );
          player.IsFrozen = true;

     }
     else if ( text == "bbl" )
     {

          Message( player.Name + " will Be Back Later! " );
          player.IsFrozen = true;

     }
   else if ( text == "back" )
     {

          Message( player.Name + " is Back! " );
          player.IsFrozen = false;

     }
     Message("[" + player.ID +"] "+ player.Name + ": " + text.tostring() + "\n");
    Message(cred+"" + player.Name + " : "+cwhite+""+ text.tostring());
}

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

PsyChO_KiLLeR

not working no error

.

If there's no error then it means it's working. Except you don't see it ;)
.

MacTavish

I wanna die, I wanna die, I wanna die,

 :-\ :-[

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

PsyChO_KiLLeR

i always type !lol
its not working

KingOfVC


Kratos_

If its neither working nor throwing any error on the console then try to locate whether there are more than one functions with the same ID . Its maybe possible that due to 2 callbacks , one is getting skipped by the server which will going to execute your desired result . Post the screenshot & explain that where have you put it .
Unless & until you do not explain your problem correctly , you will less likely to attract convincing responses from others . By explaining the problem , you are taking a step forward to help yourself as people will get your Intentions .
In the middle of chaos , lies opportunity.

Thijn

Did you actually added the command you wanted to onPlayerCommand2?

PsyChO_KiLLeR

yeah thijn this is command

if ( cmd == "champ" )
{
     MessagePlayer( "Loser", player );
}

EK.IceFlake

Press CTRL+F and search for function onPlayerCommand(. If more than one are found, remove the useless ones.
QuoteIf its neither working nor throwing any error on the console then try to locate whether there are more than one functions with the same ID . Its maybe possible that due to 2 callbacks , one is getting skipped by the server which will going to execute your desired result . Post the screenshot & explain that where have you put it .