1
0
mirror of https://github.com/SWProBuilders/stormworks-tools.git synced 2025-06-14 03:37:20 +00:00
stormworks-tools/CustomCommandsV2.lua
Tobias Lenhardt 76ed5bdb67
Update CustomCommandsV2.lua
Signed-off-by: Tobias Lenhardt <hammer@ht-dev.de>
2023-10-29 15:40:39 +01:00

9 lines
7.5 KiB
Lua

-- Author: Hammer1279
-- GitHub: https://github.com/Hammer1279
-- Repository: https://github.com/SWProBuilders/stormworks-tools
-- 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!--
-- 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