From 76ed5bdb67d45b1b7da8417b45c14555ce8729e7 Mon Sep 17 00:00:00 2001 From: Tobias Lenhardt Date: Sun, 29 Oct 2023 15:40:39 +0100 Subject: [PATCH] Update CustomCommandsV2.lua Signed-off-by: Tobias Lenhardt --- CustomCommandsV2.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CustomCommandsV2.lua b/CustomCommandsV2.lua index 0a398f1..bec488e 100644 --- a/CustomCommandsV2.lua +++ b/CustomCommandsV2.lua @@ -4,4 +4,5 @@ -- 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!-- -w="&peer="v="CCV2_Hide"u="Could not find User with PeerID "t="[Server]"s="/command?cmd="r="&steam_id="q="&user="p="default"o="/life?type="n="CCV2_Item"m="Error Giving Item"l=""k='[CCV2]'j="server"i="CCV2_Godmode"h="&server="g="/connection?type="f="autoauth"e="&admin="d="&auth="c="[CCV2]"b="&state="a="You forgot the PeerID"_=8080;function toboolean(x)local y=false;if x=="true"then y=true end;return y end;function getPlayer(z)local A=server.getPlayers()for B,C in pairs(A)do if C.id==z then return C end end end;function getindex(table,D)local E={}for k,v in pairs(table)do E[v]=k end;return E[D]end;function getEquipmentID(F)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","chemlight","bomb_disposal","chest_rig","black_hawk_vest","plate_vest","armor_vest"}return getindex(table,F)end;function uri(G)return G: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(H)if not g_savedata[j]then g_savedata[j]=p end end;function onCreate(I)if not g_savedata[j]then g_savedata[j]=p end;server.notify(-1,"Custom Commands V2","Successfully loaded Plugin",9)server.httpGet(_,"/start?is_world_create="..tostring(I)..h..tostring(g_savedata[j]))end;function onPlayerJoin(J,K,z,L,M)if J then server.announce(t,K.." joined the game")server.announce(c,"All available Commands: (only when Authed)",z)server.announce(l,"?revive [Peer_ID] - Revive someone",z)server.announce(l,"?heal [Peer_ID] - Heal someone",z)server.announce(l,"---",z)server.announce(l,"Feel free to join our Discord:",z)server.announce(l,"https://swprobuilders.com",z)server.httpGet(_,g.."join"..q..uri(K)..w..z..r..J..h..tostring(g_savedata[j])..e..tostring(L)..d..tostring(M))server.httpGet(_,"/info")if g_savedata[f]then server.addAuth(z)end end end;function onPlayerLeave(J,K,z,L,M)server.announce(t,K.." left the game")server.httpGet(_,g.."leave"..q..uri(K)..w..z..r..J..h..tostring(g_savedata[j])..e..tostring(L)..d..tostring(M))end;function onPlayerDie(J,K,z,L,M)server.announce(t,K.." died")server.httpGet(_,o.."die"..q..uri(K)..w..z..r..J..h..tostring(g_savedata[j])..e..tostring(L)..d..tostring(M))end;function onPlayerRespawn(z)local p=getPlayer(z)server.httpGet(_,o.."respawn"..q..uri(p.name)..w..z..r..p.steam_id..h..tostring(g_savedata[j])..e..tostring(p.admin)..d..tostring(p.auth))end;function onVehicleUnload(N)end;function onCustomCommand(O,z,P,Q,R,S,T,U,V,W)local X=getPlayer(z)if R:lower()=="?item"and(P or z==0)then local F=getEquipmentID(S)local Y=tonumber(T)local Z=tonumber(U)local a0=tonumber(V)local a1=false;local a2,a3=server.getPlayerCharacterID(z)local a4=server.setCharacterItem(a2,Y,F,a1,Z,a0)if a4 then server.announce(n,"Item Given",z)else server.announce(n,m,z)end end;if R:lower()=="?give"and(P or z==0)then local a5=tonumber(S)local F=getEquipmentID(T)local Y=tonumber(U)local Z=tonumber(V)local a0=tonumber(W)local a1=false;local a2,a3=server.getPlayerCharacterID(a5)local a4=server.setCharacterItem(a2,Y,F,a1,Z,a0)if a4 then server.announce(n,X.name.." gave "..T.." in Slot "..U,a5)server.announce(n,"Item Given to "..getPlayer(a5).name,z)else server.announce(n,m,z)end end;if R:lower()=="?godmode"and(P or z==0)then local a2,a3=server.getPlayerCharacterID(z)local a6=toboolean(S)local N,a4=server.getCharacterVehicle(a2)a4=server.setVehicleInvulnerable(N,a6)if a4 then server.announce(i,"Godmode set",z)else server.announce(i,"Error setting Godmode",z)end end;if R:lower()=="?hide"and(P or z==0)then local a2,a3=server.getPlayerCharacterID(z)local a7=toboolean(S)local N,a4=server.getCharacterVehicle(a2)a4=server.setVehicleShowOnMap(N,a7)if a4 then server.announce(v,"Hide set",z)else server.announce(v,"Error setting hide",z)end end;if R:lower()=="?autoauth"and(P or z==0)then if not g_savedata[f]then server.announce(k,"AutoAuth has been Enabled")server.httpGet(_,s..f..b.."on"..q..uri(X.name)..w..z..r..X.steam_id..h..tostring(g_savedata[j])..e..tostring(P)..d..tostring(Q))g_savedata[f]=true else server.announce(k,"AutoAuth has been Disabled")server.httpGet(_,s..f..b.."off"..q..uri(X.name)..w..z..r..X.steam_id..h..tostring(g_savedata[j])..e..tostring(P)..d..tostring(Q))g_savedata[f]=false end end;if R:lower()=="?setServer"and(P or z==0)then g_savedata[j]=S;server.announce(k,"Server Name set to "..S)server.httpGet(_,s.."setServer"..b..S..q..uri(X.name)..w..z..r..X.steam_id..h..tostring(g_savedata[j])..e..tostring(P)..d..tostring(Q))end;if R:lower()=="?kill"and(P or z==0)then if not S then server.announce(c,a,z)else local a2,a4=server.getPlayerCharacterID(tonumber(S))if a4 then local p=getPlayer(tonumber(S))server.killCharacter(a2)server.announce(c,X.name.." killed "..p.name)server.httpGet(_,s.."kill"..b..p.id..q..uri(X.name)..w..z..r..X.steam_id..h..tostring(g_savedata[j])..e..tostring(P)..d..tostring(Q))else server.announce(c,u..S,z)end end end;if R:lower()=="?revive"and(Q or z==0)then if not S then server.announce(c,a,z)else local a2,a4=server.getPlayerCharacterID(tonumber(S))if a4 then local a8=100;server.reviveCharacter(a2)server.setCharacterData(a2,a8,true,false)local p=getPlayer(tonumber(S))server.announce(c,X.name.." revived "..p.name)server.httpGet(_,s.."revive"..b..p.id..q..uri(X.name)..w..z..r..X.steam_id..h..tostring(g_savedata[j])..e..tostring(P)..d..tostring(Q))else server.announce(c,u..S,z)end end end;if R:lower()=="?heal"and(Q or z==0)then if not S then server.announce(c,a,z)else local a2,a4=server.getPlayerCharacterID(tonumber(S))if a4 then local a8=100;server.setCharacterData(a2,a8,true,false)local p=getPlayer(tonumber(S))server.announce(c,X.name.." healed "..p.name)server.httpGet(_,s.."heal"..b..p.id..q..uri(X.name)..w..z..r..X.steam_id..h..tostring(g_savedata[j])..e..tostring(P)..d..tostring(Q))else server.announce(c,u..S,z)end end end end;function httpReply(a9,aa,ab)end +-- idk why you are here, but if you are experiencing issues, open a issue at the above noted Repository, DO NOT REUPLOAD +as="&peer="ar="CCV2_Hide"aq="&auth="ap="You forgot the PeerID"ao="[CCV2]"an="CCV2_Godmode"am="/life?type="al="autoauth"ak="&admin="aj="CCV2_Item"ah="Error Giving Item"ag="&state="af="&server="ae="Could not find User with PeerID "ad="/connection?type="ac="server"ab="&steam_id="aa="&user="Z=""Y="default"X='[CCV2]'W="[Server]"V="/command?cmd="g=8080;function B(a)local b=false;if a=="true"then b=true end;return b end;function k(c)local d=server.getPlayers()for e,f in pairs(d)do if f.id==c then return f end end end;function J(table,i)local j={}for l,m in pairs(table)do j[m]=l end;return j[i]end;function v(n)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","glowstick","dog_whistle","bomb_disposal","chest_rig","black_hawk_vest","plate_vest","armor_vest","space_suit","space_suit_exploration"}return J(table,n)end;function h(o)return o: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(p)if not g_savedata[ac]then g_savedata[ac]=Y end end;function onCreate(q)if not g_savedata[ac]then g_savedata[ac]=Y end;server.notify(-1,"Custom Commands V2","Successfully loaded Plugin",9)server.httpGet(g,"/start?is_world_create="..tostring(q)..af..tostring(g_savedata[ac]))end;function onPlayerJoin(r,s,c,t,u)if r then server.announce(W,s.." joined the game")server.announce(ao,"All available Commands: (only when Authed)",c)server.announce(Z,"?revive [Peer_ID] - Revive someone",c)server.announce(Z,"?heal [Peer_ID] - Heal someone",c)server.announce(Z,"---",c)server.announce(Z,"Feel free to join our Discord:",c)server.announce(Z,"https://swprobuilders.com",c)server.httpGet(g,ad.."join"..aa..h(s)..as..c..ab..r..af..tostring(g_savedata[ac])..ak..tostring(t)..aq..tostring(u))server.httpGet(g,"/info")if g_savedata[al]then server.addAuth(c)end end end;function onPlayerLeave(r,s,c,t,u)server.announce(W,s.." left the game")server.httpGet(g,ad.."leave"..aa..h(s)..as..c..ab..r..af..tostring(g_savedata[ac])..ak..tostring(t)..aq..tostring(u))end;function onPlayerDie(r,s,c,t,u)server.announce(W,s.." died")server.httpGet(g,am.."die"..aa..h(s)..as..c..ab..r..af..tostring(g_savedata[ac])..ak..tostring(t)..aq..tostring(u))end;function onPlayerRespawn(c)local w=k(c)server.httpGet(g,am.."respawn"..aa..h(w.name)..as..c..ab..w.steam_id..af..tostring(g_savedata[ac])..ak..tostring(w.admin)..aq..tostring(w.auth))end;function onVehicleUnload(x)end;function onCustomCommand(y,c,z,A,C,D,E,F,G,H)local I=k(c)if C:lower()=="?item"and(z or c==0)then local n=v(D)local K=tonumber(E)local L=tonumber(F)local M=tonumber(G)local N=false;local O,P=server.getPlayerCharacterID(c)local Q=server.setCharacterItem(O,K,n,N,L,M)if Q then server.announce(aj,"Item Given",c)else server.announce(aj,ah,c)end end;if C:lower()=="?give"and(z or c==0)then local R=tonumber(D)local n=v(E)local K=tonumber(F)local L=tonumber(G)local M=tonumber(H)local N=false;local O,P=server.getPlayerCharacterID(R)local Q=server.setCharacterItem(O,K,n,N,L,M)if Q then server.announce(aj,I.name.." gave "..E.." in Slot "..F,R)server.announce(aj,"Item Given to "..k(R).name,c)else server.announce(aj,ah,c)end end;if C:lower()=="?godmode"and(z or c==0)then local O,P=server.getPlayerCharacterID(c)local S=B(D)local x,Q=server.getCharacterVehicle(O)Q=server.setVehicleInvulnerable(x,S)if Q then server.announce(an,"Godmode set",c)else server.announce(an,"Error setting Godmode",c)end end;if C:lower()=="?hide"and(z or c==0)then local O,P=server.getPlayerCharacterID(c)local T=B(D)local x,Q=server.getCharacterVehicle(O)Q=server.setVehicleShowOnMap(x,T)if Q then server.announce(ar,"Hide set",c)else server.announce(ar,"Error setting hide",c)end end;if C:lower()=="?autoauth"and(z or c==0)then if not g_savedata[al]then server.announce(X,"AutoAuth has been Enabled")server.httpGet(g,V..al..ag.."on"..aa..h(I.name)..as..c..ab..I.steam_id..af..tostring(g_savedata[ac])..ak..tostring(z)..aq..tostring(A))g_savedata[al]=true else server.announce(X,"AutoAuth has been Disabled")server.httpGet(g,V..al..ag.."off"..aa..h(I.name)..as..c..ab..I.steam_id..af..tostring(g_savedata[ac])..ak..tostring(z)..aq..tostring(A))g_savedata[al]=false end end;if C:lower()=="?setServer"and(z or c==0)then g_savedata[ac]=D;server.announce(X,"Server Name set to "..D)server.httpGet(g,V.."setServer"..ag..D..aa..h(I.name)..as..c..ab..I.steam_id..af..tostring(g_savedata[ac])..ak..tostring(z)..aq..tostring(A))end;if C:lower()=="?kill"and(z or c==0)then if not D then server.announce(ao,ap,c)else local O,Q=server.getPlayerCharacterID(tonumber(D))if Q then local w=k(tonumber(D))server.killCharacter(O)server.announce(ao,I.name.." killed "..w.name)server.httpGet(g,V.."kill"..ag..w.id..aa..h(I.name)..as..c..ab..I.steam_id..af..tostring(g_savedata[ac])..ak..tostring(z)..aq..tostring(A))else server.announce(ao,ae..D,c)end end end;if C:lower()=="?revive"and(A or c==0)then if not D then server.announce(ao,ap,c)else local O,Q=server.getPlayerCharacterID(tonumber(D))if Q then local U=100;server.reviveCharacter(O)server.setCharacterData(O,U,true,false)local w=k(tonumber(D))server.announce(ao,I.name.." revived "..w.name)server.httpGet(g,V.."revive"..ag..w.id..aa..h(I.name)..as..c..ab..I.steam_id..af..tostring(g_savedata[ac])..ak..tostring(z)..aq..tostring(A))else server.announce(ao,ae..D,c)end end end;if C:lower()=="?heal"and(A or c==0)then if not D then server.announce(ao,ap,c)else local O,Q=server.getPlayerCharacterID(tonumber(D))if Q then local U=100;server.setCharacterData(O,U,true,false)local w=k(tonumber(D))server.announce(ao,I.name.." healed "..w.name)server.httpGet(g,V.."heal"..ag..w.id..aa..h(I.name)..as..c..ab..I.steam_id..af..tostring(g_savedata[ac])..ak..tostring(z)..aq..tostring(A))else server.announce(ao,ae..D,c)end end end end;function httpReply(_,a0,a1)end