ChaiScript Question,
-
Hi All! This is my save/load script that a buddy wrote awhile back, he has since disappeared. This was written when chaiscript was still just recently released.
i remember him saying there was a reason i could not set save to justmeleebuttonpressed
and load tousebuttonpressed. i was wondering if this is now possible.
also he said something about needed a 2 arg's to make this work. thats apparently why he added 2 arg's for each function.if anyone knows any way i can change this to just meleebuttonpressed and usebuttonpressed please let me know!!
and like always, i appreciate any help you can give. Thanks!!

global coordinates = Vector(); for(var i = 0; i < 18; ++i){ coordinates.push_back([0, 0, 0]); } global angles = Vector(); for(var i = 0; i < 18; ++i){ angles.push_back([0, 0, 0]); } level.onNotify("connected", fun(arguments) { var player = arguments[0]; manage_location(player); player.onNotify("grenade_fire", fun[player](arguments){ arguments[0].delete(); }); player.onNotify("spawned_player", fun[player](arguments){ refill_ammo(player); }); player.onNotify("weapon_fired", fun[player](arguments){ refill_ammo(player); }); }); def manage_location(player) { var ID = player.getEntityNumber(); player.onNotify("weapon_switch_started", fun[player, ID](arguments) { if(player.getStance() == "prone" && player.isOnGround() == 1){ var origin = player.getOrigin(); origin[2] += 800; player.setOrigin(origin); } }); player.onNotify("weapon_switch_started", fun[player, ID](arguments) { if(player.getStance() == "crouch" && player.isOnGround() == 1){ coordinates[ID] = player.getOrigin(); angles[ID] = player.getPlayerAngles(); player.iPrintLn("^3> ^7Your spawnpoint has been set^7!"); } }); player.onNotify("weapon_fired", fun[player, coordinates, angles, ID](arguments) { if(player.getStance() == "crouch" && coordinates[ID][0] != 0){ player.setOrigin(coordinates[ID]); player.setPlayerAngles(angles[ID]); } }); player.onNotify("weapon_fired", fun[player, coordinates, angles, ID](arguments) { if(player.getStance() == "prone"){ player.suicide(); } }); } def refill_ammo(player) { player.giveMaxAmmo(player.getCurrentWeapon()); } def onPlayerDamage(ePlayer, eInflictor, eAttacker, iDamage, iDflags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitloc, iTimeOffset) { if(sMeansOfDeath != "MOD_TRIGGER_HURT" && sMeansOfDeath != "MOD_SUICIDE" && sMeansOfDeath != "MOD_FALLING"){ iDamage = 0; } return iDamage; } add_callback_player_damage(onPlayerDamage); -
player.meleeButtonPressed() == 1 player.adsButtonPressed() == 1 player.fragButtonPressed() == 1 player.secondaryOffhandButtonPressed() == 1 player.useButtonPressed() == 1as far as I know, then these functions check for pressing at a given time, and for checking you need to use a timer
setInterval(fun[player]() { if (player.useButtonPressed() == 1) { /* magic */ } }, 10);I think I understood the question correctly and was able to answer it

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login