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. Well, there you got the problem, variables ain't shared between client and server side.
  3. Where is "pedFreightJob" defined?
  4. Oh, sorry, I just noticed the problem, copy my code again.
  5. 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.
  6. 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
  7. 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.
  8. With the ingame performance browser ( ipb ) you can do it, if I'm right.
  9. 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
  10. A que te referis con "nada"?
  11. They added them some time ago, but they disabled because they had many problems.
  12. They may have a way to add custom animations, MTA doesn't.
  13. Fijate que valor tiene "money" al tocar el pickup.
  14. I don't think there's such animation.
  15. 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
  16. Para que queres el comando?
  17. There are few type of markers: "cylinder", "corona", "checkpoint".
  18. if ( editingVehicle ) and ( getVehicleOccupant ( editingVehicle, 0 ) == hitPlayer ) then
  19. addCommandHandler no tiene 'source'.
  20. Postea los errores y en que lineas.
×
×
  • Create New...