Jump to content

[Help] Spawn bug


Wisam

Recommended Posts

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
Try this timer;
setTimer(bindKey, 15000, 1, source, "F3", "down", "spawnScreen" ) 

You should bind the key after 15 seconds, not unbind it. :P

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...