• how is this coded?
    45 replies, posted
[QUOTE=SkitZz;47344482]Oh, give me a break. It's such a little thing.[/QUOTE] the little things all add up to the big picture, it's worth struggling over something for hours and hours with tutorials and example code (no c+ping) and the wiki open to come up with it your self, you'll learn a lot more much faster like that
Maybe not faster but in the long run its more than worth it. It also helps if you have prior knowledge in any other language, even Javascript.
[QUOTE=LUModder;47344282]Doesn't mean you have to spoonfeed, people don't learn if you do that.[/QUOTE] I learned entirely from reading other people's code; if I see how someone does it, I'll never forget it. Even today, if I don't understand a concept, I'll look at how someone else utilised it; some people don't work well through hours of struggle and trial-and-error.
[QUOTE=code_gs;47345497]I learned entirely from reading other people's code; if I see how someone does it, I'll never forget it. Even today, if I don't understand a concept, I'll look at how someone else utilised it; some people don't work well through hours of struggle and trial-and-error.[/QUOTE] everyone first of all thanks for helping me :) i love it how friendly ppl there are on these forums. could you help me understanding hooks and this line is really hard to understand f( IsValid( dmg:GetAttacker() ) && dmg:GetAttacker():IsPlayer() && dmg:GetAttacker():GetActiveWeapon():GetClass() == "INSERT WEAPON NAME HERE") then like i get it it checks for attacker and if he is player then it gets activeweapon if its binachi then ... etc but like what are those && :oo
[QUOTE=frozendragon;47347033]everyone first of all thanks for helping me :) i love it how friendly ppl there are on these forums. could you help me understanding hooks and this line is really hard to understand f( IsValid( dmg:GetAttacker() ) && dmg:GetAttacker():IsPlayer() && dmg:GetAttacker():GetActiveWeapon():GetClass() == "INSERT WEAPON NAME HERE") then like i get it it checks for attacker and if he is player then it gets activeweapon if its binachi then ... etc but like what are those && :oo[/QUOTE] && means "and" Outside of GLua, you wouldn't be able to use them with Lua. In "proper" Lua it would read: [lua]if IsValid( dmg:GetAttacker() ) and dmg:GetAttacker():IsPlayer() and dmg:GetAttacker():GetActiveWeapon():GetClass() == "CLASS" then[/lua] It's all a matter of preference, really.
thanks :) [editline]18th March 2015[/editline] Hey, about the slowing thing. Can someone explain me how this works? timer.Create( "Slow", 1, 6, function() victim:SetWalkSpeed(OriginalSpeed) timer.Destroy("Slow") end ) the 1,6 part? and seems like the timer.Destroy doesnt work. i shoot once and enemy gets slowed forever. :/
[QUOTE=frozendragon;47347248]thanks :) [editline]18th March 2015[/editline] Hey, about the slowing thing. Can someone explain me how this works? timer.Create( "Slow", 1, 6, function() victim:SetWalkSpeed(OriginalSpeed) timer.Destroy("Slow") end ) the 1,6 part? and seems like the timer.Destroy doesnt work. i shoot once and enemy gets slowed forever. :/[/QUOTE] 1 is the delay, and 6 is the reps. So, that will a total of 6 times. Once a second for 6 seconds. Use timer.Simple instead for this script, timer.Simple( 6, function() victim:SetWalkSpeed( OriginalSpeed ) end ) After 6 seconds, it will set the walk speed back to the original.
hey guys, the damage updates wont work if i wont like edit the lua files and re-save them. is there someway to make them work without thaT?
anyone :/? [editline]18th March 2015[/editline] guys i have two questions: i think my damage enchancments on weapons dont run automaticly even tho theyre in autorun/server and umm how can i make code that umm [code]function ITEM:OnEquip(ply, modifications) ply:SetHealth(2000) end[/code] instead of setting players health to 2000 it multiplies health player has AT THE MOMENT and adds the amount of multiplied? [editline]18th March 2015[/editline] would this work? ply:Scale():SetHealth*10
buump
Don't even know what you're asking on the first one. For setting health, no. SetHealth( Health() * 10 ) Use the wiki.
[QUOTE=Greetings;47350767]Don't even know what you're asking on the first one. For setting health, no. SetHealth( Health() * 10 ) Use the wiki.[/QUOTE] I mean, the lua files i made about damage increasement, and slow effect. are in autorun/server. if i loadup server and then shoot with my binachi the damage is normal and lua file doesnt apply to it. if i go to lua file and for example edit the dmg increasement value and re-save it. then it refreshes and binachi will now shoot with more dmg. but i have no idea why it doesnt work without that , thanks with hp:)
You can retrieve health via ply:Health() So something like [code] local fuck = ply:Health() ply:SetHealth(fuck*10) [/code]
[QUOTE=frozendragon;47350064]buump[/QUOTE] snipes
thx about hp , anyone have idea about script not loading?
[QUOTE]instead of setting players health to 2000 it multiplies health player has AT THE MOMENT and adds the amount of multiplied?[/QUOTE] To multiply the current health of a player though you just need to get their health and then add/multiply that, for example: [lua] ply:SetHealth(ply:Health() + (ply:Health() * 2000)) [/lua] And it seems like you are doing it on a pointshop item? Put the file in pointshop/items/<category> if that is case, I don't think they load from the autorun. But why would you would want their health to scale like this on equipping an item?
Sorry, you need to Log In to post a reply to this thread.