General > Developers Corner

Credit Shop !

(1/2) > >>

Schiaffino:
Hello guys ! =D

Fast Question. i download pointshop ! but i found something that i cant fix...

i bought gravity and work , i log out -rejoin the game and still with the low gravity upgrade... but when i bought super speed.. i just die once or log out and i loose the super speed :S what can be the problem guys ? thanks

here is the code of the super speed:


--- Code: ---
ITEM.Name = "Super Speed"
ITEM.Enabled = true
ITEM.Description = "Gives you super speed!"
ITEM.Cost = 200
ITEM.Model = "models/weapons/w_toolgun.mdl"

ITEM.Functions = {
OnGive = function(ply, item)
item.Hooks.PlayerSpawn(ply, item)
end,

OnTake = function(ply, item)
local oldWalk = ply.OldWalkSpeed or 250
local oldRun = ply.OldRunSpeed or 500
ply:SetWalkSpeed(oldWalk)
ply:SetRunSpeed(oldRun)
end
}

ITEM.Hooks = {
PlayerSpawn = function(ply, item)
if not ply.OldWalkSpeed and not ply.OldRunSpeed then
ply.OldWalkSpeed = ply:GetWalkSpeed()
ply.OldRunSpeed = ply:GetRunSpeed()
end

ply:SetWalkSpeed(500)
ply:SetRunSpeed(1000)
end
}

--- End code ---

and here is the gravity code


--- Code: ---ITEM.Name = "Low Gravity"
ITEM.Enabled = true
ITEM.Description = "Sets low gravity on yourself when you spawn."
ITEM.Cost = 200
ITEM.Model = "models/weapons/w_toolgun.mdl"

ITEM.Functions = {
OnGive = function(ply, item)
item.Hooks.PlayerSpawn(ply, item)
end,

OnTake = function(ply, item)
local grav = ply.OldGravity or 1
ply:SetGravity(grav)
end
}

ITEM.Hooks = {
PlayerSpawn = function(ply, item)
if not ply.OldGravity then
ply.OldGravity = ply:GetGravity()
end

ply:SetGravity(0.3)
end
}

--- End code ---

thanks ! =D

MrPresident:
Break up the spawn hook.. use this code.. not sure if this is going to fix it.. but it might..


--- Code: ---ITEM.Name = "Super Speed"
ITEM.Enabled = true
ITEM.Description = "Gives you super speed!"
ITEM.Cost = 200
ITEM.Model = "models/weapons/w_toolgun.mdl"

ITEM.Functions = {
OnGive = function(ply, item)
item.Hooks.PlayerSpawn(ply, item)
end,

OnTake = function(ply, item)
local oldWalk = ply.OldWalkSpeed or 250
local oldRun = ply.OldRunSpeed or 500
ply:SetWalkSpeed(oldWalk)
ply:SetRunSpeed(oldRun)
end
}

ITEM.Hooks = {
PlayerSpawn = function(ply, item)
if not ply.OldWalkSpeed then
ply.OldWalkSpeed = ply:GetWalkSpeed()
end

if not ply.OldRunSpeed then
ply.OldRunSpeed = ply:GetRunSpeed()
end

ply:SetWalkSpeed(500)
ply:SetRunSpeed(1000)
end
}

--- End code ---

Schiaffino:
Thanks Mr President for always answering me all my questions,

Im going to test this when i get back to ky home

Now im connectrd from my cphone hehe

Thanks

Schiaffino.

Schiaffino:
Hello Mr.President it works :D , but i want to ask you another little question.
yesterday i download a exp mod ... but something is weird.
my users can't see the ( hud of the exp mod ) but also appear the messages " level up " and all those things its weird

can you take a look of this ?

https://www.box.com/shared/pm5huj2nqt

Thanks ! :D

* this is a really important addon for me :P

MrPresident:
Sorry, I can't take a look at a complete addon for you. if you post snips of code that you need fixed, that's one thing, but I can't just install and fix an entire mod!

Why don't you consider writing your own mod to do exactly what you want it to do. I can help you with that if you need.

Navigation

[0] Message Index

[#] Next page

Go to full version