MuhammadZeeshan

wep cmd

Dec 8th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. else if( cmd == "wep" || cmd == "we" )
  2. {
  3. local plr = player.ID;
  4. if ( status[ player.ID ].Registered == false ) ErrorMessage( "[#FFFFFF]You need to be a part of our community to use this command.", player );
  5. else if ( status[ player.ID ].Logged == false ) ErrorMessage( "[#FFFFFF]You need to be identified to use this command.", player );
  6. else if ( LMSS[ plr.ID ].IsLMS == true ) ErrorMessage("You cannot use this command while in LMS.", player );
  7. else if ( status[ player.ID ].gungame == true ) ErrorMessage("You cannot use this command while in gungame", player );
  8. else if ( !text ) return MessagePlayer( "[#FFFFFF]/"+cmd+" <wep1, wep2, wep3...>", player );
  9. else
  10. {
  11. local params = split( text, " " ); // Take out the space array
  12. local weapons; // Create a new null variable which will be holding the list of weapons player took.
  13. 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.
  14. {
  15. if( !IsNum( params[i] ) && GetWeaponID( params[i] ) && GetWeaponID( params[i] ) > 0 && GetWeaponID( params[i] ) <= 32 ) // if Name was specified.
  16. {
  17. if ( Checkvalidwep( GetWeaponID( params[i] ) ) )
  18. {
  19. player.SetWeapon( GetWeaponID( params[i] ), 999 ); // Get the weapon ID from its Name
  20. if ( weapons == null ) weapons = GetWeaponName( GetWeaponID( params[i] ) ); // Add the weapon name to given weapon list
  21. else weapons = weapons + ", " + GetWeaponName( GetWeaponID( params[i] ) );
  22. }
  23. else if( IsNum( params[i] ) && params[i].tointeger() < 33 && params[i].tointeger() > 0 ) // if ID was specified
  24. {
  25. player.SetWeapon( params[i].tointeger(), 999 ); // Then just give player that weapon
  26. if ( weapons == null ) weapons = GetWeaponName( params[i].tointeger() ); // Get the weapon name from the ID and add it.
  27. else weapons = weapons + ", " + GetWeaponName( params[i].tointeger() );
  28. }
  29. else MessagePlayer( "[#FF0000][Server] - [#FFFFFF]The weapon you typed is blocked or for cost. use /buywep!", player );
  30. }
  31. else MessagePlayer( "[#FF0000][Server] - [#FFFFFF]Invalid Weapon Name/ID!", player ); // if the invalid ID/Name was given
  32. }
  33.  
  34. if( weapons != null ) MessagePlayer( "[#008000][WEAPONS] - [#FFFFFF]Received weapons: "+weapons+".", player );
  35. }
  36. }
Add Comment
Please, Sign In to add comment