-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
You're welcome.
-
There are two kinds of Role Play: 1. The realistic style, where you are forced to play like you would do in real life. 2. The one which doesn't enforce real playing, and has unrealistic features. The second one stands for RPG, and the first I call it "RP".
-
Means that the table is not being created.
-
Yes, you must use that apart from addEventHandler.
-
Where did you get that script from? since DayZ game mode is compiled.
-
local vehicles = { } function spawnCar ( ) if ( not isPedInVehicle ( source ) ) then if ( isElement ( vehicles [ source ] ) and isElementInWater ( vehicles [ source ] ) or isVehicleBlown ( vehicles [ source ] ) or not isElement ( vehicles [ source ] ) ) then local x, y, z = getElementPosition ( source ) vehicles [ source ] = createVehicle ( 587, x, y, z ) setVehicleColor ( vehicles [ source ], 20, 20, 20, 30, 30, 30 ) warpPedIntoVehicle ( source, vehicles [ source ] ) setVehicleHeadLightColor ( vehicles [ source ], 0, 0, 255 ) addVehicleSirens ( vehicles [ source ], 1, 2 ) setVehicleSirens ( vehicles [ source ], 1, 0, 0.7, 0.35, 255, 0, 255 ) end end end addEvent ( "vehicleSpawn", true ) addEventHandler ( "vehicleSpawn", getRootElement(), spawnCar ) Try that.
-
Try the event: "onGamemodeMapStart". And if it's race the game mode, then you can use "onMapStarting" too.
-
Try MTA paradise game mode, it doesn't have a lot of features, but it's a start. Here's the link: https://github.com/mabako/mta-paradise
-
function MarkerHit1 ( player ) local playerGang = getElementData ( player, "gang" ) local turfGang = getElementData ( marker1, "getTurfGang" ) if ( turfGang == playerGang ) then outputChatBox ( "Esta base ya pertence a ".. turfGang, player, 0, 255, 0, false ) else if ( not getPlayerTeam ( player ) ) then return end local team = getPlayerTeam ( player ) if ( getTeamName ( team ) == "geral" ) then local playerGang = getElementData ( player, "gang" ) if ( playerGang ) then if ( isTimer ( beachturfTimer ) ) then return end if ( turfGang ~= playerGang ) then if isTimer ( floodTimer ) then return else outputChatBox ( "[ALERTA]Estan tomando la base en ".. getElementZoneName ( marker1 ) ..",".. getElementZoneName ( marker1, true ) ) floodTimer = setTimer ( function ( ) end, 5000, 1 ) end end local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) local turfGang = getElementData ( marker1, "getTurfGang" ) if ( turfGang ) then outputChatBox ( "Entraste En La Base de ".. turfGang ..". Espera 2 Minutos Para Poder Conquistar la base Y Ganar la base", player, 0, 255, 0, false ) else outputChatBox ( "Esta base Aun No Pertenese A Nadie. Espera 2 Minutos Para Poder Conquistarla", player, 0, 255, 0, false ) end beachturfTimer1 = setTimer ( function ( ) if isElementWithinMarker ( player, marker1 ) then setMarkerColor ( marker1, tonumber ( r ), tonumber ( g ), tonumber ( b ), 100 ) outputChatBox ( "Felicidades Conquistaste la base!", player, 0, 255, 0, false ) triggerClientEvent ( "onTakeTurf", player ) givePlayerMoney ( player, 4000 ) setElementData ( marker1, "getTurfGang", playerGang ) setCameraMatrix ( player, 1939.5476074219, -2162.421875, 39.010345458984, 1961.9000244141, -2214.6000976563, 16.10000038147, 0, 70 ) setTimer ( function ( player ) if isElement ( player ) then setCameraTarget ( player ) end end ,5000, 1, player ) for _, thePlayer in ipairs ( getElementsWithinColShape ( getElementColShape ( marker1 ), "player" ) ) do if ( getElementData ( thePlayer, "gang" ) == getElementData ( marker1, "getTurfGang" ) ) then setElementData ( thePlayer, ItemAzar [ math.random ( 1, #ItemAzar ) ], 1 ) end end end end ,3000, 1 ) end end end end addEventHandler ( "onMarkerHit", marker1, MarkerHit1 )
-
Hacer una variable local es para que no se pueda usar fuera del ámbito en el que la estes usando, ejemplo: una funcion.
-
C++ y Lua no tienen nada parecido. Lua comparado con C++ es para niños, ya que C++ es muy dificil de entender si no tenes experiencia previa en otros lenguajes.
-
Ah, well, it should be working fine.
-
No entiendo tu pregunta.
-
Primero, Lua no es programacion, sino scripting, segundo, para que queres aprender otro lenguaje para aprender despues Lua?
-
Dudo que esos sean los requisitos minimos.
-
Where is the RPG game mode type? there's just "Role Play".
-
You're welcome.
-
No need for that, you can get the element data. addEvent( 'HOUSE_Buy', true ); addEventHandler( 'HOUSE_Buy', root, function( cost, key ) local playeraccount = getPlayerAccount( client ) local accName = getAccountName( playeraccount ); local houseCounter = 0; for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do if getElementData( v, 'HS_INFO' ) then local owner = getElementData( v, 'HS_INFO' )[7]; if owner == accName then houseCounter = houseCounter + 1; end; end; end; local playTime = getElementData ( client, "PlayTime" ) or "0:0:0" local playTimeSplitted = split ( playTime, ":" ) local hours = 0 if ( playTimeSplitted ) then hours = tonumber ( playTimeSplitted [ 1 ] ) end if houseCounter >= tonumber( get( 'playerHouseCounter' ) ) or ( hours < 30 ) then outputChatBox( '* You can not buy this house because you already have one or you have not reached 30 hours Play Time!', client, 255, 51, 36, true ); setPedFrozen( client, false ); return false; end; if getPlayerMoney( client ) >= tonumber( cost ) then outputChatBox( '* Key has been set to #00FF00'..key, client, 255, 51, 36, true ); outputChatBox( '* Congratulations! You have bought a house!', client, 255, 255, 0 ); sql.Query( "UPDATE house_data SET owner = '"..accName.."', key = '"..key.."' WHERE ID = ?", getElementData( client, 'mrk_in' ) ); takePlayerMoney( client, cost ); local mrk = getHouseByID( getElementData( client, 'mrk_in' ) ); local t = {}; for i = 1, 6 do t[i] = getElementData( mrk, 'HS_INFO' )[i]; end; t[7] = accName; t[8] = key; t[9] = getElementData( client, 'mrk_in' ); setElementData( mrk, 'HS_INFO', { t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9] } ); setMarkerColor( mrk, 255, 51, 36, 150 ); setTimer( onPlayerHouseMarkerHit, 50, 1, client, mrk, true ); else outputChatBox( '* You do not have enough money to buy this house!', client, 255, 51, 36 ); onPlayerHouseMarkerHit( client, getHouseByID( getElementData( client, 'mrk_in' ) ), true ); end; end );
-
Thing is, the script that saves time saves it only on quit, so it won't be updated when you try to buy the house.
-
addEvent( 'HOUSE_Buy', true ); addEventHandler( 'HOUSE_Buy', root, function( cost, key ) local playeraccount = getPlayerAccount( client ) local accName = getAccountName( playeraccount ); local houseCounter = 0; for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do if getElementData( v, 'HS_INFO' ) then local owner = getElementData( v, 'HS_INFO' )[7]; if owner == accName then houseCounter = houseCounter + 1; end; end; end; local time = getAccountData ( playeraccount, "PlayTime" ) local hou = getAccountData ( playeraccount, "PlayTime-hour") local min = getAccountData ( playeraccount, "PlayTime-min") local sec = getAccountData ( playeraccount, "PlayTime-sec") if houseCounter >= tonumber( get( 'playerHouseCounter' ) ) or ( hou < 30 ) then outputChatBox( '* You can not buy this house because you already have one or you have not reached 30 hours Play Time!', client, 255, 51, 36, true ); setPedFrozen( client, false ); return false; end; if getPlayerMoney( client ) >= tonumber( cost ) then outputChatBox( '* Key has been set to #00FF00'..key, client, 255, 51, 36, true ); outputChatBox( '* Congratulations! You have bought a house!', client, 255, 255, 0 ); sql.Query( "UPDATE house_data SET owner = '"..accName.."', key = '"..key.."' WHERE ID = ?", getElementData( client, 'mrk_in' ) ); takePlayerMoney( client, cost ); local mrk = getHouseByID( getElementData( client, 'mrk_in' ) ); local t = {}; for i = 1, 6 do t[i] = getElementData( mrk, 'HS_INFO' )[i]; end; t[7] = accName; t[8] = key; t[9] = getElementData( client, 'mrk_in' ); setElementData( mrk, 'HS_INFO', { t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9] } ); setMarkerColor( mrk, 255, 51, 36, 150 ); setTimer( onPlayerHouseMarkerHit, 50, 1, client, mrk, true ); else outputChatBox( '* You do not have enough money to buy this house!', client, 255, 51, 36 ); onPlayerHouseMarkerHit( client, getHouseByID( getElementData( client, 'mrk_in' ) ), true ); end; end );
-
You can edit the script to do that.
-
Well, that's not the whole function.
-
Found your mistake, you didn't define "playeraccount" on the "HOUSE_Buy" event. addEvent( 'HOUSE_Buy', true ); addEventHandler( 'HOUSE_Buy', root, function( cost, key ) local playeraccount = getPlayerAccount( client ) local accName = getAccountName( playeraccount ); local houseCounter = 0; local time = getAccountData ( playeraccount, "PlayTime" ) local hou = getAccountData ( playeraccount, "PlayTime-hour") local min = getAccountData ( playeraccount, "PlayTime-min") local sec = getAccountData ( playeraccount, "PlayTime-sec") for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do if getElementData( v, 'HS_INFO' )then local owner = getElementData( v, 'HS_INFO' )[7]; if owner == accName and ( hou >= 30 ) then houseCounter = houseCounter + 1; end; end; end;