Wisam Posted April 29, 2014 Share Posted April 29, 2014 HEy I wanted to make somthing for my server and its a bug that can be easly abused and ill try to fix it, so my server have assault gamemode and the bug abuse is when the player is dead he should wait 15 seconds to respawn(10seconds killcam) and the way players abuse it that when they die they just click F3(to return to team select menu) and join a team.. so they dont wait 15 seconds. What i want to do is to disable the F3 command(team select menu) UNTIL the player spawns The onPlayerWasted function: Server function onPlayerWasted( ammo, attacker, weapon, bodypart ) destroyBlipsAttachedTo(source) if (noMapLoaded == false) then if (getElementDataLocal( source, "dontRespawn" ) == true) then setElementDataLocal( source, "dontRespawn", false ) --outputDebugString("not spawning player") else if (waiting == true) then --outputDebugString("waiting for start") waitForStart( source ) else --outputDebugString("spawning player") setTimer( spawnPlayerTeam, 15000, 1, source ) pointsOnPlayerWasted(source, ammo, attacker) end end end end And i just added this below pointsOnPlayerWasted: setTimer( unbindKey ( source, "F3", "down", "spawnScreen" ) ,15000,1 ) I got WARNING: assault\assault.lua:911: Bad argument @ 'setTimer' [Expected function at argument 1, got boolean] Link to comment
Martyz Posted April 29, 2014 Share Posted April 29, 2014 Here is the correct way of using it: setTimer(unbindKey, 15000, 1, source, "F3", "down", "spawnScreen" ) But you should unbind it immediately when player dies and bind it after 15 sec. Link to comment
Wisam Posted April 29, 2014 Author Share Posted April 29, 2014 Didnt work, players sill press F3 when dead Link to comment
tosfera Posted April 29, 2014 Share Posted April 29, 2014 Try this timer; setTimer(bindKey, 15000, 1, source, "F3", "down", "spawnScreen" ) You should bind the key after 15 seconds, not unbind it. Link to comment
Wisam Posted April 29, 2014 Author Share Posted April 29, 2014 Try this timer; setTimer(bindKey, 15000, 1, source, "F3", "down", "spawnScreen" ) You should bind the key after 15 seconds, not unbind it. You don't understand, the key is already bound which is the team select menu, now players abuse it by pressing it when they're dead so they dont have to wait for the spawn time.. and i want to unbind it only for 15 seconds(until they spawn) Link to comment
tosfera Posted April 29, 2014 Share Posted April 29, 2014 Ah, well try this then; addEventHandler ( "onPlayerWasted", function () unbindKey ( "F3", "down", spawnScreen ); setTimer ( function () bindKey ( "F3", "down", spawnScreen ); end, 15000, 1 ); end ); It will unbind the key when the player dies, when he dies a timer starts and after 15 seconds they'll be able to use F3. 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