• Post Your Helpful Scripts
    0 replies, posted
Hello ya'll. This thread is a place to post all your useful code snippets. From convenience functions to libraries to full weapon bases. The point is to help people. Try to follow a format like this: [B]Name:[/B] FadeTo [B]Description:[/B] Fades one color to another based on a percent. [B]Code:[/B] [LUA] function FadeTo(col1, col2, perc) return Color( col1.r+(perc/100*(col2.r-col1.r)), col1.g+(perc/100*(col2.g-col1.g)), col1.b+(perc/100*(col2.b-col1.b)), col1.a+(perc/100*(col2.a-col1.a)) ) end [/LUA] [B]Example:[/B] [LUA] ply:SetColor(FadeTo(Color(0,255,0,255), Color(255,0,0,255), ply:Health()) --Fades the player's color from green to red based on their HP. [/LUA] Post away! I know you guys have made some useful stuff over the years. Make yourself useful to everyone else, too!
Sorry, you need to Log In to post a reply to this thread.