Advertisement
JcdShrimp

Load .gsc File

Apr 8th, 2017
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var file;
  2. file = get_open_filename("gmod2D WeaponScript 1.0|*.gsc", "");
  3.  
  4. //var sprfile;
  5. //sprfile = get_open_filename("image file|*.png", "");
  6.  
  7. var file_to_read =  file_text_open_read(file);
  8.  
  9. if file_text_read_string(file_to_read) != "script_type = weaponscript1"
  10.     {
  11.     show_message("This is not a valid WeaponScript 1.0 file!")
  12.     }
  13. else
  14.     {
  15. file_text_readln(file_to_read)
  16. weapid = file_text_read_real(file_to_read)
  17. file_text_readln(file_to_read)
  18. weapname = file_text_read_string(file_to_read)
  19. file_text_readln(file_to_read)
  20. weapdmg = file_text_read_real(file_to_read)
  21. file_text_readln(file_to_read)
  22. weapspd = file_text_read_real(file_to_read)
  23. file_text_readln(file_to_read)
  24. weapsnd = file_text_read_string(file_to_read)
  25. weapsnd = asset_get_index(weapsnd)
  26. file_text_readln(file_to_read)
  27. weapcolpre = file_text_read_string(file_to_read)
  28. weapcol = make_color_hex(weapcolpre)
  29. file_text_readln(file_to_read)
  30. weapdelay = file_text_read_real(file_to_read)
  31. file_text_readln(file_to_read)
  32. weapframe = file_text_read_real(file_to_read)
  33. file_text_readln(file_to_read)
  34. multi = file_text_read_string(file_to_read)
  35. if multi = "true"
  36.     {
  37.     multi = true
  38.     }
  39. if multi = "false"
  40.     {
  41.     multi = false
  42.     }
  43. file_text_readln(file_to_read)
  44. addonname = file_text_read_string(file_to_read)
  45. file_text_readln(file_to_read)
  46. authorname = file_text_read_string(file_to_read)
  47. file_text_close(file_to_read)
  48.  
  49. load_weapondata(weapid,weapname,weapdmg,weapspd,weapsnd,weapcol,weapdelay,weapframe,multi)
  50.  
  51. show_message("You have successfully loaded the addon "+chr(34)+addonname+chr(34)+" by "+authorname+".")
  52.  
  53. global.weapondata[weapid,7] =weapframe
  54.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement