From aa04a7deba64ff711a824f33de3199a29580d68a Mon Sep 17 00:00:00 2001 From: Hammer1279 Date: Sun, 13 Feb 2022 03:22:01 +0100 Subject: [PATCH] Create CustomCommandsV2.lua --- CustomCommandsV2.lua | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 CustomCommandsV2.lua diff --git a/CustomCommandsV2.lua b/CustomCommandsV2.lua new file mode 100644 index 0000000..cd1fd56 --- /dev/null +++ b/CustomCommandsV2.lua @@ -0,0 +1,6 @@ +-- Author: Hammer1279 +-- GitHub: https://github.com/Hammer1279 +-- Workshop: https://steamcommunity.com/id/hammer1279/myworkshopfiles + +--This code is the intellectual property of me and you do not hold any rights to this, do not copy or use this unless you got the clear ok from me!-- +bw="&user="bv="&auth="bu="server"bt="&peer="bs="/life?type="br="Error Giving Item"bq='[CCV2]'bp="CCV2_Hide"bo="/command?cmd="bn="CCV2_Godmode"bm="Could not find User with PeerID "bl="[CCV2]"bk="&server="bj="&state="bi="default"bh="[Server]"bg="&steam_id="bf="&admin="be="/connection?type="bd="CCV2_Item"bc="You forgot the PeerID"bb=""Z="autoauth"Y=8080;b=g_savedata;function c(a)local d=false;if a=="true"then d=true end;return d end;function f(e)local g=server.getPlayers()for h,i in pairs(g)do if i.id==e then return i end end end;function k(table,j)local l={}for m,n in pairs(table)do l[n]=m end;return l[j]end;function p(o)table={"diving","firefighter","scuba","parachute","arctic","binoculars","cable","compass","defibrillator","fire_extinguisher","first_aid","flare","flaregun","flaregun_ammo","flashlight","hose","night_vision_binoculars","oxygen_mask","radio","radio_signal_locator","remote_control","rope","strobe_light","strobe_light_infrared","transponder","underwater_welding_torch","welding_torch","coal","hazmat","radiation_detector","c4","c4_detonator","speargun","speargun_ammo","pistol","pistol_ammo","smg","smg_ammo","rifle","rifle_ammo","grenade","machine_gun_ammo_box_k","machine_gun_ammo_box_he","machine_gun_ammo_box_he_frag","machine_gun_ammo_box_ap","machine_gun_ammo_box_i","light_auto_ammo_box_k","light_auto_ammo_box_he","light_auto_ammo_box_he_frag","light_auto_ammo_box_ap","light_auto_ammo_box_i","rotary_auto_ammo_box_k","rotary_auto_ammo_box_he","rotary_auto_ammo_box_he_frag","rotary_auto_ammo_box_ap","rotary_auto_ammo_box_i","heavy_auto_ammo_box_k","heavy_auto_ammo_box_he","heavy_auto_ammo_box_he_frag","heavy_auto_ammo_box_ap","heavy_auto_ammo_box_i","battle_shell_k","battle_shell_he","battle_shell_he_frag","battle_shell_ap","battle_shell_i","artillery_shell_k","artillery_shell_he","artillery_shell_he_frag","artillery_shell_ap","artillery_shell_i"}return k(table,o)end;function r(q)return q:gsub("%%","%%25"):gsub("%s","%%20"):gsub("%!","%%21"):gsub("%#","%%23"):gsub("%$","%%24"):gsub("%&","%%26"):gsub("%'","%%27"):gsub("%(","%%28"):gsub("%)","%%29"):gsub("%*","%%2A"):gsub("%+","%%2B"):gsub("%,","%%2C"):gsub("%/","%%2F"):gsub("%:","%%3A"):gsub("%;","%%3B"):gsub("%=","%%3D"):gsub("%?","%%3F"):gsub("%@","%%40"):gsub("%[","%%5B"):gsub("%]","%%5D")end;function onTick(s)if not b[bu]then b[bu]=bi end end;function onCreate(t)if not b[bu]then b[bu]=bi end;server.notify(-1,"Custom Commands V2","Successfully loaded Plugin",9)server.httpGet(Y,"/start?is_world_create="..tostring(t)..bk..tostring(b[bu]))end;function onPlayerJoin(u,v,e,w,x)if u then server.announce(bh,v.." joined the game")server.announce(bl,"All available Commands: (only when Authed)",e)server.announce(bb,"?revive [Peer_ID] - Revive someone",e)server.announce(bb,"?heal [Peer_ID] - Heal someone",e)server.announce(bb,"---",e)server.announce(bb,"Feel free to join our Discord:",e)server.announce(bb,"https://drillkea.com/stormworks",e)server.httpGet(Y,be.."join"..bw..r(v)..bt..e..bg..u..bk..tostring(b[bu])..bf..tostring(w)..bv..tostring(x))server.httpGet(Y,"/info")if b[Z]then server.addAuth(e)end end end;function onPlayerLeave(u,v,e,w,x)server.announce(bh,v.." left the game")server.httpGet(Y,be.."leave"..bw..r(v)..bt..e..bg..u..bk..tostring(b[bu])..bf..tostring(w)..bv..tostring(x))end;function onPlayerDie(u,v,e,w,x)server.announce(bh,v.." died")server.httpGet(Y,bs.."die"..bw..r(v)..bt..e..bg..u..bk..tostring(b[bu])..bf..tostring(w)..bv..tostring(x))end;function onPlayerRespawn(e)local y=f(e)server.httpGet(Y,bs.."respawn"..bw..r(y.name)..bt..e..bg..y.steam_id..bk..tostring(b[bu])..bf..tostring(y.admin)..bv..tostring(y.auth))end;function onVehicleUnload(z)end;function onCustomCommand(A,e,B,C,D,E,F,G,H,I)local J=f(e)if D:lower()=="?item"and(B or e==0)then local o=p(E)local K=tonumber(F)local L=tonumber(G)local M=tonumber(H)local N=false;local O,P=server.getPlayerCharacterID(e)local Q=server.setCharacterItem(O,K,o,N,L,M)if Q then server.announce(bd,"Item Given",e)else server.announce(bd,br,e)end end;if D:lower()=="?give"and(B or e==0)then local R=tonumber(E)local o=p(F)local K=tonumber(G)local L=tonumber(H)local M=tonumber(I)local N=false;local O,P=server.getPlayerCharacterID(R)local Q=server.setCharacterItem(O,K,o,N,L,M)if Q then server.announce(bd,J.name.." gave "..F.." in Slot "..G,R)server.announce(bd,"Item Given to "..f(R).name,e)else server.announce(bd,br,e)end end;if D:lower()=="?godmode"and(B or e==0)then local O,P=server.getPlayerCharacterID(e)local S=c(E)local z,Q=server.getCharacterVehicle(O)Q=server.T(z,S)if Q then server.announce(bn,"Godmode set",e)else server.announce(bn,"Error setting Godmode",e)end end;if D:lower()=="?hide"and(B or e==0)then local O,P=server.getPlayerCharacterID(e)local T=c(E)local z,Q=server.getCharacterVehicle(O)Q=server.setVehicleShowOnMap(z,T)if Q then server.announce(bp,"Hide set",e)else server.announce(bp,"Error setting hide",e)end end;if D:lower()=="?autoauth"and(B or e==0)then if not b[Z]then server.announce(bq,"AutoAuth has been Enabled")server.httpGet(Y,bo..Z..bj.."on"..bw..r(J.name)..bt..e..bg..J.steam_id..bk..tostring(b[bu])..bf..tostring(B)..bv..tostring(C))b[Z]=true else server.announce(bq,"AutoAuth has been Disabled")server.httpGet(Y,bo..Z..bj.."off"..bw..r(J.name)..bt..e..bg..J.steam_id..bk..tostring(b[bu])..bf..tostring(B)..bv..tostring(C))b[Z]=false end end;if D:lower()=="?setServer"and(B or e==0)then b[bu]=E;server.announce(bq,"Server Name set to "..E)server.httpGet(Y,bo.."setServer"..bj..E..bw..r(J.name)..bt..e..bg..J.steam_id..bk..tostring(b[bu])..bf..tostring(B)..bv..tostring(C))end;if D:lower()=="?kill"and(B or e==0)then if not E then server.announce(bl,bc,e)else local O,Q=server.getPlayerCharacterID(tonumber(E))if Q then local y=f(tonumber(E))server.killCharacter(O)server.announce(bl,J.name.." killed "..y.name)server.httpGet(Y,bo.."kill"..bj..y.id..bw..r(J.name)..bt..e..bg..J.steam_id..bk..tostring(b[bu])..bf..tostring(B)..bv..tostring(C))else server.announce(bl,bm..E,e)end end end;if D:lower()=="?revive"and(C or e==0)then if not E then server.announce(bl,bc,e)else local O,Q=server.getPlayerCharacterID(tonumber(E))if Q then local U=100;server.reviveCharacter(O)server.setCharacterData(O,U,true,false)local y=f(tonumber(E))server.announce(bl,J.name.." revived "..y.name)server.httpGet(Y,bo.."revive"..bj..y.id..bw..r(J.name)..bt..e..bg..J.steam_id..bk..tostring(b[bu])..bf..tostring(B)..bv..tostring(C))else server.announce(bl,bm..E,e)end end end;if D:lower()=="?heal"and(C or e==0)then if not E then server.announce(bl,bc,e)else local O,Q=server.getPlayerCharacterID(tonumber(E))if Q then local U=100;server.setCharacterData(O,U,true,false)local y=f(tonumber(E))server.announce(bl,J.name.." healed "..y.name)server.httpGet(Y,bo.."heal"..bj..y.id..bw..r(J.name)..bt..e..bg..J.steam_id..bk..tostring(b[bu])..bf..tostring(B)..bv..tostring(C))else server.announce(bl,bm..E,e)end end end end;function httpReply(V,W,X)end