Jump to content

toptional

Members
  • Posts

    493
  • Joined

Posts posted by toptional

  1. Simple short code not working.

    (Server Sided)

    function getInterior ( thePlayer ) 
        if ( getElementInterior( thePlayer ) == 0 ) then 
            outputChatBox ( "Yes you are outside ", thePlayer ) 
        else 
            outputChatBox ( "No you aren't outside ", thePlayer ) 
        end 
    end 
    addEventHandler("onResourceStart",getRootElement(),getInterior) 
      
    

  2. Our typical server setup looks along the lines of:

    Dual Intel Xeon E5-2620+ (24+ CORES!)

    64-256GB RAM

    SSD ONLY Memory in RAID

    1Gbit+ Network

    Thats a joke right? SSD RAID? 256GB RAM? 24+ Cores.... You must be having a laugh? Not even google uses these kinds of specs! This would cost you probably $5,000 a month! False advertising much? if this was true i'd love to see some proof...

  3. Another issue D: It outputs the message 3 times, when you go and get the vehicle fixed.

      
    function fixUK ( hitPlayer, matchingDimension ) 
        if ( hitPlayer == localPlayer ) then 
                local vehicle = getPedOccupiedVehicle ( hitPlayer ) 
                if not ( vehicle ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end 
                local vehicleHealth = getElementHealth ( vehicle ) 
                if vehicleHealth <= 950 then 
                    fadeCamera ( false ) 
                    --toggleAllControls ( false ) 
                    setElementFrozen ( vehicle, true ) 
                    setTimer ( 
                        function ( ) 
                            fixVehicle ( vehicle ) 
                            --toggleAllControls ( true ) 
                            setElementFrozen ( vehicle, false ) 
                            fadeCamera ( true ) 
                            takePlayerMoney(250) 
                            outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) 
                        end 
                        , 2000, 1 
                    ) 
            end 
        end 
    end 
    addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) 
      
      
    function fixUSA ( hitPlayer, matchingDimension ) 
        if ( hitPlayer == localPlayer ) then 
                local vehicle2 = getPedOccupiedVehicle ( hitPlayer ) 
                if not ( vehicle2 ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end 
                local vehicleHealth2 = getElementHealth ( vehicle2 ) 
                if vehicleHealth2 <= 950 then 
                    fadeCamera ( false ) 
                    --toggleAllControls ( false ) 
                    setElementFrozen ( vehicle2, true ) 
                    setTimer ( 
                        function ( ) 
                            fixVehicle ( vehicle2 ) 
                            --toggleAllControls ( true ) 
                            setElementFrozen ( vehicle2, false ) 
                            fadeCamera ( true ) 
                            takePlayerMoney(250) 
                            outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) 
                        end 
                        , 2000, 1 
                    ) 
            end 
        end 
    end 
    addEventHandler ( "onClientMarkerHit", USAMarker, fixUSA ) 
      
      
    function fixUK ( hitPlayer, matchingDimension ) 
        if ( hitPlayer == localPlayer ) then 
                local vehicle3 = getPedOccupiedVehicle ( hitPlayer ) 
                if not ( vehicle3 ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end 
                local vehicleHealth3 = getElementHealth ( vehicle3 ) 
                if vehicleHealth3 <= 950 then 
                    fadeCamera ( false ) 
                    --toggleAllControls ( false ) 
                    setElementFrozen ( vehicle3, true ) 
                    setTimer ( 
                        function ( ) 
                            fixVehicle ( vehicle3 ) 
                            --toggleAllControls ( true ) 
                            setElementFrozen ( vehicle3, false ) 
                            fadeCamera ( true ) 
                            takePlayerMoney(250) 
                            outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) 
                        end 
                        , 2000, 1 
                    ) 
            end 
        end 
    end 
    addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) 
      
      
    function fixUK ( hitPlayer, matchingDimension ) 
        if ( hitPlayer == localPlayer ) then 
                local vehicle4 = getPedOccupiedVehicle ( hitPlayer ) 
                if not ( vehicle4 ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end 
                local vehicleHealth4 = getElementHealth ( vehicle4 ) 
                if vehicleHealth4 <= 950 then 
                    fadeCamera ( false ) 
                    --toggleAllControls ( false ) 
                    setElementFrozen ( vehicle4, true ) 
                    setTimer ( 
                        function ( ) 
                            fixVehicle ( vehicle4 ) 
                            --toggleAllControls ( true ) 
                            setElementFrozen ( vehicle4, false ) 
                            fadeCamera ( true ) 
                            takePlayerMoney(250) 
                            outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) 
                        end 
                        , 2000, 1 
                    ) 
            end 
        end 
    end 
    addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) 
      
    

    P.S The markers are created before the script don't worry

  4. function fixUK ( hitPlayer, matchingDimension ) 
        if ( hitPlayer == localPlayer ) then 
                local vehicle = getPedOccupiedVehicle ( hitPlayer ) 
                if not ( vehicle ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end 
                local vehicleHealth = getElementHealth ( vehicle ) 
                if vehicleHealth <= 100 then 
                    fadeCamera ( false ) 
                    --toggleAllControls ( false ) 
                    setElementFrozen ( vehicle, true ) 
                    setTimer ( 
                        function ( ) 
                            fixVehicle ( vehicle ) 
                            --toggleAllControls ( true ) 
                            setElementFrozen ( vehicle, false ) 
                            fadeCamera ( true ) 
                            takePlayerMoney(250) 
                            outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) 
                        end 
                        , 2000, 1 
                    ) 
            end 
        end 
    end 
    addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) 
    

    Thanks you fixed it

  5. I get this debug error

    ERROR: line 18: attempt to compare boolean with number

    It's supposed to when you enter the marker see if your vehicle health is below 100% if it is, it fixes it, if not it does nothing.

    UKMarker = createMarker ( -2079.88, 2099.58, 15.5,"cylinder",6.0,255,255,0,125) 
    USAMarker = createMarker (349.18, 2540.00, 15.5,"cylinder",6.0,255,255,0,125) 
    RUSMarker = createMarker ( 2205.92, -219.31, 16.5,"cylinder",6.0,255,255,0,125) 
    GERMarker = createMarker ( -1088.41, -1036.57, 128.25,"cylinder",6.0,255,255,0,125) 
      
    UKBlip = createBlipAttachedTo ( UKMarker,63, 1,0,0,0,255,0,3000,getRootElement()) 
    USABlip = createBlipAttachedTo ( USAMarker,63, 1,0,0,0,255,0,3000,getRootElement()) 
    RUSBlip = createBlipAttachedTo ( RUSMarker,63, 1,0,0,0,255,0,3000,getRootElement()) 
    GERBlip = createBlipAttachedTo ( GERMarker,63, 1,0,0,0,255,0,3000,getRootElement()) 
         
      
    function fixUK ( hitPlayer, matchingDimension ) 
        if ( hitPlayer == localPlayer ) then 
            if ( getElementType ( hitPlayer ) == "player" ) then 
                local vehicle = getPedOccupiedVehicle ( hitPlayer ) 
                if ( vehicle ) then 
                local vehicleHealth = getElementHealth ( playerVehicle ) 
                if vehicleHealth <= 100 then 
                    fadeCamera ( false ) 
                    --toggleAllControls ( false ) 
                    setElementFrozen ( vehicle, true ) 
                    setTimer ( 
                        function ( ) 
                            fixVehicle ( vehicle ) 
                            --toggleAllControls ( true ) 
                            setElementFrozen ( vehicle, false ) 
                            fadeCamera ( true ) 
                            takePlayerMoney(250) 
                            outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) 
                        end 
                        , 2000, 1 
                    ) 
                else 
                    outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) 
                end 
                end 
            end 
        end 
    end 
    addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) 
    

  6. This script is supposed to bassically, it checks if your in a vehicle and if you are it fixes it, if your not in a vehicle it tells you.

    Problem is i'm in a vehicle and get the message saying I'm not in a vehicle, no debug errors

    UKMarker = createMarker ( -2079.88, 2099.58, 15.5,"cylinder",7.0,255,255,0,125) 
    function fixUK ( hitPlayer, matchingDimension ) 
        if ( hitPlayer == localPlayer ) then 
    local vehicle = getPedOccupiedVehicle ( thePlayer ) 
        if vehicle then 
                fixVehicle ( vehicle ) 
                outputChatBox ( "Your vehicle was fixed!", player, 0, 255, 0 ) 
            else 
                outputChatBox ( "You need to be in a vehicle!", player, 255, 0, 0 ) 
        end 
        end 
    end 
    addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) 
    

  7. Try this!

      
    function bmoney (thePlayer) 
            getPlayerMoney(thePlayer) 
            takePlayerMoney ( thePlayer, 100) 
            outputChatBox ( "#FFFF00Você gastou 100$ para usar este comando ( /bind )",thePlayer, 255, 255, 255, true ) 
    end 
    addCommandHandler ( "money", bmoney ) 
      
    

    (Not tested)

    I changed the bind to money becuase bind is already handled by MTA, so do /money and it should hopefully take away $100

  8. How about this?

      
    --/criminal 
    function setCriminal () 
    getPlayerTeam ( source ) = gotTeam 
    if gotTeam == Criminals 
    then 
        outputChatBox ("You are already a Criminal!",source,255,0,0) 
    else  
        setPlayerTeam (source,getTeamFromName(tostring(Criminals))) 
        outputChatBox ("You are now a Criminal!",source,255,0,0) 
    end 
    end 
    addCommandHandler("criminal",setCriminal) 
      
    

  9. I have a slight issue, I get a bad argument for setPlayerTeam when the person does /criminal, another issue is who ever does /criminal the chat appears to everyone ^_^

    (This is all server side)

    On another script the team is created

    local Criminals = createTeam ("Criminals",220,0,0) 
    

    Here is a different script where /criminal is made but not working D:

    function setCriminal () 
    if not Criminals 
    then 
        setPlayerTeam (source,Criminals) 
        outputChatBox ("You are now a Criminal!",source,255,0,0) 
    else  
        outputChatBox ("You are already a Criminal!",source,255,0,0) 
    end 
    end 
    addCommandHandler("criminal",setCriminal) 
      
    

  10. Having an issue in my testing gamemode, when I die the camera just looks at the body back and forth and does nothing i tried adding this script but nothing changed :/

    --respawning 
    function respawn () 
        spawnPlayer (source, 1177.5682373047, -1323.2587890625, 14.077121734619 ) 
        outputChatBox ( getPlayerName ( source ).." died and was transported to All Saints Hospital.") 
    end 
    addEventHandler("onPlayerWated", getRootElement(),respawn) 
    

  11. I have another issue D: I don't know why but the teams arn't saving

    Server part - This is triggered when you first join the server and have to choose a skin, once that is done it saves your team as unemployed

      
    addEvent("lookSkin",true) 
    addEventHandler("lookSkin",root,function(skin) 
        setAccountData ( getPlayerAccount(source), "CMGRP.team", "Unemployed" )  
        givePlayerMoney(source,10000) 
        giveWeapon ( source, 22, 90, true ) 
        giveWeapon ( source, 4, 1, false ) 
        setElementModel(source,skin) 
        --setPlayerTeam ( source,Unemployed) 
    end) 
      
    

    In the save script here is the server side part

    addEventHandler("onPlayerQuit",getRootElement(), 
    function ( ) 
        account = getPlayerAccount(source) 
        if not isGuestAccount (account ) then 
            local Team = getPlayerTeam ( source ) 
            setAccountData (account, "CMGRP.team",Team) 
        end 
    end 
    ) 
      
    addEventHandler("onPlayerLogout",getRootElement(), 
    function ( account ) 
        if not isGuestAccount (account ) then 
            local Team = getPlayerTeam ( source ) 
            setAccountData (account, "CMGRP.team",Team) 
        end 
    end 
    ) 
      
    function loadStats( _,account ) 
        local team = getAccountData ( source, "CMGRP.team") 
            setPlayerTeam (source,team) 
        if x and y and z then 
            spawnPlayer(source,x,y,z + 0.5,tonumber(skin),0) 
            setCameraTarget(source) 
            fadeCamera(source,true,2.5) 
        else 
            --spawnPlayer(source,0,0,999999) 
            --setCameraTarget(source) 
            --fadeCamera(source,true,2.5) 
        end 
    end 
    addEventHandler("onPlayerLogin",getRootElement(),loadStats) 
    

    I've took out the unimportant stuff don't worry everything is defined, maybe not at the team part thats where the issue is D:

×
×
  • Create New...