Jump to content

CJGrove

Members
  • Posts

    54
  • Joined

  • Last visited

Posts posted by CJGrove

  1. Read edit2.

    Edit:

    function isguest ( ) 
        player = getClientAccount ( source ) 
        if isGuestAccount ( player ) then 
        unbindKey ( player, "enter", "down", cdm_spawn ) 
        outputChatBox ( "You need to login before you can spawn. (/login password) (/register password)", sourceAccount ) 
        else 
        bindKey ( player, "enter", "down", cdm_spawn ) 
        end 
    end 
    addEventHandler ( "onPlayerJoin", getRootElement(), isguest ) 
      
    function guestlogin () 
        local player = getPlayerFromNick (getClientName (source)) 
        bindKey ( player, "enter", "down", cdm_spawn ) 
    end 
    addEventHandler("onClientLogin",getRootElement(),guestlogin) 
      
    function guestlogout () 
        local player = getPlayerFromNick (getClientName (source)) 
        unbindKey( player, "enter", "down", cdm_spawn ) 
    end 
    addEventHandler("onClientLogout",getRootElement(),guestlogout ) 
    

    [12:58:02] WARNING: cdm.lua: Bad 'player' pointer @ 'unbindKey'(1) - Line: 259 
    

  2. Error:

    [12:45:09] SCRIPT ERROR: ...n/MTA Server/mods/deathmatch/resources/functionscript/functionscript.lua:820: unexpected symbol near ')' 
    [12:45:09] INFO: Loading script failed: ...n/MTA Server/mods/deathmatch/resources/functionscript/functionscript.lua:820: unexpected symbol near ')' 
    

    Edit:

    Using this code

    function isguest ( ) 
        sourceAccount = getClientAccount ( source ) 
        if isGuestAccount ( sourceAccount ) then 
        unbindKey ( player, "enter" ) 
        outputChatBox ( "You need to login before you can spawn. (/login password) (/register password)", sourceAccount ) 
        else 
        bindKey ( player, "enter", "down", cdm_spawn,  player ) 
        end 
    end 
    addEventHandler ( "onPlayerJoin", getRootElement(), isguest ) 
      
    function guestlogin () 
        local player = getPlayerFromNick (getClientName (source)) 
        bindKey ( player, "enter", "down", cdm_spawn,  player ) 
    end 
    addEventHandler("onClientLogin",getRootElement(),guestlogin) 
      
    function guestlogout () 
        local player = getPlayerFromNick (getClientName (source)) 
        unbindKey( player, "enter") 
    end 
    addEventHandler("onClientLogout",getRootElement(),guestlogout ) 
    

    Getting this error:

    [12:50:10] WARNING: cdm.lua: Bad argument @ 'unbindKey' - Line: 259 
    

    Edit2:

    Using this code

    function isguest ( ) 
        player = getClientAccount ( source ) 
        if isGuestAccount ( sourceAccount ) then 
        unbindKey ( player, "enter" ) 
        outputChatBox ( "You need to login before you can spawn. (/login password) (/register password)", sourceAccount ) 
        else 
        bindKey ( player, "enter", "down", cdm_spawn,  player ) 
        end 
    end 
    addEventHandler ( "onPlayerJoin", getRootElement(), isguest ) 
      
    function guestlogin () 
        local player = getPlayerFromNick (getClientName (source)) 
        bindKey ( player, "enter", "down", cdm_spawn,  player ) 
    end 
    addEventHandler("onClientLogin",getRootElement(),guestlogin) 
      
    function guestlogout () 
        local player = getPlayerFromNick (getClientName (source)) 
        unbindKey( player, "enter") 
    end 
    addEventHandler("onClientLogout",getRootElement(),guestlogout ) 
    

    Getting no errors but no effect what so ever.

  3. Thanks for fast and good reply Mr.Hankey,

    Still got a lot to learn i gues...

    But were not quite there yet

    Using this code:

    function isguest ( ) 
        sourceAccount = getClientAccount ( source ) 
        if isGuestAccount ( sourceAccount ) then 
        toggleControl ( source, "enter", false ) 
        outputChatBox ( "You need to login before you can spawn. (/login password) (/register password)", sourceAccount ) 
        else 
        toggleControl ( source, "enter", true ) 
        end 
    end 
    addEventHandler ( "onPlayerJoin", getRootElement(), isguest ) 
      
    function guestlogin () 
        toggleControl ( source, "enter", true ) 
    end 
    addEventHandler("onClientLogin",getRootElement(),guestlogin) 
      
    function guestlogout () 
        toggleControl ( source, "enter", false ) 
    end 
    addEventHandler("onClientLogout",getRootElement(),guestlogout) 
    

    Getting this error:

    [12:04:29] WARNING: functionscript.lua: Bad 'player' pointer @ 'enableControl'(1) - Line: 826 
    

    Thanks in advance,

    CJGrove

  4. Hello,

    I tried to make a script that would it make impossible for guests to spawn. (enter is spawn button)

    But i got some errors but it is like this documented on wiki.

    script:

    function isguest ( playerSource ) 
        sourceAccount = getClientAccount ( playerSource ) 
        if isGuestAccount ( sourceAccount ) then 
        toggleControl ( source, "enter", false ) 
        outputChatBox ( "You need to login before you can spawn. (/login password) (/register password)", sourceAccount ) 
        else 
        toggleControl ( source, "enter", true ) 
        end 
    end 
    addEventHandler ( "onPlayerJoin", getRootElement(), isguest ) 
      
    function guestlogin () 
        toggleControl ( source, "enter", true ) 
    end 
    addEventHandler("onClientLogin",getRootElement(),guestlogin) 
      
    function guestlogout () 
        toggleControl ( source, "enter", false ) 
    end 
    addEventHandler("onClientLogout",getRootElement(),guestlogout) 
    

    Errors:

    [11:37:00] WARNING: functionscript.lua: Bad argument @ 'getClientAccount' - Line: 815 
    [11:37:00] WARNING: functionscript.lua: Bad argument @ 'isGuestAccount' - Line: 816 
    

    Please help me.

    Greetings CJGrove

  5. i have a temporary fix for this situation now. I make a seperate command to refresh the model. Do this a few times and it should fix it.

    Lets use the Bullet for an example.

      
    function load ( ) 
        txd = engineLoadTXD("data/bullet.txd") 
        engineImportTXD(txd, 541) 
        dff = engineLoadDFF("data/bullet.dff", 541 ) 
        engineReplaceModel(dff, 541) 
        outputChatBox ( "The Bullet Has Been Converted Into A GT-40" ) 
    end 
      
    addCommandHandler ( "GT-Refresh", unload ) 
      
    

    I don't get the command handler. Please explain this to me.

    addCommandHandler ( "GT-Refresh", unload )

    Why unload while the function name is load?

    Greetings,

    CJGrove

  6. Hello all,

    I tried something like this but it doesn't kill the player can someone help me with this?

    Thanks in advance :)

    function setFriendlyFireOn ( )      
            for index, theTeam in ipairs ( getElementsByType("team") ) do 
                    if ( getTeamFriendlyFire ( theTeam ) == false ) then 
                            setTeamFriendlyFire ( theTeam, true ) 
                            outputChatBox ( "Friendly fire turned ON", 255, 0, 0 ) 
                            outputDebugString ( "Friendly fire turned ON", 3 ) 
                            else 
                            setTeamFriendlyFire ( theTeam, false ) 
                            outputChatBox ( "Friendly fire turned OFF", 0, 255, 0 ) 
                            outputDebugString ( "Friendly fire turned OFF", 3 ) 
                    end 
            end 
    end 
      
    function friendlyfire ( theTeam, ammo, killer, killerweapon, bodypart ) 
       for index, theTeam in ipairs ( getElementsByType("team") ) do 
         if ( getTeamFriendlyFire ( theTeam ) == false ) then 
           if ( killer ) and ( killer ~= source ) then  
             kill = killPlayer ( killer ) 
             if ( kill ) then 
              outputChatBox ( "FRIENDLY FIRE BY " .. killer .. "! He has been killed.", 255, 0, 0 ) 
              else 
              outputDebugString ( "Player hasn't been killed", 3 ) 
             end 
            else 
            outputDebugString ( "Source is killer", 3 ) 
           end 
         end 
       end 
    end 
      
    function getff ( ) 
      for index, theTeam in ipairs ( getElementsByType("team") ) do 
        if ( getTeamFriendlyFire ( theTeam ) == false ) then 
        outputChatBox ( "Friendly fire turned off. You will be killed when you kill your teammate.", source ) 
        else 
        outputChatBox ( "Friendly fire turned on. You can kill your teammate.", source ) 
        end 
      end 
    end 
      
    addCommandHandler ( "getff", getff ) 
    addCommandHandler ( "setff", setFriendlyFireOn ) 
    addEventHandler ( "onPlayerWasted", getRootElement(), friendlyfire ) 
    

  7. You can beter use give player so a player keeps his last money.

    addEventHandler("onPlayerSpawn", getRootElement(), function 
        givePlayerMoney( source, 10000 ) -- gives the player $10,000 on spawn 
    end ) 
    

  8. Think this should work?

    function checkName() 
        if getClientName ( source ) =~ getPlayerUserName ( source ) then 
            setClientName ( source, getPlayerUserName ( source ) ) 
        end 
    end 
    addEventHandler ( "onPlayerJoin", getRootElement(), checkName ) 
    

    This will stop them for using an other name (fake) then their username.

  9. What happens if the 10 minutes are over?

    I think it would be realy cool if you make 3 big explosions and start a new round.

    (im not sure if this is possible but: You could make the ship sink after the explosions en set all player camera's at the sinking ship.)

    Greetings

  10. Hello,

    First of all use the search thing.

    This is the code:

    function replaceModel() 
      txd = engineLoadTXD ( "data/petrotr.txd" ) 
      engineImportTXD ( txd, 584 ) 
      dff = engineLoadDFF ( "data/petrotr.dff", 584 ) 
      engineReplaceModel ( dff, 584 ) 
    end 
    addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) 
    

    CLIENT SIDE!!!

    When you are in the server type /restart scriptname and it will load correctly

    I never tried this but you could:

    function replaceModel() 
      txd = engineLoadTXD ( "data/petrotr.txd",  584 ) 
      engineImportTXD ( txd, 584 ) 
      dff = engineLoadDFF ( "data/petrotr.dff", 584 ) 
      engineReplaceModel ( dff, 584 ) 
    end 
    addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) 
    

    And then look if it works correctly when you DON'T restart the script.

    Greetings,

    CJGrove

  11. Try

    function replaceTheObjs() 
        txd = engineLoadTXD ( "box.txd" ) 
         engineImportTXD ( txd, 2918 ) 
        dff = engineLoadDFF ( "box.dff", 2918 ) 
         engineReplaceModel ( dff, 2918 ) 
      
        createObject( 2918, -750.46569824219, 1026.3781738281, 45.267562866211 ) 
    end 
    addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), replaceTheObjs ) 
    

    Greetings,

    CJGrove

×
×
  • Create New...