Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. remplace your "bank.xml.server.lua" with: --[[ Resource: bank (written by 50p) Version: 2.2 Filename: bank.xml.server.lua Mod: Dzek ]] visibleRadius= 100000000 bankSQLInfo = { } banksInfo = { } function bankInit( ) local useATMs = get( "bank.useATMs" ) local xml_root = xmlLoadFile( "bank.locations.xml" ) local banks = 0 while( xmlFindChild( xml_root, "bank", banks ) ) do local markerSize local tempID = banks+1 banksInfo[ tempID ] = { } local bank_node = xmlFindChild( xml_root, "bank", banks ) banksInfo[ tempID ].name = xmlNodeGetAttribute( bank_node, "name" ) banksInfo[ tempID ].useBlip = xmlNodeGetAttribute( bank_node, "blip" ) or true banksInfo[ tempID ].depositAllowed = xmlNodeGetAttribute( bank_node, "depositAllowed" ) or true local bank_loc = xmlFindChild( bank_node, "location", 0 ) banksInfo[ tempID ].posX = tonumber( xmlNodeGetAttribute( bank_loc, "posX" ) ) banksInfo[ tempID ].posY = tonumber( xmlNodeGetAttribute( bank_loc, "posY" ) ) banksInfo[ tempID ].posZ = tonumber( xmlNodeGetAttribute( bank_loc, "posZ" ) ) banksInfo[ tempID ].interior = tonumber( xmlNodeGetAttribute( bank_loc, "ATMInterior" ) ) or 0; markerSize = tonumber( xmlNodeGetAttribute( bank_loc, "markerSize" ) ) or 2 banksInfo[ tempID ].marker = createMarker( banksInfo[ tempID ].posX, banksInfo[ tempID ].posY, banksInfo[ tempID ].posZ-.9, "cylinder", markerSize, 250, 0, 0, 100 ) setElementInterior( banksInfo[ tempID ].marker, banksInfo[ tempID ].interior ); if useATMs and xmlNodeGetAttribute( bank_loc, "ATM" ) == "true" then local rot = tonumber( xmlNodeGetAttribute( bank_loc, "ATMRot" ) ) or 0.0 local x, y, z = banksInfo[ tempID ].posX, banksInfo[ tempID ].posY, banksInfo[ tempID ].posZ x = x + math.sin( math.rad( rot ) ) * .6 y = y + math.cos( math.rad( rot ) ) * .6 banksInfo[ tempID ].ATM = createObject( 2942, x, y, z-.35, 0, 0, (360-rot) ) setElementInterior( banksInfo[ tempID ].ATM, tonumber( xmlNodeGetAttribute( bank_loc, "ATMInterior" ) ) or 0 ) setElementParent( banksInfo[ tempID ].ATM, banksInfo[ tempID ].marker ) end if xmlFindChild( bank_node, "entrance", 0 ) then banksInfo[ tempID ].entrance = { } local entrance_node = xmlFindChild( bank_node, "entrance", 0 ) banksInfo[ tempID ].entrance.posX = xmlNodeGetAttribute( entrance_node, "posX" ) banksInfo[ tempID ].entrance.posY = xmlNodeGetAttribute( entrance_node, "posY" ) banksInfo[ tempID ].entrance.posZ = xmlNodeGetAttribute( entrance_node, "posZ" ) banksInfo[ tempID ].entrance.interior = tonumber( xmlNodeGetAttribute( entrance_node, "ATMInterior" ) ) or 0; banksInfo[ tempID ].entrance.teleX = xmlNodeGetAttribute( entrance_node, "teleX" ) banksInfo[ tempID ].entrance.teleY = xmlNodeGetAttribute( entrance_node, "teleY" ) banksInfo[ tempID ].entrance.teleZ = xmlNodeGetAttribute( entrance_node, "teleZ" ) banksInfo[ tempID ].entrance.teleRot = xmlNodeGetAttribute( entrance_node, "teleRot" ) banksInfo[ tempID ].entrance.teleInterior = xmlNodeGetAttribute( entrance_node, "teleInterior" ) banksInfo[ tempID ].entrance.marker = createMarker( banksInfo[ tempID ].entrance.posX, banksInfo[ tempID ].entrance.posY, banksInfo[ tempID ].entrance.posZ-1, "cylinder", 1.5, 250, 250, 0, 100 ) if (banksInfo[ tempID ].useBlip=="true") then local blip = createBlipAttachedTo( banksInfo[ tempID ].entrance.marker, 52, 2, 255,255,255,255,1, visibleRadius ) end local col = createColTube( banksInfo[ tempID ].entrance.posX, banksInfo[ tempID ].entrance.posY, banksInfo[ tempID ].entrance.posZ-180, 150, 360 ) setElementParent( banksInfo[ tempID ].entrance.marker, col ) setElementInterior( banksInfo[ tempID ].entrance.marker, banksInfo[ tempID ].entrance.interior ); elseif ( type( banksInfo[ tempID ].useBlip ) == "boolean" and banksInfo[ tempID ].useBlip == true ) or ( type( banksInfo[ tempID ].useBlip ) == "string" and banksInfo[ tempID ].useBlip == "true" ) then local col = createColTube( banksInfo[ tempID ].posX, banksInfo[ tempID ].posY, banksInfo[ tempID ].posZ-180, 150, 360 ) setElementParent( banksInfo[ tempID ].marker, col ) local blip = createBlip( banksInfo[ tempID ].posX, banksInfo[ tempID ].posY, banksInfo[ tempID ].posZ, 52, 2, 255,255,255,255,1, visibleRadius ) end if xmlFindChild( bank_node, "exit", 0 ) and banksInfo[ tempID ].entrance then banksInfo[ tempID ]._exit = { } local exit_node = xmlFindChild( bank_node, "exit", 0 ) banksInfo[ tempID ]._exit.posX = xmlNodeGetAttribute( exit_node, "posX" ) banksInfo[ tempID ]._exit.posY = xmlNodeGetAttribute( exit_node, "posY" ) banksInfo[ tempID ]._exit.posZ = xmlNodeGetAttribute( exit_node, "posZ" ) banksInfo[ tempID ]._exit.interior = tonumber( xmlNodeGetAttribute( exit_node, "interior" ) ) or 0; banksInfo[ tempID ]._exit.teleX = xmlNodeGetAttribute( exit_node, "teleX" ) banksInfo[ tempID ]._exit.teleY = xmlNodeGetAttribute( exit_node, "teleY" ) banksInfo[ tempID ]._exit.teleZ = xmlNodeGetAttribute( exit_node, "teleZ" ) banksInfo[ tempID ]._exit.teleRot = xmlNodeGetAttribute( exit_node, "teleRot" ) banksInfo[ tempID ]._exit.teleInterior = xmlNodeGetAttribute( exit_node, "teleInterior" ) banksInfo[ tempID ]._exit.marker = createMarker( banksInfo[ tempID ]._exit.posX, banksInfo[ tempID ]._exit.posY, banksInfo[ tempID ]._exit.posZ-1, "cylinder", 1.5, 250, 250, 0, 100 ) setElementInterior( banksInfo[ tempID ]._exit.marker, banksInfo[ tempID ]._exit.interior ); end banks = banks + 1 end bankSQLInfo.tab = get( "bank.SQLTable" ) bankSQLInfo.username = get( "bank.SQLUserNameField" ) bankSQLInfo.balance = get( "bank.SQLMoneyField" ) if not bankSQLInfo.tab then bankSQLInfo.tab = "bank_accounts" end if not bankSQLInfo.username then bankSQLInfo.username = "username" end if not bankSQLInfo.balance then bankSQLInfo.balance = "balance" end end
  2. it was returning nil for me, seems that i fixed it addEvent("onClientHighScoresUpdate",true) addEventHandler ("onClientHighScoresUpdate",getRootElement(), function (scores) if type(scores) == "table" then for i,s in ipairs (scores) do outputDebugString ("+1 Row!") local row = guiGridListAddRow (scoresGrid) guiGridListSetItemText (scoresGrid,row,1,tostring(s["player_name"]),false,false) guiGridListSetItemText (scoresGrid,row,2,tostring(s["kills"]),false,true) guiGridListSetItemText (scoresGrid,row,3,tostring(s["level"]),false,true) end else outputDebugString ("Problem with the high scores table, looks like isn't processed!") end end) now it adds a row with: [MM]Castillo 100 500
  3. what do you mean? if you want to get the code of your GUI elements then click "Output code" and a .TXT file will be created at guieditor's folder.
  4. if i'm right when you use triggerClientEvent it must use getRootElement not getLocalPlayer.
  5. hunter top times? https://community.multitheftauto.com/index.php?p=resources&s=details&id=1345
  6. <Zombie_spawn id="Zombie_spawn (1)" interior="0" posX="" posY="" posZ="" rotX="0" rotY="0" rotZ="0" />
  7. with this code it works: function GetPosition ( player ) local x, y, z = getElementPosition( player ) local rx, ry, rz = getElementRotation( player ) outputChatBox( "Your Position: "..x..", "..y..", "..z..", Rotation: "..rx..", "..ry..", "..rz,player) end addCommandHandler ( "pos", GetPosition ) i've tested it and has no problems.
  8. it works in server side, if you want it client side then do: function GetPosition () local x, y, z = getElementPosition( getLocalPlayer() ) local rx, ry, rz = getElementRotation( getLocalPlayer() ) outputChatBox( "Your Position: "..x..", "..y..", "..z..", Rotation: "..rx..", "..ry..", "..rz) end addCommandHandler ( "pos", GetPosition ) you can define what side will be in meta.xml.
  9. function createSlothTeam() createTeam("SlothBots") end function commandSpawn() call(getResourceFromName("slothbot"), "spawnBot", 2397, 1954, 6, 0, 183, 0, 0, "SlothBots", 30, "hunting") end addCommandHandler("spawnbot", commandSpawn) addEventHandler("onResourceStart", getRootElement(), createSlothTeam)
  10. you already triple posted.. use the "EDIT" button you can use triggerServerEvent
  11. try this, vehicle = { [596]=true, [599]=true } function bwarp ( thePlayer, command, who ) local veh = getPedOccupiedVehicle(thePlayer) if veh then model = getElementModel(veh) if vehicle[tonumber(model)] then local aeg = getPlayerFromName ( who ) isPedInVehicle ( thePlayer ) warpPedIntoVehicle ( aeg, veh ) outputChatBox(getPlayerName(aeg).." is now at your vehicle!",thePlayer,0,255,0) end end end addCommandHandler ( "warp", bwarp )
  12. Remplacing Models of Skins is not possible in mta for now.
  13. Castillo

    question

    I think he is asking how to check it scripting way?
  14. maybe this helps, i've tested it and sounds like in the center. https://forum.multitheftauto.com/viewtopic.php?f=91&t=25042&p=294320&hilit=center+a+window#p294320
  15. Castillo

    House_system

    there is at least 2 at community.multitheftauto.com here are the links to them: https://community.multitheftauto.com/index.php?p=resources&s=details&id=721 https://community.multitheftauto.com/index.php?p=resources&s=details&id=727
  16. here you can get the basemode: https://community.multitheftauto.com/index.php?p=resources&s=details&id=222
  17. server side: x, y, size = 1844.5594482422, 1375.3376464844, 120 local greenzone = createColRectangle ( 1844.5594482422, 1375.3376464844, 284, 312.22 ) local greenzonemaparea = createRadarArea (1844.5594482422, 1375.3376464844, 284, 312.22, 0, 255, 0, 120) function greenzoneEnter ( thePlayer, matchingDimension ) if getElementType( thePlayer ) ~= "player" then return end triggerClientEvent(thePlayer, "zoneEnter", thePlayer) toggleControl ( thePlayer, "fire", false ) toggleControl ( thePlayer, "next_weapon", false ) toggleControl ( thePlayer, "previous_weapon", false ) setPedWeaponSlot ( thePlayer, 0 ) toggleControl ( thePlayer, "aim_weapon", false ) toggleControl ( thePlayer, "vehicle_fire", false ) toggleControl ( thePlayer, "vehicle_secondary_fire", false ) end addEventHandler ( "onColShapeHit", greenzone, greenzoneEnter ) function greenzoneExit ( thePlayer, matchingDimension ) if getElementType( thePlayer ) ~= "player" then return end triggerClientEvent(thePlayer, "zoneExit", thePlayer) toggleControl ( thePlayer, "fire", true ) toggleControl ( thePlayer, "next_weapon", true ) toggleControl ( thePlayer, "previous_weapon", true ) toggleControl ( thePlayer, "aim_weapon", true ) toggleControl ( thePlayer, "vehicle_fire", true ) toggleControl ( thePlayer, "vehicle_secondary_fire", true ) end addEventHandler ( "onColShapeLeave", greenzone, greenzoneExit ) client side: function buildNotice() purpleLabel = guiCreateLabel(0.65, 0, 1, 1, "You are in a Safe Zone.", true) guiSetFont(purpleLabel, "sa-header") guiLabelSetColor(purpleLabel,0,255,0) guiSetVisible(purpleLabel,false) end addEventHandler("onClientResourceStart", getResourceRootElement( getThisResource() ), buildNotice) addEvent("zoneEnter", true) addEventHandler("zoneEnter", getRootElement(), function() guiSetVisible(purpleLabel, true) end ) addEvent("zoneExit", true) addEventHandler("zoneExit", getRootElement(), function() guiSetVisible(purpleLabel, false) end ) Your errors (i'm bad in explaining): You used getLocalPlayer() in the addEventHandler("zoneExit", getRootElement(), and that doesn't works you must use getRootElement() (if i'm right) also in onClientResourceStart you was doing same but if you use getRootElement() there when any resource is started it will execute that function so you have to do what i did to only execute when this resource is started, also in server side if i'm right your triggers where wrong if i'm right. i also added guiSetVisible onClientResourceStart because you was going to have the label even if you didn't entered in safe zone.
  18. Castillo

    Song in map

    local sound addEventHandler('onClientResourceStart', resourceRoot, function () outputChatBox("Press M to toggle between music / radio") sound = playSound("song.mp3",false) end ) local toggle = false bindKey("m","down", function() if toggle == false then setSoundVolume(sound,1) toggle = true elseif toggle == true then setSoundVolume(sound,0) toggle = false end end ) P.S: Use LUA tags next time.
  19. We don't accept request, you should at least try something first.
  20. I uploaded it to mediafire, if you want it get it from this link: http://www.mediafire.com/?o3ndd7jtf8gqf54
  21. there is no way to change GUI style for the whole server in the current MTA version, you can find CEGUI.png and edit it but only you will see it, you could create your own GUI by using DXdrawing functions also.
  22. Editor = {} Gate = {} Gate2 = {} Precision = {} status = {} coll = {} coll2 = {} coll3 = {} coll4 = {} -- this script mod is (no longer) PRIVATE -- - Deject3d function startBuilding(playerSource, commandName, objectid) if not objectid then outputChatBox("usage: /addgate objectid teamname", playerSource) return false end local team = getTeamName(getPlayerTeam" class="kw2">getPlayerTeam(playerSource)) if team then team = getTeamName(team) else team = "" end end for i = 1,20 do if Editor[i] == playerSource then destroyElement(Gate[i]) Gate[i] = null Editor[i] = null Precision[i] = null end if Editor[i] == null then Editor[i] = playerSource -- set Editor[i] to who made the object --creating object -v local x,y,z = getElementPosition(playerSource) object = createObject ( objectid, x + 3,y + 3,z) interior = getElementInterior ( playerSource ) setElementInterior(object,interior) --created object -^ Gate[i] = object -- added object identifier to the array, corresponds to who created it Precision[i] = .5 -- default precision bindKey(playerSource, "i", "down", moveIt) bindKey(playerSource, "j", "down", moveIt) bindKey(playerSource, "k", "down", moveIt) bindKey(playerSource, "l", "down", moveIt) bindKey(playerSource, "mouse_wheel_up", "down", moveIt) bindKey(playerSource, "mouse_wheel_down", "down", moveIt) bindKey(playerSource, "pgup", "down", moveIt) bindKey(playerSource, "pgdn", "down", moveIt) bindKey(playerSource, "u", "down", moveIt) bindKey(playerSource, "o", "down", moveIt) bindKey(playerSource, "[", "down", moveIt) bindKey(playerSource, "]", "down", moveIt) bindKey(playerSource, "enter", "down", nextPosition ,objectid, team) bindKey(playerSource, "delete", "down", removeIt, playerSource) break -- done adding our object and who created it to the arrays... stop the loop end end
  23. Castillo

    LUAC

    there are decompilers but they mess with the variables and function names, also i don't know how to get them.
  24. well, i just gave you how to change maker to pickup you must add something else to change the pickup type when buy the house, if you post the code when you buy and sell the house i do it.
×
×
  • Create New...