-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
Oh, I found the problem, copy my code again.
-
Eso no tiene nada quever, ademas el problema ya esta resuelto aca: viewtopic.php?f=91&t=45403
-
LuaQ = un script Lua compilado, no se puede editar. P.D: De nada.
-
No hiciste todo, yo te dije que borrases del nombre de la funcion, no que lo remplazes por 'source', solo en las otras funciones tenias que remplazar.
-
That's odd, it has to work when the player changes nick, no matters how. You're welcome.
-
1: You should use the event: "onPlayerChangeNick" instead of "onPlayerCommand", as I'm not sure if you cancel the event, it won't change nick. 2: You only need one table, no need for two tables. 3: Test my code. local nickChangeRestriction = { } addEventHandler ( "onPlayerChangeNick", getRootElement(), function ( ) if ( nickChangeRestriction [ source ] and isTimer ( nickChangeRestriction [ source ] ) ) then cancelEvent ( ) local a, b, c = getTimerDetails ( nickChangeRestriction [ source ] ) local waitTime = ( a / 1000 ) local waitTime = ( waitTime < 60 and tostring ( math.round ( waitTime ) ).." seconds" or tostring ( math.round ( ( waitTime / 60 ), 0, "ceil" ) ) .." minutes" ) outputChatBox ( "#FF9900*[PM][ANTI FLOOD] #FFFFFFYou have to wait #ABCDEF".. tostring ( waitTime ) .." #FFFFFFto change your nick again", source, 255, 0, 0, true ) return end nickChangeRestriction [ source ] = setTimer ( function ( thePlayer ) nickChangeRestriction [ thePlayer ] = false end ,5000, 1, source ) end ) function math.round ( number, decimals, method ) local decimals = ( decimals or 0 ) local factor = ( 10 ^ decimals ) if ( method == "ceil" or method == "floor" ) then return math [ method ] ( number * factor ) / factor else return tonumber ( ( "%.".. decimals .."f" ):format ( number ) ) end end
-
gates = { } cols = { } gates [ 1 ] = createObject(1495, 239.5, 116.099609375, 1002.200012207, 0, 0, 90) gates [ 2 ] = createObject(1495, 239.5, 119.099609375, 1002.200012207, 0, 0, 270) cols [ 1 ] = createColCircle ( 239.5, 116.099609375, 1002.200012207, 2 ) setElementInterior ( gates [ 1 ], 10 ) setElementInterior ( gates [ 2 ], 10 ) setElementInterior ( cols [ 1 ], 10 ) function moveGate ( thePlayer ) if ( source == cols [ 1 ] ) then if exports.factions:isPlayerInFaction ( thePlayer, 1 ) then moveObject ( gates [ 1 ], 2000, 253.19921875, 107.599609375, 1002.200012207 ) moveObject ( gates [ 2 ], 2000, 253.19921875, 110.599609375, 1002.200012207 ) end end end addEventHandler ( "onColShapeHit", getRootElement(), openGates ) function closeGates ( thePlayer ) if ( source == cols [ 1 ] ) then if exports.factions:isPlayerInFaction ( thePlayer, 1 ) then moveObject ( gates [ 1 ], 5000, 239.5, 116.099609375, 1002.200012207 ) moveObject ( gates [ 2 ], 5000, 239.5, 119.099609375, 1002.200012207 ) end end end addEventHandler ( "onColShapeLeave", getRootElement(), closeGates ) Your problem was with this line: isPlayerInFaction = exports.factions:isPlayerInFaction
-
1: Cuando usas un evento creado por un script, necesitas usar addEvent tambien. 2: El argumento del jugador de ese evento no es 'thePlayer', es 'source' ( borrra 'thePlayer' del nombre de la funcion y remplazalo en las otras funciones con 'source' ).
-
Ese evento se usa para cuando un recurso inicia, vos tendrias que usar el evento para cuando el evento de mi sistema de niveles que es: "onPlayerChangeLevel".
-
https://wiki.multitheftauto.com/wiki/Cli ... _functions
-
Si, con las funciones de DirectX podes hacerlo.
-
function createVehicleCommand ( thePlayer, commandName, carName ) local x, y, z = getElementPosition ( thePlayer ) local carModel = tonumber ( carName ) if ( type ( carModel ) == "number" ) then if ( carModel < 400 or carModel > 611 ) then outputChatBox ( "Invalid Vehicle", player, 255, 0, 0 ) else createVehicle ( carModel, x + 5, y, z ) outputChatBox ( "Your " .. getVehicleNameFromModel ( carModel ) .. " (#" .. carModel .. ") was spawned with an ID of " .. vehicles.id, player, 0, 255, 0 ) vehicles.id = ( vehicles.id + 1 ) end else local carModel = getVehicleModelFromName ( carName ) if ( not carModel ) then outputChatBox ( "That is not a valid car name", player, 255, 0, 0 ) else createVehicle ( carModel, x + 5, y, z ) outputChatBox ( "Your " .. getVehicleNameFromModel ( carModel ) .. " (#" .. carModel .. ") was spawned with and ID of " .. vehicles.id, player, 0, 255, 0 ) vehicles.id = ( vehicles.id + 1 ) end end end addCommandHandler ( "v", createVehicleCommand )
-
Instead of keeping just with one answer, check mine as well, it should work.
-
function createVehicleCommand ( thePlayer, commandName, carName ) local x, y, z = getElementPosition ( thePlayer ) local carModel = tonumber ( carName ) if ( type ( carModel ) == "number" ) then if ( carModel < 400 or carModel > 611 ) then outputChatBox ( "Invalid Vehicle", player, 255, 0, 0 ) else createVehicle ( carModel, x + 5, y, z ) outputChatBox ( "Your " .. getVehicleName ( carModel ) .. " (#" .. carModel .. ") was spawned with an ID of " .. vehicles.id, player, 0, 255, 0 ) vehicles.id = ( vehicles.id + 1 ) end else local carModel = getVehicleModelFromName ( carName ) if ( not carModel ) then outputChatBox ( "That is not a valid car name", player, 255, 0, 0 ) else createVehicle ( carModel, x + 5, y, z ) outputChatBox ( "Your " .. getVehicleName ( carModel ) .. " (#" .. carModel .. ") was spawned with and ID of " .. vehicles.id, player, 0, 255, 0 ) vehicles.id = ( vehicles.id + 1 ) end end end addCommandHandler ( "v", createVehicleCommand )
-
Post your entire script.
-
local carName = tonumber ( carName ) if ( type ( carName ) == "number" ) then if ( carName < 400 or carName > 611 ) then outputChatBox ( "Invalid Vehicle", player, 255, 0, 0 ) else -- Your code end end
-
No, no se puede cancelar ese evento. En el SAUR yo lo hice asi: setElementHealth ( source, 300 ) setVehicleDamageProof ( source, true )
-
Command arguments will be always a string, you have to convert it to a number.
-
Esta todo mal. function displayVehicleLoss ( loss ) local VidaAuto = math.floor ( tonumber ( getElementHealth ( source ) ) ) local driver = getVehicleController ( source ) if ( driver ) then outputChatBox ( "Le queda ".. VidaAuto .."% de vida a tu vehiculo.", driver ) end if ( VidaAuto <= 251 ) then setVehicleEngineState ( source, false ) else setVehicleEngineState ( source, true ) end end addEventHandler ( "onVehicleDamage", getRootElement(), displayVehicleLoss )
-
La verdad es que no es la fuente el problema, el problema es la libreria "textlib", no soporta fuentes propias que yo sepa.
-
Dice que la fuente esta mal.