Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. getVehicleModelFromName gets the vehicle model from a vehicle name, and you gave as argument a vehicle element.
  2. Nice one, looks quite awesome
  3. Well, there you got the problem, variables ain't shared between client and server side.
  4. Where is "pedFreightJob" defined?
  5. Oh, sorry, I just noticed the problem, copy my code again.
  6. Ya funciona bien?
  7. Voy a re-abrir el tema porque no se me dieron pruebas de que realizaron ataques DDoS, sino de lo contrario. Les pido que no se haga off-topic de esto.
  8. function createMoney ( player ) local x, y, z = getElementPosition ( player ) local x1, y1, x2, y2 local x1 = ( x - 2 ) + ( math.random ( ) * 4 ) local y1 = ( y - 2 ) + ( math.random ( ) * 4 ) local x2 = ( x - 2 ) + ( math.random ( ) * 4 ) local y2 = ( y - 2 ) + ( math.random ( ) * 4 ) local moneyAmmount = getPlayerMoney(player); -- it is not fair too get all the player money. local moneyAmmount = math.floor ( moneyAmmount / 1 ); -- We are going to create 3 pickups, zo we are just cut the ammount in half local moneyAmmount = math.floor ( moneyAmmount / 3 ) -- Create the pickups setElementData ( createPickup ( x1, y1, z, 3, 1212 ), "amount", moneyAmmount ) setElementData ( createPickup ( x2, y2, z, 3, 1212 ), "amount", moneyAmmount ) setElementData ( createPickup ( x2, y2, z, 3, 1212 ), "amount", moneyAmmount ) end addCommandHandler ( "tirardinero", createMoney ) function moneyPickupHit ( player ) local money = getElementData ( source, "amount" ) if ( money ) then givePlayerMoney ( player, money ) destroyElement ( source ) end end addEventHandler ( "onPickupHit", root, moneyPickupHit ) Me habia olvidado del event handler de onPickupHit
  9. function fillLoadList ( ) local file = xmlLoadFile ( "loads.xml" ) if ( file ) then local childs = xmlNodeGetChildren ( file ) local randomChilds = { } for index = 1, 3 do table.insert ( randomChilds, childs [ math.random ( #childs ) ] ) end for _, loads in ipairs ( randomChilds ) do local row = guiGridListAddRow ( glistLoadList ) local attrs = xmlNodeGetAttributes ( loads ) local endx = attrs.endx local endy = attrs.endy local endz = attrs.endz guiGridListSetItemText ( glistLoadList, row, 1, attrs.cargo, false, false ) guiGridListSetItemData ( glistLoadList, row, 1, { attrs.startx, attrs.starty, attrs.startz } ) guiGridListSetItemText ( glistLoadList, row, 2, attrs.pickup, false, false ) guiGridListSetItemText ( glistLoadList, row, 3, attrs.dropoff, false, false ) guiGridListSetItemText ( glistLoadList, row, 4, attrs.pay, false, false ) end xmlUnloadFile ( file ) end end Try it.
  10. You're welcome.
  11. With the ingame performance browser ( ipb ) you can do it, if I'm right.
  12. No me referia a eso, pone este codigo y postea el resultado: function createMoney ( player ) local x, y, z = getElementPosition ( player ) local x1, y1, x2, y2 local x1 = ( x - 2 ) + ( math.random ( ) * 4 ) local y1 = ( y - 2 ) + ( math.random ( ) * 4 ) local x2 = ( x - 2 ) + ( math.random ( ) * 4 ) local y2 = ( y - 2 ) + ( math.random ( ) * 4 ) local moneyAmmount = getPlayerMoney(player); -- it is not fair too get all the player money. local moneyAmmount = math.floor ( moneyAmmount / 1 ); -- We are going to create 3 pickups, zo we are just cut the ammount in half local moneyAmmount = math.floor ( moneyAmmount / 3 ) -- Create the pickups setElementData ( createPickup ( x1, y1, z, 3, 1212 ), "amount", moneyAmmount ) setElementData ( createPickup ( x2, y2, z, 3, 1212 ), "amount", moneyAmmount ) setElementData ( createPickup ( x2, y2, z, 3, 1212 ), "amount", moneyAmmount ) end addCommandHandler ( "tirardinero", createMoney ) function moneyPickupHit ( player ) local money = getElementData ( source, "amount" ) if ( money ) then outputChatBox ( "DATA IS: ".. tostring ( money ) ) givePlayerMoney ( player, money ) destroyElement ( source ) end end
  13. A que te referis con "nada"?
  14. They added them some time ago, but they disabled because they had many problems.
  15. They may have a way to add custom animations, MTA doesn't.
  16. Fijate que valor tiene "money" al tocar el pickup.
  17. I don't think there's such animation.
  18. Pero crea los pickups?
  19. function createMoney ( player ) local x, y, z = getElementPosition ( player ) local x1, y1, x2, y2 local x1 = ( x - 2 ) + ( math.random ( ) * 4 ) local y1 = ( y - 2 ) + ( math.random ( ) * 4 ) local x2 = ( x - 2 ) + ( math.random ( ) * 4 ) local y2 = ( y - 2 ) + ( math.random ( ) * 4 ) local moneyAmmount = getPlayerMoney(player); -- it is not fair too get all the player money. local moneyAmmount = math.floor ( moneyAmmount / 1 ); -- We are going to create 3 pickups, zo we are just cut the ammount in half local moneyAmmount = math.floor ( moneyAmmount / 3 ) -- Create the pickups setElementData ( createPickup ( x1, y1, z, 3, 1212 ), "amount", moneyAmmount ) setElementData ( createPickup ( x2, y2, z, 3, 1212 ), "amount", moneyAmmount ) setElementData ( createPickup ( x2, y2, z, 3, 1212 ), "amount", moneyAmmount ) end addCommandHandler ( "tirardinero", createMoney ) function moneyPickupHit ( player ) local money = getElementData ( source, "amount" ) if ( money ) then givePlayerMoney ( player, money ) destroyElement ( source ) end end
  20. And a colshape for sure.
  21. Para que queres el comando?
  22. There are few type of markers: "cylinder", "corona", "checkpoint".
  23. if ( editingVehicle ) and ( getVehicleOccupant ( editingVehicle, 0 ) == hitPlayer ) then
  24. addCommandHandler no tiene 'source'.
  25. Postea los errores y en que lineas.
×
×
  • Create New...