can someone fix myproblem

Started by mafiadz02, May 27, 2020, 08:09 PM

Previous topic - Next topic

mafiadz02

this the problem iam wanna just this character use this command and i got it stuck not working
function ScriptLoad()
{
 AddClass(3,RGB(0,255,255),5,Vector(0,0,0),3.275983006,0,0,0,0,0,0);
}

function onPlayerCommand( player, cmd, text )
{
     if(cmd == "wep" )
     {
       if(player.Class == 3)
       {
         local plr = FindPlayer(text);
          plr.SetWeapon(33,5000)
        }
    } 
}
pc spec pentium 4 and 2gb ram and windows 10 32 bit and iam using it cuz iam like  coding

SHy^

#1
Can you post the pic of what error says and btw,
your AddClass function seems to be wrong.

Find the correct function(with parameters) and examples here:

AddClass function(click me)

/wep command(Credits: DizzasteR)
else if( cmd == "wep" || cmd == "we" )
{
 if( !text ) return MessagePlayer( "[#FF0000]/wep <wep 1> <wep 2> <...>", player );
 else
 {
  local params = split( text, " " ); // Take out the space array
  local weapons; // Create a new null variable which will be holding the list of weapons player took.
  for( local i = 0; i <= params.len() - 1; i++ ) // since the 'len' returns value from 1 and array's starting value point is 0, we will use len() - 1 otherwise we'll receive an error.
  {
   if( !IsNum( params[i] ) && GetWeaponID( params[i] ) && GetWeaponID( params[i] ) > 0 && GetWeaponID( params[i] ) <= 32 ) // if Name was specified.
   {
    player.SetWeapon( GetWeaponID( params[i] ), 99999 ); // Get the weapon ID from its Name
    weapons = weapons + " " + GetWeaponName( GetWeaponID( params[i] ) ); // Add the weapon name to given weapon list
   }
   else if( IsNum( params[i] ) && params[i].tointeger() < 33 && params[i].tointeger() > 0 ) // if ID was specified
   {
    player.SetWeapon( params[i].tointeger(), 99999 ); // Then just give player that weapon
    weapons = weapons + " " + GetWeaponName( params[i].tointeger() ); // Get the weapon name from the ID and add it.
   }
   else MessagePlayer( "[#FF0000]Invalid Weapon Name/ID!", player ); // if the invalid ID/Name was given
  }
 
  if( weapons != null ) MessagePlayer( "[#00FF00]Received weapons: [#FFFFFF]" + weapons );
  else MessagePlayer( "[#FF0000]No weapons specified", player );
 }
}

Just add if ( player.Class = 3 ) before it. :)

mafiadz02

Quote from: FlutterShy on May 27, 2020, 08:40 PMCan you post the pic of what error says and btw,
your AddClass function seems to be wrong.

Find the correct function(with parameters) and examples here:

AddClass function(click me)

/wep command(Credits: DizzasteR)
else if( cmd == "wep" || cmd == "we" )
{
 if( !text ) return MessagePlayer( "[#FF0000]/wep <wep 1> <wep 2> <...>", player );
 else
 {
  local params = split( text, " " ); // Take out the space array
  local weapons; // Create a new null variable which will be holding the list of weapons player took.
  for( local i = 0; i <= params.len() - 1; i++ ) // since the 'len' returns value from 1 and array's starting value point is 0, we will use len() - 1 otherwise we'll receive an error.
  {
   if( !IsNum( params[i] ) && GetWeaponID( params[i] ) && GetWeaponID( params[i] ) > 0 && GetWeaponID( params[i] ) <= 32 ) // if Name was specified.
   {
    player.SetWeapon( GetWeaponID( params[i] ), 99999 ); // Get the weapon ID from its Name
    weapons = weapons + " " + GetWeaponName( GetWeaponID( params[i] ) ); // Add the weapon name to given weapon list
   }
   else if( IsNum( params[i] ) && params[i].tointeger() < 33 && params[i].tointeger() > 0 ) // if ID was specified
   {
    player.SetWeapon( params[i].tointeger(), 99999 ); // Then just give player that weapon
    weapons = weapons + " " + GetWeaponName( params[i].tointeger() ); // Get the weapon name from the ID and add it.
   }
   else MessagePlayer( "[#FF0000]Invalid Weapon Name/ID!", player ); // if the invalid ID/Name was given
  }
 
  if( weapons != null ) MessagePlayer( "[#00FF00]Received weapons: [#FFFFFF]" + weapons );
  else MessagePlayer( "[#FF0000]No weapons specified", player );
 }
}

Just add if ( player.Class = 3 ) before it. :)
bro i mean the class its not normal like the class 2 i do if (player.Class == 2) not working it will do other class
pc spec pentium 4 and 2gb ram and windows 10 32 bit and iam using it cuz iam like  coding

SHy^

#3
Quote from: mafiadz02 on May 27, 2020, 09:37 PM
Quote from: FlutterShy on May 27, 2020, 08:40 PMCan you post the pic of what error says and btw,
your AddClass function seems to be wrong.

Find the correct function(with parameters) and examples here:

AddClass function(click me)

/wep command(Credits: DizzasteR)
else if( cmd == "wep" || cmd == "we" )
{
 if( !text ) return MessagePlayer( "[#FF0000]/wep <wep 1> <wep 2> <...>", player );
 else
 {
  local params = split( text, " " ); // Take out the space array
  local weapons; // Create a new null variable which will be holding the list of weapons player took.
  for( local i = 0; i <= params.len() - 1; i++ ) // since the 'len' returns value from 1 and array's starting value point is 0, we will use len() - 1 otherwise we'll receive an error.
  {
   if( !IsNum( params[i] ) && GetWeaponID( params[i] ) && GetWeaponID( params[i] ) > 0 && GetWeaponID( params[i] ) <= 32 ) // if Name was specified.
   {
    player.SetWeapon( GetWeaponID( params[i] ), 99999 ); // Get the weapon ID from its Name
    weapons = weapons + " " + GetWeaponName( GetWeaponID( params[i] ) ); // Add the weapon name to given weapon list
   }
   else if( IsNum( params[i] ) && params[i].tointeger() < 33 && params[i].tointeger() > 0 ) // if ID was specified
   {
    player.SetWeapon( params[i].tointeger(), 99999 ); // Then just give player that weapon
    weapons = weapons + " " + GetWeaponName( params[i].tointeger() ); // Get the weapon name from the ID and add it.
   }
   else MessagePlayer( "[#FF0000]Invalid Weapon Name/ID!", player ); // if the invalid ID/Name was given
  }
 
  if( weapons != null ) MessagePlayer( "[#00FF00]Received weapons: [#FFFFFF]" + weapons );
  else MessagePlayer( "[#FF0000]No weapons specified", player );
 }
}

Just add if ( player.Class = 3 ) before it. :)
bro i mean the class its not normal like the class 2 i do if (player.Class == 2) not working it will do other class
You want a /wep command like if player's class is 3,then he should be able to take wep?You haven't added Addclass function with correct parameters btw.You want a specific character to use that cmd?If yes,I already cleared it above.
Pls use Google Translate.I can't understand what are you trying to say..

=RK=MarineForce

else if( cmd == "wep" || cmd == "we" )
{
if(player.Skin = ID)  or add if(player.Team)
{
Message(" randi ka bacha");
}
}