-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
[SOLVED] Random info pulled from XML/Getting Players Veh ID
Castillo replied to TheGamingMann's topic in Scripting
getVehicleModelFromName gets the vehicle model from a vehicle name, and you gave as argument a vehicle element. -
Nice one, looks quite awesome
-
Well, there you got the problem, variables ain't shared between client and server side.
-
Where is "pedFreightJob" defined?
-
[SOLVED] Random info pulled from XML/Getting Players Veh ID
Castillo replied to TheGamingMann's topic in Scripting
Oh, sorry, I just noticed the problem, copy my code again. -
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.
-
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
-
[SOLVED] Random info pulled from XML/Getting Players Veh ID
Castillo replied to TheGamingMann's topic in Scripting
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. -
You're welcome.
-
With the ingame performance browser ( ipb ) you can do it, if I'm right.
-
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
-
A que te referis con "nada"?
-
They added them some time ago, but they disabled because they had many problems.
-
They may have a way to add custom animations, MTA doesn't.
-
Fijate que valor tiene "money" al tocar el pickup.
-
I don't think there's such animation.
-
Pero crea los pickups?
-
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
-
And a colshape for sure.
-
Para que queres el comando?
-
There are few type of markers: "cylinder", "corona", "checkpoint".
-
if ( editingVehicle ) and ( getVehicleOccupant ( editingVehicle, 0 ) == hitPlayer ) then
-
addCommandHandler no tiene 'source'.
-
Postea los errores y en que lineas.