MuhammadZeeshan

wep cmd

Dec 4th, 2016
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 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 ].IsLMS == true ) ErrorMessage("You cannot use this command while in LMS.", player );
  7. else if ( status[ player.ID ].minigun == true ) ErrorMessage( "You cannot use this command while in minigun stadium.", player );
  8. else if ( !text ) return ErrorMessage( "[#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. player.SetWeapon( GetWeaponID( params[i] ), 999 ); // Get the weapon ID from its Name
  18. weapons = weapons + " " + GetWeaponName( GetWeaponID( params[i] ) ); // Add the weapon name to given weapon list
  19. }
  20. else if( IsNum( params[i] ) && params[i].tointeger() < 33 && params[i].tointeger() > 0 ) // if ID was specified
  21. {
  22. player.SetWeapon( params[i].tointeger(), 999 ); // Then just give player that weapon
  23. weapons = weapons + " " + GetWeaponName( params[i].tointeger() ); // Get the weapon name from the ID and add it.
  24. }
  25. else ErrorMessage( "[#FF0000][Server] - [#FFFFFF]Invalid Weapon Name/ID!", player ); // if the invalid ID/Name was given
  26. }
  27.  
  28. if( weapons != null ) SendMessage( "[#008000][WEAPONS] - [#FFFFFF]Received weapons: "+weapons+".", player );
  29. else ErrorMessage( "[#FF0000][Server] - [#FFFFFF]No weapons specified", player );
  30. }
  31. }
Add Comment
Please, Sign In to add comment