Saxa2007
gangsta sonic
Changing a array clones tha change to others. Is there anything im doing wrong?
[
local enabledchar = 'sonic'
--Use the character variable to change who you wanna play as!
local ability = 0
local ability2 = false
local pressc1 = true
local pressc2 = true
local charability = 0
local dropdash = false
local abilities = {'Thok', 'Fly', 'Jump'}
local cur = 1
local time = 0
local whitelisted = false
local function abilityManage(p, v)
//since i cant code for the life of me heres a shit ton of else ifs
if v == 'Thok' then
p.charability = CA_THOK
elseif v == 'Fly' then
p.charability = CA_FLY
elseif v == 'Glide' then
p.charability = CA_GLIDEANDCLIMB
elseif v == 'Jump' then
p.charability = CA_DOUBLEJUMP
elseif v == 'Homing Attack' then
p.charability = CA_HOMINGTHOK
elseif v == 'Hover' then
p.charability = CA_FLOAT
elseif v == 'Descend' then
p.charability = CA_SLOWFALL
elseif v == 'Fall Switch' then
p.charability = CA_FALLSWITCH
end
end
addHook("PlayerSpawn", function(p)
if (p.ability == nil) then
p.ability = ability
end
if (p.ability2 == nil) then
p.ability2 = ability2
end
if (p.pressc1 == nil) then
p.pressc1 = pressc1
end
if (p.pressc2 == nil) then
p.pressc2 = pressc2
end
if (p.dropdash == nil) then
p.dropdash = dropdash
end
if (p.enabledchar == nil) then
p.enabledchar = enabledchar
end
if (p.abilities == nil) then
p.abilities = abilities
end
if (p.whitelisted == nil) then
p.whitelisted = whitelisted
end
if (p.cur == nil) then
p.cur = cur
end
end)
hud.add(function(v, p)
if p.mo.skin == p.enabledchar and p.whitelisted == true then
v.drawString(75, 25, 'Ability: ' + p.abilities[p.cur], 8388608)
end
end)
addHook("PlayerThink", function(p)
if (p.mo.skin == p.enabledchar and p.whitelisted == true) then
if (p.cmd.buttons & BT_CUSTOM1) and (p.pressc1 == true) and (p.ability2 == false) then
p.pressc1 = false
if p.abilities[p.cur + 1] ~= nil then
p.cur = p.cur + 1
abilityManage(p, p.abilities[p.cur])
else
p.cur = 1
abilityManage(p, p.abilities[p.cur])
end
end
if not (p.cmd.buttons & BT_CUSTOM1) and (p.pressc1 == false) then
p.pressc1 = true
end
if (p.cmd.buttons & BT_SPIN) then
if not (P_IsObjectOnGround(p.mo)) then
p.dropdash = true
elseif (P_IsObjectOnGround(p.mo)) and (p.dropdash == true) then
p.dropdash = false
S_StartSound(p.mo, sfx_zoom)
P_Thrust(p.mo, p.mo.angle,50*FRACUNIT)
if (p.pflags & ~PF_SPINNING) then
p.pflags = $1|PF_SPINNING
p.mo.state = S_PLAY_ROLL
end
end
else
if p.dropdash == true then
p.dropdash = false
end
end
end
end)
COM_AddCommand('abilitywhitelist', function(p, intstring, boolstring)
if (p == server)
local int = tonumber(intstring)
local bool = nil
local msg = ''
local plyr = ''
if boolstring == 'true' then
bool = true
elseif boolstring == 'false' then
bool = false
end
for player in players.iterate do
if #player == int then
plyr = player.name
player.whitelisted = bool
end
end
if bool == true then
msg = plyr + ' has been whitelisted'
elseif bool == false then
msg = plyr + ' has been blacklisted'
end
COM_BufInsertText(p, 'csay "' + msg + '"')
end
end)
COM_AddCommand('changeabilitychar', function(player)
if player.whitelisted == true then
player.enabledchar = player.mo.skin
CONS_Printf(player, "Character for Multi-ability is now " + player.mo.skin)
end
end)
COM_AddCommand('abilityhelp', function(p)
CONS_Printf(p, [[Thok, Fly, Glide,
Jump, Homing Attack, Hover,
Descend, Fall Switch]])
end)
COM_AddCommand('setability', function(p, s, s2)
if p.whitelisted == true then
local i = tonumber(s)
p.abilities[i] = s2
end
end)
/ICODE]