Jump to content

Problems


Jaysds1

Recommended Posts

Posted

Mind posting your whole script...?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Replies 365
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Here:

  
  
-- Teams 
  
  
function Tro() 
    dxDrawImage(316.0,241.0,129.0,114.0,"tropas.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
    dxDrawText("Tropas",327.0,175.0,427.0,231.0,tocolor(255,255,255,255),2.0,"default","center","center",false,false,false) 
end 
  
addEvent("Tpas",true) 
addEventHandler("Tpas", getRootElement(), 
function() 
addEventHandler("onClientRender",root, Tro) 
setTimer (Tro ,13000, 1, removeEventHandler("onClientRender",root, Tro)) 
end) 
  
    function Snaz() 
        dxDrawImage(325.0,231.0,103.0,99.0,"spetsnaz.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
        dxDrawText("Spetsnaz",327.0,175.0,427.0,231.0,tocolor(255,255,255,255),2.0,"default","center","center",false,false,false) 
    end 
  
addEvent("Spets",true) 
addEventHandler("Spets", getRootElement(), 
function() 
addEventHandler("onClientRender",root, Snaz) 
setTimer (Snaz ,13000, 1, removeEventHandler("onClientRender",root, Snaz)) 
end) 
  
  
    function P40() 
        dxDrawImage(318.0,231.0,134.0,122.0,"op40.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
        dxDrawText("OP40",327.0,175.0,427.0,231.0,tocolor(255,255,255,255),3.0,"default","center","center",false,false,false) 
    end 
  
addEvent("O40",true) 
addEventHandler("O40", getRootElement(), 
 function() 
 addEventHandler("onClientRender",root, P40) 
 setTimer (P40 ,13000, 1, removeEventHandler("onClientRender",root, P40)) 
 end) 
  
  
    function OPS() 
        dxDrawImage(309.0,231.0,134.0,121.0,"black ops.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
        dxDrawText("Black OPS",327.0,175.0,427.0,231.0,tocolor(255,255,255,255),3.0,"default","center","center",false,false,false) 
    end 
  
addEvent("BOPS",true) 
addEventHandler("BOPS", getRootElement(), 
function() 
addEventHandler("onClientRender",root, OPS) 
setTimer (OPS ,13000, 1, removeEventHandler("onClientRender",root, OPS)) 
end) 
  
  
    function nva() 
        dxDrawText("NVA",327.0,175.0,427.0,231.0,tocolor(255,255,255,255),4.0,"default","center","center",false,false,false) 
        dxDrawImage(312.0,227.0,127.0,143.0,"nva.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
    end 
  
addEvent("NVA",true) 
addEventHandler("NVA", getRootElement(), 
function() 
addEventHandler("onClientRender",root, nva) 
setTimer (nva ,13000, 1, removeEventHandler("onClientRender",root, nva)) 
end) 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

Try with this:

-- Teams 
  
  
function Tro() 
    dxDrawImage(316.0,241.0,129.0,114.0,"tropas.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
    dxDrawText("Tropas",327.0,175.0,427.0,231.0,tocolor(255,255,255,255),2.0,"default","center","center",false,false,false) 
end 
  
addEvent("Tpas",true) 
addEventHandler("Tpas", getRootElement(), 
function() 
addEventHandler("onClientRender",root, Tro) 
setTimer (function () removeEventHandler("onClientRender",root, Tro) end ,13000, 1 ) 
end) 
  
    function Snaz() 
        dxDrawImage(325.0,231.0,103.0,99.0,"spetsnaz.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
        dxDrawText("Spetsnaz",327.0,175.0,427.0,231.0,tocolor(255,255,255,255),2.0,"default","center","center",false,false,false) 
    end 
  
addEvent("Spets",true) 
addEventHandler("Spets", getRootElement(), 
function() 
addEventHandler("onClientRender",root, Snaz) 
setTimer (function () removeEventHandler("onClientRender",root, Snaz) end ,13000, 1 ) 
end) 
  
  
    function P40() 
        dxDrawImage(318.0,231.0,134.0,122.0,"op40.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
        dxDrawText("OP40",327.0,175.0,427.0,231.0,tocolor(255,255,255,255),3.0,"default","center","center",false,false,false) 
    end 
  
addEvent("O40",true) 
addEventHandler("O40", getRootElement(), 
 function() 
 addEventHandler("onClientRender",root, P40) 
setTimer (function () removeEventHandler("onClientRender",root, P40) end ,13000, 1 ) 
 end) 
  
  
    function OPS() 
        dxDrawImage(309.0,231.0,134.0,121.0,"black ops.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
        dxDrawText("Black OPS",327.0,175.0,427.0,231.0,tocolor(255,255,255,255),3.0,"default","center","center",false,false,false) 
    end 
  
addEvent("BOPS",true) 
addEventHandler("BOPS", getRootElement(), 
function() 
addEventHandler("onClientRender",root, OPS) 
setTimer (function () removeEventHandler("onClientRender",root, OPS) end ,13000, 1 ) 
end) 
  
  
function nva() 
        dxDrawText("NVA",327.0,175.0,427.0,231.0,tocolor(255,255,255,255),4.0,"default","center","center",false,false,false) 
        dxDrawImage(312.0,227.0,127.0,143.0,"nva.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
end 
  
addEvent("NVA",true) 
addEventHandler("NVA", getRootElement(), 
function() 
addEventHandler("onClientRender",root, nva) 
setTimer (function () removeEventHandler("onClientRender",root, nva) end ,13000, 1 ) 
end) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
is it possible that to make a replay camera....?

Im just wondering, Do you intend to squize the whole of your server out of this topic??

If you are (Which you are), Technicly you wont have made the server, It would be a server made by many people of the comuinity...

Founder of SAUR - Founder/Owner of ARC RPG

Posted

i'm having a problem with this script, can someone please help me...

it's suppose to save the player or vehicle position...

Server-Side only:

  
 addCommandHandler ( "save", 
function() 
--    if hasObjectPermissionTo ( source, "resource.save", false ) then 
        if isPedInVehicle(source) then 
            local vehicle = getPedOccupiedVehicle(source) 
            local x, y, z = getElementPosition(vehicle) 
            local model = getElementModel(vehicle) 
            local rx, ry, rz = getElementRotation(source) 
            local vehcode = model, x, y, z, rx, ry, rz 
            outputChatBox ("Saved ",source) 
            triggerEvent("vehicleSave",getRootElement(), vehcode) 
        elseif (player) then 
            local x, y, z = getElementPosition(source) 
            local r = getPedRotation(source) 
            local skin = getPedSkin(source) 
            local int = getElementInerior(source) 
            local dim = getElementDimension(source) 
            local ped = x, y, z, r, skin, int, dim 
            triggerEvent("savePlayer",getRootElement(), ped) 
        end 
--[[    else 
        outputChatBox("you aren'pt allowed to use this",source, 
    end]] 
end) 
  
addCommandHandler("saveAV", -- save All Vehicles 
function() 
--    if hasObjectPermissionTo ( source, "resource.save", false ) then 
        local vehicles = getElementsByType("vehicle") 
        triggerEvent("AV",getRootElement(), vehicles) 
--  end 
end) 
  
addEvent("savePlayer",true) 
addEventHandler("savePlayer",getRootElement(), 
function(ped) 
    local file = fileOpen("positions.txt")  
     
    if not file then 
        file = fileCreate("positions.txt") 
        outputDebugString("Creating positions.txt") 
    end 
     
    if file then     
        local time = getRealTime() 
     
        fileSetPos(file,fileGetSize(file)) 
        local written = fileWrite(file,ped) 
        fileFlush(file) 
        fileClose(file) 
        if written then 
            outputChatBox("Succesfully saved to positions.txt",source) 
        end 
    else 
        outputDebugString("Save: Cannot find or create positions.txt") 
    end 
end) 
  
addEvent("vehicleSave",true) 
addEventHandler("vehicleSave",getRootElement(), 
function(vehcode) 
    local file = fileOpen("positions.txt")  
     
    if not file then 
        file = fileCreate("positions.txt") 
        outputDebugString("Creating positions.txt") 
    end 
     
    if file then     
        local time = getRealTime() 
     
        fileSetPos(file,fileGetSize(file)) 
        local written = fileWrite(file,vehcode) 
        fileFlush(file) 
        fileClose(file) 
        if written then 
            outputChatBox("Succesfully saved to positions.txt",source) 
        end 
    else 
        outputDebugString("Save: Cannot find or create positions.txt") 
    end 
end) 
  
addEvent("AV",true) 
addEventHandler("AV",getRootElement(), 
function(vehicles) 
    local file = fileOpen("positions.txt")  
     
    if not file then 
        file = fileCreate("positions.txt") 
        outputDebugString("Creating positions.txt") 
    end 
     
    if file then     
        local time = getRealTime() 
     
        fileSetPos(file,fileGetSize(file)) 
        local written = fileWrite(file,vehicles) 
        fileFlush(file) 
        fileClose(file) 
        if written then 
            outputChatBox("Succesfully saved to positions.txt",source) 
        end 
    else 
        outputDebugString("Save: Cannot find or create positions.txt") 
    end 
end) 
  

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted
addCommandHandler ( "save", 
function(player) 
--    if hasObjectPermissionTo ( player, "resource.save", false ) then 
        if isPedInVehicle(player) then 
            local vehicle = getPedOccupiedVehicle(player) 
            local x, y, z = getElementPosition(vehicle) 
            local model = getElementModel(vehicle) 
            local rx, ry, rz = getElementRotation(player) 
            local vehcode = {model, x, y, z, rx, ry, rz} 
            outputChatBox ("Saved ",source) 
            triggerEvent("vehicleSave",getRootElement(), vehcode) 
        elseif (player) then 
            local x, y, z = getElementPosition(player) 
            local r = getPedRotation(player) 
            local skin = getPedSkin(player) 
            local int = getElementInerior(player) 
            local dim = getElementDimension(player) 
            local ped = {x, y, z, r, skin, int, dim} 
            triggerEvent("savePlayer",getRootElement(), ped) 
        end 
--[[    else 
        outputChatBox("you aren'pt allowed to use this",source, 
    end]] 
end) 
  
addCommandHandler("saveAV", -- save All Vehicles 
function(player) 
--    if hasObjectPermissionTo ( player, "resource.save", false ) then 
        local vehicles = getElementsByType("vehicle") 
        triggerEvent("AV",getRootElement(), vehicles) 
--  end 
end) 
  
addEvent("savePlayer",true) 
addEventHandler("savePlayer",getRootElement(), 
function(ped) 
    local file = fileOpen("positions.txt") 
    
    if not file then 
        file = fileCreate("positions.txt") 
        outputDebugString("Creating positions.txt") 
    end 
    
    if file then     
        local time = getRealTime() 
        ped = table.concat(ped, ",") 
        fileSetPos(file,fileGetSize(file)) 
        local written = fileWrite(file,ped) 
        fileFlush(file) 
        fileClose(file) 
        if written then 
            outputChatBox("Succesfully saved to positions.txt",source) 
        end 
    else 
        outputDebugString("Save: Cannot find or create positions.txt") 
    end 
end) 
  
addEvent("vehicleSave",true) 
addEventHandler("vehicleSave",getRootElement(), 
function(vehcode) 
    local file = fileOpen("positions.txt") 
    
    if not file then 
        file = fileCreate("positions.txt") 
        outputDebugString("Creating positions.txt") 
    end 
    
    if file then     
        vehcode = table.concat(vehcode, ",") 
        local time = getRealTime() 
    
        fileSetPos(file,fileGetSize(file)) 
        local written = fileWrite(file,vehcode) 
        fileFlush(file) 
        fileClose(file) 
        if written then 
            outputChatBox("Succesfully saved to positions.txt",source) 
        end 
    else 
        outputDebugString("Save: Cannot find or create positions.txt") 
    end 
end) 
  
addEvent("AV",true) 
addEventHandler("AV",getRootElement(), 
function(vehicles) 
    local file = fileOpen("positions.txt") 
    
    if not file then 
        file = fileCreate("positions.txt") 
        outputDebugString("Creating positions.txt") 
    end 
    
    if file then     
         
        local time = getRealTime() 
        fileSetPos(file,fileGetSize(file)) 
        local written = fileWrite(file,vehicles) 
        fileFlush(file) 
        fileClose(file) 
        if written then 
            outputChatBox("Succesfully saved to positions.txt",source) 
        end 
    else 
        outputDebugString("Save: Cannot find or create positions.txt") 
    end 
end) 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted

Thanks, It works now...

How do I put a space/break after each line?

This is how it turned out to be:

1197.73046875,-1305.9462890625,13.39058971405,229.07669067383,0,0,0429,1176.455078125,-1308.744140625,13.559021949768,0,0,271.54498291016

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted
addCommandHandler ( "save", 
function(player) 
--    if hasObjectPermissionTo ( player, "resource.save", false ) then 
        if isPedInVehicle(player) then 
            local vehicle = getPedOccupiedVehicle(player) 
            local x, y, z = getElementPosition(vehicle) 
            local model = getElementModel(vehicle) 
            local rx, ry, rz = getElementRotation(player) 
            local vehcode = {model, x, y, z, rx, ry, rz} 
            outputChatBox ("Saved ",source) 
            triggerEvent("vehicleSave",getRootElement(), vehcode) 
        elseif (player) then 
            local x, y, z = getElementPosition(player) 
            local r = getPedRotation(player) 
            local skin = getPedSkin(player) 
            local int = getElementInerior(player) 
            local dim = getElementDimension(player) 
            local ped = {x, y, z, r, skin, int, dim} 
            triggerEvent("savePlayer",getRootElement(), ped) 
        end 
--[[    else 
        outputChatBox("you aren'pt allowed to use this",source, 
    end]] 
end) 
  
addCommandHandler("saveAV", -- save All Vehicles 
function(player) 
--    if hasObjectPermissionTo ( player, "resource.save", false ) then 
        local vehicles = getElementsByType("vehicle") 
        triggerEvent("AV",getRootElement(), vehicles) 
--  end 
end) 
  
addEvent("savePlayer",true) 
addEventHandler("savePlayer",getRootElement(), 
function(ped) 
    local file = fileOpen("positions.txt") 
    
    if not file then 
        file = fileCreate("positions.txt") 
        outputDebugString("Creating positions.txt") 
    end 
    
    if file then     
        local time = getRealTime() 
        ped = table.concat(ped, " ") 
        fileSetPos(file,fileGetSize(file)) 
        local written = fileWrite(file,ped) 
        fileFlush(file) 
        fileClose(file) 
        if written then 
            outputChatBox("Succesfully saved to positions.txt",source) 
        end 
    else 
        outputDebugString("Save: Cannot find or create positions.txt") 
    end 
end) 
  
addEvent("vehicleSave",true) 
addEventHandler("vehicleSave",getRootElement(), 
function(vehcode) 
    local file = fileOpen("positions.txt") 
    
    if not file then 
        file = fileCreate("positions.txt") 
        outputDebugString("Creating positions.txt") 
    end 
    
    if file then     
        vehcode = table.concat(vehcode, " ") 
        local time = getRealTime() 
    
        fileSetPos(file,fileGetSize(file)) 
        local written = fileWrite(file,vehcode) 
        fileFlush(file) 
        fileClose(file) 
        if written then 
            outputChatBox("Succesfully saved to positions.txt",source) 
        end 
    else 
        outputDebugString("Save: Cannot find or create positions.txt") 
    end 
end) 
  
addEvent("AV",true) 
addEventHandler("AV",getRootElement(), 
function(vehicles) 
    local file = fileOpen("positions.txt") 
    
    if not file then 
        file = fileCreate("positions.txt") 
        outputDebugString("Creating positions.txt") 
    end 
    
    if file then     
        
        local time = getRealTime() 
        fileSetPos(file,fileGetSize(file)) 
        local written = fileWrite(file,vehicles) 
        fileFlush(file) 
        fileClose(file) 
        if written then 
            outputChatBox("Succesfully saved to positions.txt",source) 
        end 
    else 
        outputDebugString("Save: Cannot find or create positions.txt") 
    end 
end) 

With a space.

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted

Can some1 help me this script,

I get an error saying there's a bad argument @ 'addEventHandler'.

Server-side only:

addEventHandler("onColShapeHit", warningsphere, 
function(player) 
    if (getElementType(player)) then 
        local account = getPlayerAccount(player) 
        local accountname = getAccountName(account) 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*:Authorized to land at Area 69",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*:YOU ARE FLYING IN A NO FLY ZONE! TURN BACK!",255,0,0) 
        end 
    end 
end) 
  
addEventHandler("onColShapeHit", samsphere, 
function(player) 
    if (getElementType(player)) then 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*: Third Check, Welcome Back. ",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*:YOU ARE STILL FLYING IN A NO FLY ZONE! YOU WILL BE SHOT DOWN!",255,0,0) 
            addEventHandler("onClientRender",getRootElement(),fireMissiles) 
            outputChatBox("WARNING: SAMS HAVE BEEN FIRED NOW!",player,255,0,0) 
        end 
    end 
end) 
addEventHandler("onColShapeLeave", warningsphere, 
function(player) 
    if (getElementType(player)) then 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*: BYE! ",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*:GOOD CHOICE!",255,0,0) 
        end 
    end 
end) 
  
addEventHandler("onColShapeLeave", samsphere1, 
function(player) 
    if (getElementType(player)) then 
        if (missiles == true) then 
            removeEventHandler("onClientRender",getRootElement(),fireMissiles) 
            missiles = false 
        end 
    end 
end) 
  
addEventHandler("onColShapeLeave", samsphere, 
function(player) 
    if (getElementType(player)) then 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*: GET THEM! ",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*: SOOOOOOOOOOOOOOO LUCKY!",255,0,0) 
        end 
    end 
end) 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

Do you have these colshapes? because it seems like that's the problem.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

ooh, ya

here:

  
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), 
function() 
    samsphere = createColSphere(208.21,1980.58,28.89,300) 
    samsphere1 = createColSphere(208.21,1980.58,28.89,1500) 
    warningsphere = createColSphere(208.21,1980.58,28.89,500) 
    samsite1 = createObject(3884,113.28,1814.28,32.45,0,0,309) 
    samsite2 = createObject(3884,103.83,1901.12,32.45,0,0,309) 
    samsite3 = createObject(3884,161.99,1933.18,32.45,0,0,145) 
    samsite4 = createObject(3884,233.4,1934.85,32.45,0,0,145) 
    samsite5 = createObject(3884,267.36,1895.48,32.45,0,0,145) 
    samsite6 = createObject(3884,166.03,1850.09,32.45,0,0,350) 
    samsite7 = createObject(3884,262.04,1807.5,32.45,0,0,37) 
end) 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

WRONG, you are using onClientResourceStart on a server side script, do you think that would ever work?

addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function() 
    samsphere = createColSphere(208.21,1980.58,28.89,300) 
    samsphere1 = createColSphere(208.21,1980.58,28.89,1500) 
    warningsphere = createColSphere(208.21,1980.58,28.89,500) 
    samsite1 = createObject(3884,113.28,1814.28,32.45,0,0,309) 
    samsite2 = createObject(3884,103.83,1901.12,32.45,0,0,309) 
    samsite3 = createObject(3884,161.99,1933.18,32.45,0,0,145) 
    samsite4 = createObject(3884,233.4,1934.85,32.45,0,0,145) 
    samsite5 = createObject(3884,267.36,1895.48,32.45,0,0,145) 
    samsite6 = createObject(3884,166.03,1850.09,32.45,0,0,350) 
    samsite7 = createObject(3884,262.04,1807.5,32.45,0,0,37) 
end) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function() 
    samsphere = createColSphere(208.21,1980.58,28.89,300) 
    addEventHandler("onColShapeHit", samsphere, samFunction) 
    addEventHandler("onColShapeLeave", samsphere, samLeaveFunction) 
    samsphere1 = createColSphere(208.21,1980.58,28.89,1500) 
    addEventHandler("onColShapeLeave", samsphere1, sam1LeaveFunction) 
    warningsphere = createColSphere(208.21,1980.58,28.89,500) 
    addEventHandler("onColShapeHit", warningsphere, warningFunction) 
    addEventHandler("onColShapeLeave", warningsphere, warningLeaveFunction) 
    samsite1 = createObject(3884,113.28,1814.28,32.45,0,0,309) 
    samsite2 = createObject(3884,103.83,1901.12,32.45,0,0,309) 
    samsite3 = createObject(3884,161.99,1933.18,32.45,0,0,145) 
    samsite4 = createObject(3884,233.4,1934.85,32.45,0,0,145) 
    samsite5 = createObject(3884,267.36,1895.48,32.45,0,0,145) 
    samsite6 = createObject(3884,166.03,1850.09,32.45,0,0,350) 
    samsite7 = createObject(3884,262.04,1807.5,32.45,0,0,37) 
end) 
  
function warningFunction(player) 
    if (getElementType(player)) then 
        local account = getPlayerAccount(player) 
        local accountname = getAccountName(account) 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*:Authorized to land at Area 69",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*:YOU ARE FLYING IN A NO FLY ZONE! TURN BACK!",255,0,0) 
        end 
    end 
end 
  
function samFunction(player) 
    if (getElementType(player)) then 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*: Third Check, Welcome Back. ",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*:YOU ARE STILL FLYING IN A NO FLY ZONE! YOU WILL BE SHOT DOWN!",255,0,0) 
            addEventHandler("onClientRender",getRootElement(),fireMissiles) 
            outputChatBox("WARNING: SAMS HAVE BEEN FIRED NOW!",player,255,0,0) 
        end 
    end 
end 
  
function warningLeaveFunction(player) 
    if (getElementType(player)) then 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*: BYE! ",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*:GOOD CHOICE!",255,0,0) 
        end 
    end 
end) 
  
function sam1LeaveFunction(player) 
    if (getElementType(player)) then 
        if (missiles == true) then 
            removeEventHandler("onClientRender",getRootElement(),fireMissiles) 
            missiles = false 
        end 
    end 
end 
  
function samLeaveFunction(player) 
    if (getElementType(player)) then 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*: GET THEM! ",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*: SOOOOOOOOOOOOOOO LUCKY!",255,0,0) 
        end 
    end 
end 

Try with that.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Error:

[2011-07-26 07:47:44] WARNING: \server.lua:20: Bad argument @ 'addEventHandler'

[2011-07-26 07:47:44] WARNING: \server.lua:33: Bad argument @ 'addEventHandler'

[2011-07-26 07:47:44] WARNING: \server.lua:98: Bad argument @ 'addEventHandler'

[2011-07-26 07:47:44] WARNING: \server.lua:111: Bad argument @ 'addEventHandler'

[2011-07-26 07:47:44] WARNING: \server.lua:121: Bad argument @ 'addEventHandler'

addEventHandler("onResourceStart",resourceroot, 
function() 
    samsphere = createColSphere(208.21,1980.58,28.89,300) 
    samsphere1 = createColSphere(208.21,1980.58,28.89,1500) 
    warningsphere = createColSphere(208.21,1980.58,28.89,500) 
    samsite1 = createObject(3884,113.28,1814.28,32.45,0,0,309) 
    samsite2 = createObject(3884,103.83,1901.12,32.45,0,0,309) 
    samsite3 = createObject(3884,161.99,1933.18,32.45,0,0,145) 
    samsite4 = createObject(3884,233.4,1934.85,32.45,0,0,145) 
    samsite5 = createObject(3884,267.36,1895.48,32.45,0,0,145) 
    samsite6 = createObject(3884,166.03,1850.09,32.45,0,0,350) 
    samsite7 = createObject(3884,262.04,1807.5,32.45,0,0,37) 
end) 
  
addEventHandler("onColShapeHit", warningsphere, 
function(player) 
    if (getElementType(player)) then 
        local account = getPlayerAccount(player) 
        local accountname = getAccountName(account) 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*:Authorized to land at Area 69",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*:YOU ARE FLYING IN A NO FLY ZONE! TURN BACK!",player,255,0,0) 
        end 
    end 
end) 
  
addEventHandler("onColShapeHit", samsphere, 
function(player) 
    if (getElementType(player)) then 
        local account = getPlayerAccount(player) 
        local accountname = getAccountName(account) 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*: Third Check, Welcome Back. ",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*:YOU ARE STILL FLYING IN A NO FLY ZONE! YOU WILL BE SHOT DOWN!",player,255,0,0) 
            addEventHandler("onClientRender",getRootElement(),fireMissiles) 
            outputChatBox("WARNING: SAMS HAVE BEEN FIRED NOW!",player,255,0,0) 
        end 
    end 
end) 
addEventHandler("onColShapeLeave", warningsphere, 
function(player) 
        local account = getPlayerAccount(player) 
        local accountname = getAccountName(account) 
    if (getElementType(player)) then 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*: BYE! ",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*:GOOD CHOICE!",player,255,0,0) 
        end 
    end 
end) 
  
addEventHandler("onColShapeLeave", samsphere1, 
function(player) 
    if (getElementType(player)) then 
        if (missiles == true) then 
            removeEventHandler("onClientRender",getRootElement(),fireMissiles) 
            missiles = false 
        end 
    end 
end) 
  
addEventHandler("onColShapeLeave", samsphere, 
function(player) 
    if (getElementType(player)) then 
        local account = getPlayerAccount(player) 
        local accountname = getAccountName(account) 
        if getPlayerTeam(getTeamFromName("Military")) and isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Army" ) ) then 
            outputChatBox("*RESTRICTED AREA*: GET THEM! ",player,0,0,255) 
        else 
            outputChatBox("*RESTRICTED AREA*: SOOOOOOOOOOOOOOO LUCKY!",player,255,0,0) 
        end 
    end 
end) 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

It's: 'resourceRoot' not 'resourceroot'.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...