Frequency Posted January 3, 2008 Share Posted January 3, 2008 I didn't see any other collaborative snippet dipository, so I thought here would probably be the most appropriate place to post. With this aside, post your useful snippets here! They could be funny, wacky, interesting, useful for other scripters, or all of the above?! Let your imagination roll. Please try to keep this topic as clean as possible. That means, refrain from getting off-topic, refrain from posting snippets already provided, and refrain from not complying to the forum rules! Ensure you have fully commented your code too (this is nessesary, as this is supposed to be an educational experience too ). I'll get the ball rolling: Simple Key Binder This snippet allows users on your server to create binds for their keys, to display text in the chat window. -- The bind parser. function parseSayBind ( source, key, keyState , cmd, say) -- Send all clients a message in the chatbox, with the user's nick and binded text. outputChatBox ( getClientName ( source ) .. ": " .. say) end -- The command parser function bindSay ( source , cmd , key, say) -- Check to see if the command has correct parameters. if not key or not say then -- Tell the player he/she has entered the command incorrectly. outputChatBox ( "/bindsay [key] [text]", source, 255, 0, 0 ) return 1 end -- Set the key to be binded. bindKey ( source, key, "down", parseSayBind , cmd, say) end -- /bindsay [key] [text] addCommandHandler ( "bindsay", bindSay ) Link to comment
norby89 Posted January 3, 2008 Share Posted January 3, 2008 nice thread here's an idea for a next snippet: Anti-flood for the Simple Key Binder Link to comment
Franc[e]sco Posted January 3, 2008 Share Posted January 3, 2008 A simple command layout function myCommand(thePlayer, commandName --[[You can add more variables here]]) -- do something end addCommandHandler("mycommand", broadcastMessage) Link to comment
Frequency Posted January 3, 2008 Author Share Posted January 3, 2008 Anti-Minigun Stop unwanted minigun users on your server! function removeMinigun ( previousID, newID ) if newID == 38 then takeWeapon(getRootElement(), 38 ) end end addEventHandler ( "onClientPlayerWeaponSwitch", getRootElement(), removeMinigun ) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now