NULL Message appared after getting weapone

Started by Nihongo^, Jan 04, 2019, 05:11 PM

Previous topic - Next topic

Nihongo^

Hi guys i am receving an error "Null0000" after getting weapon how do i fix it ?


else if ( cmd == "wep" || cmd == "we" || cmd == "buywep" )
{
 if ( status[ player.ID ].Registered == false ) ErrorMessage( "[#FF0000][Server] - [#FFFFFF]You need to be a part of our community to use this command.", player );
  else if ( status[ player.ID ].Logged == false ) ErrorMessage( "[#FF0000][Server] - [#FFFFFF]You need to be identified to use this command.", player );
  else if ( !text ) return ErrorMessage( "[#FF0000][Server] - [#FFFFFF]/"+cmd+" <wep1, wep2, wep3...>", 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 ErrorMessage( "[#FF0000][Server] - [#FFFFFF]Invalid Weapon Name/ID!", player ); // if the invalid ID/Name was given

  }
 
  if( weapons != null ) SendMessage( "[#008000][WEAPONS] - [#FFFFFF]Received weapons: "+weapons+".", player );
  else ErrorMessage( "[#FF0000][Server] - [#FFFFFF]No weapons specified", player );
 }
}

Xhefri

else if ( cmd == "wep" )
  {
  if ( !player.Spawned ) MessagePlayer( "[#fdff00]You need to spawn to use this command.", player );
  else{
   if ( text )
      {
        local wepid = GetWeaponID( text );
        player.SetWeapon( wepid, 1000 );
        MessagePlayer( "[#fdff00]You receive [" + GetWeaponName( wepid ) + "] 1000 ammo." , player );
      }
      else MessagePlayer( "[#fdff00] To get weapon type /wep <name>  ", player );
   }
   }

Nihongo^

Quote from: Xhefri on Jan 04, 2019, 05:19 PMelse if ( cmd == "wep" )
  {
  if ( !player.Spawned ) MessagePlayer( "[#fdff00]You need to spawn to use this command.", player );
  else{
   if ( text )
      {
        local wepid = GetWeaponID( text );
        player.SetWeapon( wepid, 1000 );
        MessagePlayer( "[#fdff00]You receive [" + GetWeaponName( wepid ) + "] 1000 ammo." , player );
      }
      else MessagePlayer( "[#fdff00] To get weapon type /wep <name>  ", player );
   }
   }
i have the same cmd how do i block minigun ?

Xhefri

I didnt blocked it in my own script i just made it harmless.
Add this in onScriptLoad
{
     SetWeaponDataValue( 33, 6, 0 );
}