-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
-- server side: function table.random ( theTable ) return theTable[math.random ( #theTable )] end local vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, 444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } addEvent ( "giveVehicle", true ) addEventHandler ( "giveVehicle", resourceRoot, function ( ) local veh = createVehicle ( table.random ( vehicleIDS ), 3819, -1846.2, 48.4, 0, 0 ) outputChatBox ( "YAY" ) fadeCamera ( source, true ) local warp = warpPedIntoVehicle ( source, veh ) if ( warp == true ) then outputChatBox ( "yayyyyyyyyyywarp" ) triggerClientEvent ( source, "Spawned", root ) end end ) -- client side. addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) triggerServerEvent ( "giveVehicle", localPlayer ) end )
-
Tried using a timer?
-
It's a bug. http://bugs.mtasa.com/view.php?id=7855
-
That's because the server side is loaded before the client side.
-
Maybe you should use a table instead of the way you did it to store the positions.
-
You can't change the grid list text font.
-
function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end WindowTOP = guiCreateWindow(328, 125, 613, 514, "", false) guiSetProperty(WindowTOP, "CaptionColour", "FF00FF00") guiSetVisible(WindowTOP, false) guiWindowSetSizable(WindowTOP, false) guiWindowSetMovable(WindowTOP, false) centerWindow ( WindowTOP ) GridListTOP = guiCreateGridList(9, 27, 594, 477, false, WindowTOP) guiGridListAddColumn(GridListTOP, "Rank", 0.2) guiGridListAddColumn(GridListTOP, "Name", 0.2) guiGridListAddColumn(GridListTOP, "Money", 0.2) guiGridListAddColumn(GridListTOP, "Kills", 0.2) guiGridListAddColumn(GridListTOP, "Deaths", 0.1) function U ( ) guiGridListClear ( GridListTOP ) local players = getPlayersSortByKills ( ) for i = 1, 30 do if ( players [ i ] )then local row = guiGridListAddRow ( GridListTOP ) guiGridListSetItemText( GridListTOP, row, 1, i ..'-', false, false ) guiGridListSetItemColor( GridListTOP, row, 1, 0, 0, 255 ) guiGridListSetItemText( GridListTOP, row, 2, getPlayerName ( players [ i ].element ), false, false ) guiGridListSetItemColor( GridListTOP, row, 2, 255, 255, 0 ) guiGridListSetItemText( GridListTOP, row, 3, tostring ( players [ i ].kills ), false, false ) guiGridListSetItemColor ( GridListTOP, row, 3, 255, 0, 0 ) guiGridListSetItemText ( GridListTOP, row, 4, tostring ( players [ i ].deaths ), false, false ) guiGridListSetItemColor ( GridListTOP, row, 4, 250, 154, 255 ) end end end function getPlayersSortByKills ( ) local players = { } for _, player in ipairs ( getElementsByType ( "player" ) ) do table.insert ( players, { element = player, kills = getElementData ( player, "Kills" ) or 0, deaths = getElementData ( player, "Deaths" ) or 0, } ) end table.sort ( players, function ( a, b ) return ( tonumber ( a.kills ) or 0 ) > ( tonumber ( b.kills ) or 0 ) end ) return players end bindKey ( "F2" , "down" , function () if guiGetVisible ( WindowTOP , true ) then guiSetVisible ( WindowTOP , false ) showCursor ( false ) outputChatBox ( "Closed" , 255 , 0 , 0 , true ) else guiSetVisible ( WindowTOP , true ) showCursor ( true ) outputChatBox ( "Opened" , 0 , 255 , 0 , true ) U ( ) end end ) Problems: 1: You weren't executing "U" function, which is what adds the players to list. 2: You were adding wrong the rows.
-
[Pregunta espero me puedan responder porfavor]
Castillo replied to XodiaCompany's topic in Scripting
La verdad es que no se como maneja el DayZ las muertes, puede que ni mueran siquiera. -
Are you sure there are no errors? they won't show in the server console, you must be ingame and do /debugscript 3.
-
[Pregunta espero me puedan responder porfavor]
Castillo replied to XodiaCompany's topic in Scripting
El script ese deberia funcionar, no tiene nada malo. Intenta probarlo en un servidor sin DayZ. -
[Pregunta espero me puedan responder porfavor]
Castillo replied to XodiaCompany's topic in Scripting
Asi como esta esta bien. El recurso se llama "z11"? -
[Pregunta espero me puedan responder porfavor]
Castillo replied to XodiaCompany's topic in Scripting
Lo pusiste como server side? -
Aca te dejo las funciones que tendrias que usar: isElementOnScreen -- Verifica si un elemento esta en la pantalla. getElementPosition -- Obtiene la posicion de un elemento. getCameraMatrix -- Obtiene la posicion de la camara y adonde apunta. getDistanceBetweenPoints3D -- Obtiene la distance entre 2 coordenadas 3D. getScreenFromWorldPosition -- Obtiene la posicion en la pantalla de una posicion 3D. dxDrawText -- Dibuja un texto. Evento: onClientRender
-
[Pregunta espero me puedan responder porfavor]
Castillo replied to XodiaCompany's topic in Scripting
addEventHandler ( "onPlayerWasted", getRootElement(), function ( _, killer ) if ( killer and killer ~= source ) then if ( getElementType ( killer ) == "player" ) then exports.z11:addPlayerEXP ( killer, 2 ) end end end ) Eso querias? -
Ya se lo explique bien por PM hace unos dias.
-
Thanks for making it clear.
-
I didn't understand the shadow part. About the moving text, you can either define variables with the position and update it to make it "move", or you can use interpolateBetween to make a nice and smooth effect.
-
dxDrawText needs to be used inside a onClientRender event in order to keep it rendering.
-
function giveso ( ) local money = getPlayerMoney ( source ) if ( money >= 6000 ) then outputChatBox ( "Usted compro Sawn Off $6000", source, 225, 225, 0 ) takePlayerMoney ( source, 6000 ) giveWeapon ( source, 26, 350, true ) end end addEvent ( "giveso", true ) addEventHandler ( "giveso", getRootElement(), giveso )
-
Did you touch the IP field in the mtaserver.conf?