Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Gunshop_EGP
- @inputs EGP:wirelink
- @outputs Use
- @persist User:entity WeaponTypes:array WeaponNames:array AmmoTypes:array AmmoQuantity:array AmmoTypesAlt:array AmmoQuantityAlt:array EGPSetup Drawn
- @trigger
- if (first())
- {
- runOnTick(1)
- WeaponTypes = array(
- "weapon_crowbar", "weapon_pistol", "weapon_357", "weapon_smg1", "weapon_ar2", "weapon_shotgun", "weapon_crossbow", "weapon_frag", "weapon_rpg", "weapon_bugbait"
- )
- WeaponNames = array(
- "CrowBar", "USP", ".357", "MP7", "AR2", "Spas-12", "Crossbow", "Grenade", "RPG", "Bugbait"
- )
- AmmoTypes = array(
- "NA", "pistol", "357", "SMG1", "AR2", "Buckshot", "XBowBolt", "Grenade", "rpg_round", "NA"
- )
- AmmoTypesAlt = array(
- "NA", "NA", "NA", "SMG1_Grenade", "AR2AltFire", "NA", "NA", "NA", "NA", "NA"
- )
- AmmoQuantity = array(0,50,50,150,150,20,10,5,5,0)
- AmmoQuantityAlt = array(0,0,0,5,5,0,0,0,0,0)
- }
- if (findCanQuery())
- {
- findByClass("Player")
- findExcludePlayer("[D3] flying gerbil")
- #findIncludePlayer("Maimer|GDNK")
- findClipToSphere(EGP:entity():pos(),128)
- User = findClosest(entity():pos())
- }
- if (EGP & !EGPSetup)
- {
- EGP:egpDrawTopLeft(1)
- EGP:egpTriangle(1, vec2(0,0), vec2(5,10), vec2(10,5))
- EGP:egpColor(1, vec(255,255,255))
- EGP:egpRoundedBox(2, vec2(0,0), vec2(375,25))
- EGP:egpColor(2, vec4(0,0,0,200))
- EGP:egpRoundedBox(3, vec2(0,45), vec2(375,300))
- EGP:egpColor(3, vec4(0,0,0,200))
- EGP:egpParentToCursor(1)
- EGPSetup = 1
- }
- Index = 4
- EGP:egpText(Index, "User: "+User:name(), vec2(10,0))
- EGP:egpColor(Index, vec4(255,255,255,255))
- Index++
- Use = User:keyUse()
- CursorPos = EGP:egpCursor(User)
- if (!Drawn & EGP)
- {
- foreach(WTK,WTV:string = WeaponTypes)
- {
- Index = WTK * 10
- Line = (WTK*30)+20
- EGPPos = vec2(5, Line)
- EGPScale = vec2(202, 20)
- EGP:egpRoundedBox(Index, vec2(5, Line), vec2(202, 20))
- Index++
- EGP:egpRoundedBoxOutline(Index, vec2(5, Line), vec2(202, 20))
- EGP:egpColor(Index, vec4(255,128,0,255))
- Index++
- EGP:egpText(Index, WeaponNames[WTK,string], vec2(106,Line))
- EGP:egpAlign(Index, 1)
- EGP:egpColor(Index, vec(255,128,0))
- Index++
- if (AmmoQuantity[WTK, number] != 0)
- {
- EGP:egpRoundedBox(Index, vec2(210, Line), vec2(80, 20))
- EGP:egpColor(Index, vec4(255,128,0,8))
- Index++
- EGP:egpRoundedBoxOutline(Index, vec2(210, Line), vec2(80, 20))
- EGP:egpColor(Index, vec4(255,128,0,255))
- Index++
- EGP:egpText(Index, "Ammo",vec2(250, Line))
- EGP:egpAlign(Index, 1)
- EGP:egpColor(Index, vec4(255,128,0,255))
- Index++
- }
- if (AmmoQuantityAlt[WTK, number] != 0)
- {
- EGP:egpRoundedBox(Index, vec2(290, Line), vec2(80, 20))
- EGP:egpColor(Index, vec4(255,128,0,8))
- Index++
- EGP:egpRoundedBoxOutline(Index, vec2(290, Line), vec2(80, 20))
- EGP:egpColor(Index, vec4(255,128,0,255))
- Index++
- EGP:egpText(Index, "Alt",vec2(330, Line))
- EGP:egpAlign(Index, 1)
- EGP:egpColor(Index, vec4(255,128,0,255))
- Index++
- }
- Drawn = 1
- }
- }
- else
- {
- foreach(WTK,WTV:string = WeaponTypes)
- {
- Index = WTK * 10
- if (inrange(CursorPos, EGP:egpPos(Index), EGP:egpPos(Index) + EGP:egpSize(Index)) )
- {
- Weapon = WTK
- if (Use & $Use)
- {
- Name = User:name()
- NameErase = Name:replaceRE("[A-Za-z0-9]","")
- if (NameErase:length() > 0) {Name = Name:replaceRE("["+NameErase+"]"," ")}
- if (Name:find(" ")) {NameSplit = Name:explode(" ")}
- LengthF = 0
- foreach(K,V:string = NameSplit)
- {
- LengthS = V:length()
- if (LengthS >= LengthF) {Name = V}
- LengthF = LengthS
- }
- EGP:egpColor(Index, vec4(255,128,0,64))
- concmd("D3a giveweapon "+Name+" "+WTV)
- }
- else
- {
- EGP:egpColor(Index, vec4(255,128,0,32))
- }
- }
- else
- {
- EGP:egpColor(Index, vec4(255,128,0,8))
- }
- Index = (WTK * 10)+3
- if (inrange(CursorPos, EGP:egpPos(Index), EGP:egpPos(Index) + EGP:egpSize(Index)) )
- {
- Weapon = WTK
- if (Use & $Use)
- {
- Name = User:name()
- NameErase = Name:replaceRE("[A-Za-z0-9]","")
- if (NameErase:length() > 0) {Name = Name:replaceRE("["+NameErase+"]"," ")}
- if (Name:find(" ")) {NameSplit = Name:explode(" ")}
- LengthF = 0
- foreach(K,V:string = NameSplit)
- {
- LengthS = V:length()
- if (LengthS >= LengthF) {Name = V}
- LengthF = LengthS
- }
- EGP:egpColor(Index, vec4(255,128,0,64))
- concmd("D3a giveammo "+Name+" "+AmmoTypes[WTK, string]+" "+AmmoQuantity[WTK, normal])
- }
- else
- {
- EGP:egpColor(Index, vec4(255,128,0,32))
- }
- }
- else
- {
- EGP:egpColor(Index, vec4(255,128,0,8))
- }
- Index = (WTK * 10)+6
- if (inrange(CursorPos, EGP:egpPos(Index), EGP:egpPos(Index) + EGP:egpSize(Index)) )
- {
- Weapon = WTK
- if (Use & $Use)
- {
- Name = User:name()
- NameErase = Name:replaceRE("[A-Za-z0-9]","")
- if (NameErase:length() > 0) {Name = Name:replaceRE("["+NameErase+"]"," ")}
- if (Name:find(" ")) {NameSplit = Name:explode(" ")}
- LengthF = 0
- foreach(K,V:string = NameSplit)
- {
- LengthS = V:length()
- if (LengthS >= LengthF) {Name = V}
- LengthF = LengthS
- }
- EGP:egpColor(Index, vec4(255,128,0,64))
- concmd("D3a giveammo "+Name+" "+AmmoTypesAlt[WTK, string]+" "+AmmoQuantityAlt[WTK, normal])
- }
- else
- {
- EGP:egpColor(Index, vec4(255,128,0,32))
- }
- }
- else
- {
- EGP:egpColor(Index, vec4(255,128,0,8))
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement