Tomek123 Posted January 27, 2011 Share Posted January 27, 2011 Hi all This script no work i die all time safecol = createColCuboid ( 100.16635131836, 1820.5823974609, 17.289850234985, 200, 150, 100 ) safeZoneRadar = createRadarArea ( 100.16635131836,1820.5823974609, 200, 150, 0, 255, 0, 120 ) function enterZone(hitPlayer,thePlayer) local acl = getElementModel (hitPlayer) if ( acl == GANG ) then toggleControl (hitPlayer, "fire", false ) toggleControl (hitPlayer, "aim_weapon", false) toggleControl (hitPlayer, "vehicle_fire", false) outputChatBox("Welcome, in moderator zone!", hitPlayer, 0, 255, 0) else killPed (hitPlayer) end end addEventHandler( "onColShapeHit", safecol, enterZone ) function leaveZone(hitPlayer,thePlayer) local skin = getElementModel (hitPlayer) toggleControl (hitPlayer, "fire", true) toggleControl (hitPlayer, "aim_weapon", true) toggleControl (hitPlayer, "vehicle_fire", true) outputChatBox("* WARNING: You left moderator zone!", hitPlayer, 255, 0, 0) if not ( acl == GANG ) then killPed (hitPlayer) end end addEventHandler( "onColShapeLeave", safecol, leaveZone ) What is wrong i set my name in ACL on GANG and i die Link to comment
Castillo Posted January 27, 2011 Share Posted January 27, 2011 WTF?! acl = getElementModel() lol?, i don't know what are you trying to do but this really fails. If you want to check a acl then do this: safecol = createColCuboid ( 100.16635131836, 1820.5823974609, 17.289850234985, 200, 150, 100 ) safeZoneRadar = createRadarArea ( 100.16635131836,1820.5823974609, 200, 150, 0, 255, 0, 120 ) function enterZone(hitPlayer,machingDimension) local accountname = getAccountName(getPlayerAccount(hitPlayer)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" )) then toggleControl (hitPlayer, "fire", false ) toggleControl (hitPlayer, "aim_weapon", false) toggleControl (hitPlayer, "vehicle_fire", false) outputChatBox("Welcome, in moderator zone!", hitPlayer, 0, 255, 0) else killPed (hitPlayer) end end addEventHandler( "onColShapeHit", safecol, enterZone ) function leaveZone(hitPlayer,machingDimension) local accountname = getAccountName(getPlayerAccount(hitPlayer)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" )) then toggleControl (hitPlayer, "fire", true) toggleControl (hitPlayer, "aim_weapon", true) toggleControl (hitPlayer, "vehicle_fire", true) outputChatBox("* WARNING: You left moderator zone!", hitPlayer, 255, 0, 0) else killPed (hitPlayer) end end addEventHandler( "onColShapeLeave", safecol, leaveZone ) try it. P.S: wrong section. Link to comment
Tomek123 Posted January 27, 2011 Author Share Posted January 27, 2011 Thanks, now work Link to comment
Tomek123 Posted January 28, 2011 Author Share Posted January 28, 2011 Why this script not work? addEventHandler("onResourceStart", resourceRoot, function() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function spawn(player) if not isElement(player) then return end repeat until spawnPlayer ( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(0,0) ) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerJoin", root, function() spawn(source) end ) addEventHandler("onPlayerWasted", root, function() setTimer(spawn, 1800, 1, source) repeat until spawnPlayer ( player, 1611+math.random(0,1),1822+math.random(0,1), 10.6, 90, math.random(0,0) ) end ) Link to comment
proracer Posted January 28, 2011 Share Posted January 28, 2011 What are you trying to do? I have tested in my local server and no errors. Link to comment
Tomek123 Posted January 28, 2011 Author Share Posted January 28, 2011 I wish that after the death of a man spawn close the hospital Link to comment
proracer Posted January 28, 2011 Share Posted January 28, 2011 addEventHandler("onPlayerWasted", getRootElement(), spawnToHospital) function spawnToHospital() local x,y,z = 1000, 1000, 0 -- enter hospital co-ordinates here spawnPlayer(source, x, y, z) end Try this. Link to comment
Aibo Posted January 28, 2011 Share Posted January 28, 2011 Try this. again, spawnToHospital is nil when you're calling event handler. it's the same as defining x,y,z AFTER spawnPlayer(source, x, y, z). function spawnToHospital() local x,y,z = 1000, 1000, 0 -- enter hospital co-ordinates here spawnPlayer(source, x, y, z) end addEventHandler("onPlayerWasted", getRootElement(), spawnToHospital) -- or addEventHandler("onPlayerWasted", getRootElement(), function() local x,y,z = 1000, 1000, 0 -- enter hospital co-ordinates here spawnPlayer(source, x, y, z) end) Link to comment
proracer Posted January 28, 2011 Share Posted January 28, 2011 It should work, any errors? ( Use '/debugscript 3' ) Link to comment
Tomek123 Posted January 30, 2011 Author Share Posted January 30, 2011 Is there a script that people stick to the car? Link to comment
proracer Posted January 30, 2011 Share Posted January 30, 2011 Yes take a look. https://community.multitheftauto.com/index.php?p=resources&s=details&id=51 Link to comment
Tomek123 Posted January 31, 2011 Author Share Posted January 31, 2011 (edited) OMG i try make skin saver and don't work again ! What is wrong function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then clothes = getPedClothes(source,"PlayerClothes") setAccountData ( playeraccount, "play.clothes", playerclothes ) end end function onPlayerJoin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerclothes = getAccountData ( playeraccount, "play.clothes" ) if ( playerclothes ) then setPedClothes ( source, "PlayerClothes", clothes ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerJoin", getRootElement ( ), onPlayerJoin ) Edited February 11, 2011 by Guest Link to comment
Castillo Posted January 31, 2011 Share Posted January 31, 2011 That is not a "Scripting" question, but if i'm right, you need a better Internet connection to make it faster. Link to comment
Tomek123 Posted February 1, 2011 Author Share Posted February 1, 2011 Server all time use only 5 kb/s for upload but i have 50 kb/s upload speed where is problem? Link to comment
Tomek123 Posted February 3, 2011 Author Share Posted February 3, 2011 This is for client.this script must show on scoreboard money stats. Somthing is wrong but i don' know what :\ local root = getRootElement() local player = getLocalPlayer() local counter = 0 local starttick local currenttick addEventHandler("onClientRender",root, function() if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"money",counter) counter = 0 starttick = false end end ) Link to comment
SDK Posted February 3, 2011 Share Posted February 3, 2011 Why do you have the variable counter in there? And why are you using it as your money local starttick, currenttick local player = getLocalPlayer() addEventHandler("onClientRender",getRootElement(), function() if not starttick then starttick = getTickCount() end currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"money",getPlayerMoney( player ) ) starttick = getTickCount() end end ) Btw, it would be easier to use a serverside timer for this, there's no need to do it clientside in onClientRender function updateMoney() for k, v in ipairs(getElementsByType('player')) do local money = getPlayerMoney(v) setElementData(v,"money",money ) end end setTimer(updateMoney, 1000, 0) Link to comment
Tomek123 Posted February 3, 2011 Author Share Posted February 3, 2011 again not work :\ Link to comment
Tomek123 Posted February 5, 2011 Author Share Posted February 5, 2011 What i must add in LUA file if i want when player go in marker then he will be teleport somewhere? Link to comment
Castillo Posted February 5, 2011 Share Posted February 5, 2011 myMarker = createMarker() function onHit(hitPlayer, matchingDimension) setElementPosition(hitPlayer,0,0,1000) end addEventHandler("onMarkerHit",myMarker,onHit) Link to comment
Tomek123 Posted February 5, 2011 Author Share Posted February 5, 2011 Where should I put the coordinates? Link to comment
Castillo Posted February 5, 2011 Share Posted February 5, 2011 https://wiki.multitheftauto.com/wiki/CreateMarker 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