Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. Un colshape. createColTube isElementWithinColShape addCommandHandler
  2. onElementClicked getElementData giveWeapon
  3. Ah, es que habias definido 'id' igual que tu tabla, asi que se estaba haciendo un lio. Copia el codigo server side de nuevo.
  4. addEvent("domo", true) addEventHandler("domo", rootElement, function() if isPedInVehicle(source) then if ( getPlayerMoney (source) >= 7000 ) then takePlayerMoney(source, 7000) engineLoadTXD ( "infernus.txd", 411 ) engineImportTXD ( txd, 411 ) dff = engineLoadDFF ( "infernus.dff", 411 ) engineReplaceModel ( dff, 411 ) outputChatBox("Infernus Successfully changed", source, 255, 255, 0, true) else outputChatBox("Not enough money 7000.", source, 255, 0, 0, true) end else outputChatBox("You are not in a vehicle", source, 255, 0, 0, true) end end ) if 'rootElement' is not defined, then change it to 'root' And engine functions are client side only.
  5. The second argument of addCommandHandler is the function, not a player element.
  6. Proba copiando el server side de nuevo.
  7. Replace: bank.xml.server.lua with this: --[[ Resource: bank (written by 50p) Version: 2.3 Filename: bank.xml.server.lua ]] 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, "interior" ) ) or 0; banksInfo[ tempID ].dimension = tonumber( xmlNodeGetAttribute( bank_loc, "dimension" ) ) 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 banksInfo[ tempID ].dimension then setElementDimension( banksInfo[ tempID ].marker, banksInfo[ tempID ].dimension ); end 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, "interior" ) ) 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, "interior" ) ) 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.teleDimension = tonumber(xmlNodeGetAttribute( entrance_node, "teleDimension" )) or 0; 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 ) local blip = createBlipAttachedTo( banksInfo[ tempID ].entrance.marker, 52, 1, 255, 0, 0, 255, 0, 250); 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 ) 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.teleDimension = xmlNodeGetAttribute( exit_node, "teleDimension" ) banksInfo[ tempID ]._exit.dimension = xmlNodeGetAttribute( exit_node, "dimension" ) 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 ); if banksInfo[ tempID ]._exit.dimension then setElementDimension( banksInfo[ tempID ]._exit.marker, banksInfo[ tempID ]._exit.dimension ); end 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 Then just add 'dimension' attribute when you are creating the bank with the dimension you want it to appear at.
  8. Pusiste 'source' en ves del ID del arma. -- server side: id = {} id[1] = 331 id[2] = 333 id[3] = 334 id[4] = 335 id[5] = 336 id[6] = 337 id[7] = 338 id[8] = 339 id[9] = 341 id[22] = 346 id[23] = 347 id[24] = 348 id[25] = 349 id[26] = 350 id[27] = 351 id[28] = 352 id[29] = 353 id[32] = 372 id[30] = 355 id[31] = 356 id[33] = 357 id[34] = 358 id[16] = 342 id[17] = 343 id[18] = 344 id[39] = 363 id[41] = 365 id[42] = 366 id[43] = 367 id[14] = 325 function getWeaponObjectFromID( id_ ) if id_ then object = id[id_] if object then return object else return false end else return false end end function createWeaponOnFloor( id, x, y, z ) id = getWeaponObjectFromID( id ) object = createObject( id, x, y, z ) setElementData( object, "WeaponID", id ) end addEvent( "createWeaponOnFloor", true ) addEventHandler( "createWeaponOnFloor", getRootElement(), createWeaponOnFloor ) function tirararma(source) Arma = getPedWeapon ( source ) if takeWeapon ( source, Arma ) then exports.chat:me( source, "deja algo en el suelo." ) setPedAnimation ( source, "BOMBER", "BOM_Plant", 3000, false ) x, y, z = getElementPosition( source ) triggerClientEvent( source, "getThePosition", source, Arma, x, y, z ) else outputChatBox ( "No tienes un arma.", getRootElement(), 255, 255, 255, true ) end end addCommandHandler("tirararma", tirararma) -- client side: function getThePosition( id, x, y, z ) z2 = getGroundPosition( x, y, z ) triggerServerEvent( "createWeaponOnFloor", localPlayer, id, x, y, z2 ) end addEvent( "getThePosition", true ) addEventHandler( "getThePosition", getLocalPlayer(), getThePosition)
  9. That script doesn't has dimension support if I'm right, you need to add it by yourself to the script.
  10. Instead of: if ( source == infernus-mod ) then Do: if ( source == modlord ) then You don't use button names as variables.
  11. It has no errors or anything, you set the script as client side? and I think positions are wrong or something, because I can't see te text at all.
  12. script.lua: addCommandHandler ( "spawnbot", function ( thePlayer ) local x, y, z = getElementPosition ( thePlayer ) local rot = getPedRotation ( thePlayer ) local skin = math.random ( 28, 165 ) local interior = getElementInterior ( thePlayer ) local dimension = getElementDimension ( thePlayer ) local weapon = 31 local mode = "hunting" exports [ "slothbot" ]:spawnBot ( x, ( y + 1 ), z, rot, skin, interior, dimension, false, weapon, mode ) end ) meta.xml: You must create a new folder in your server resources folder which is located at: MTA San Andreas 1.3\server\mods\deathmatch\resources\ Then create 2 files: 1: script.lua 2: meta.xml Then copy the code I posted for each file and go to your server and start the resource. Then when started this and slothbot resource, go ingame and write "/spawnbot" in chat box.
  13. This has gone a bit far, I'll lock the topic.
  14. If I understand him correctly, he wants to know how to disable player controls. @snes: You must use: toggleControl or you can use: toggleAllControls
  15. https://wiki.multitheftauto.com/wiki/Slothman/Slothbot
  16. Simple add: if ( tonumber ( amount ) < 0 ) then return end Before: if (getPlayerMoney(thePlayer) >= amount) then
  17. You don't specify the row, you can use the WHERE clause to know which to update, like this: dbExec( connection, "UPDATE ?? SET ??=? WHERE ??=?", "users", "money", 5000, "name", "Test" ) And yes, that query should create a table.
×
×
  • Create New...