| Blockland Forums > Modification Help |
| Activating with a Weapon |
| << < (3/7) > >> |
| M:
It's as simple as --- Code: ---// server.cs function servercmduse(%client) { // Obviously only argument is the client if(isObject(%client.player)) { // Hey look something to call activateStuff() on! How exciting yaaaaaay %client.player.activateStuff(); } } --- End code --- --- Code: ---// client.cs function activate(%a) { if(%a) { // With keybind functions, the only argument is a boolean (0 or 1) telling if the key was pressed (1) or released (0). // We only want this to happen when the key is depressed, not both ways. commandToServer('use'); // Not a big deal if you can send a command to the server without them having the addon, since it'll do nothing } } // Use AddBind resource by Randy, include it in the zip - download it off RTB exec("./AddBind.cs"); // CHECK THESE ARGUMENTS. I'm not sure they're the right way round. addBind("Action","Use","activate"); --- End code --- That's my good deed of the... year. |
| phflack:
--- Quote from: M on September 24, 2010, 03:42:26 AM ---It's as simple as --- Code: ---// server.cs function servercmduse(%client) { // Obviously only argument is the client if(isObject(%client.player)) { // Hey look something to call activateStuff() on! How exciting yaaaaaay %client.player.activateStuff(); } } --- End code --- --- Code: ---// client.cs function activate(%a) { if(%a) { // With keybind functions, the only argument is a boolean (0 or 1) telling if the key was pressed (1) or released (0). // We only want this to happen when the key is depressed, not both ways. commandToServer('use'); // Not a big deal if you can send a command to the server without them having the addon, since it'll do nothing } } // Use AddBind resource by Randy, include it in the zip - download it off RTB exec("./AddBind.cs"); // CHECK THESE ARGUMENTS. I'm not sure they're the right way round. addBind("Action","Use","activate"); --- End code --- That's my good deed of the... year. --- End quote --- so that's what %on does :o i thought it was something like that, also, why not just toggle tools, toggle mouse fire, toggle mousefire, toggle tools? then it would be all client sided |
| Headcrab Zombie:
--- Quote from: phflack on September 24, 2010, 03:32:21 PM ---why not just toggle tools, toggle mouse fire, toggle mousefire, toggle tools? then it would be all client sided --- End quote --- For the third time: --- Quote from: Headcrab Zombie on September 22, 2010, 04:56:44 PM ---that could mess up with weapons that have some sort of onMount animation or warmup before being usable. --- End quote --- |
| phflack:
--- Quote from: Headcrab Zombie on September 24, 2010, 04:56:39 PM ---For the third time: --- End quote --- yes, so? it will just cause it to redo the take out animation, so you couldn't shoot right after, but it's client sided at least :D |
| Chrono:
--- Quote from: Headcrab Zombie on September 22, 2010, 04:56:44 PM ---I guess you could make a bind to unequip weapon, click, and then reequip weapon, but that could mess up with weapons that have some sort of onMount animation or warmup before being usable. With a clientside bind and serverside script, you should be able to do it pretty easily, as long at Player::ActivateStuff doesn't have a check for equipped weapons, it should work. --- End quote --- Anything that requires both client and server to have it installed never works very well, and generally gets underused and because activating stuff is actively used, it may actually give unfair advantages if the occurrence and popularity are low. --- Quote from: Killbunny on September 23, 2010, 10:27:34 AM ---So wait, how do I set Player::ActivateStuff to work with weapons? --- End quote --- Using another function to call it. --- Quote from: phflack on September 23, 2010, 03:25:51 PM ---why a server command? why not have it be clientsided? also, i could make your way easily :D --- End quote --- That would screw over weapons that have a long readying time. How about... * Chrono gaspsPURE SERVER SIDED!? Check this stuff out. --- Code: ---package activateWTools { function serverCmdCancelBrick(%c) { if(isObject(%c.player)) %c.player.activateStuff(); parent::serverCmdCancelBrick(%c); } }; activatepackage(activateWTools); --- End code --- The only problem I could see with this is canceling portals if you wanted to open a door/press a button. |
| Navigation |
| Message Index |
| Next page |
| Previous page |