-
Posts
2,947 -
Joined
-
Last visited
Everything posted by JR10
-
There is an exported function called createZombie in the zombies resource, use it. exports.zombies:createZombie ( x, y, z, rot, skin, interior, dimension )
-
They have their differences. A simple Google search will provide you with the main ones.
-
Then you need a pattern to do the work for you, a simple one like this might do: guiGridListGetItemText(shopItemsList, row, 2):match("%d+.%d+") It will extract the number whether it's "Text 00.00", "00.00 Text". Also the amount of digits won't matter.
-
If the text is always gonna be in that format (0.00 Text) then it's easy using sub: guiGridListGetItemText(shopItemsList, row, 2):sub(1, 4)
-
f ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then elseif ( pTeam ) and ( teamName ) then If the first one doesn't resolve to true, the second one will. You don't have any code under elseif, so nothing will happen. Perhaps this is what you want: function NeedMsg(p,n,getOwnedBy) if (n) then outputChatBox(unpack(messages[n])) end end --[[ ZONE CREATION ]]-- addEventHandler('onColShapeHit', pCuboid1, function(p) NeedMsg(p,6) local pTeam = getPlayerTeam( p ) if (not pTeam) then return end local teamName = getTeamName(pTeam) if (teamName == "Equipo2") then NeedMsg(p,1) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( p, 4000 ) NeedMsg(p,4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) end, 6000, 1 ) end else NeedMsg(p,3) end if (getPedOccupiedVehicle( p )) then NeedMsg(p,5) end end ) addEventHandler('onColShapeLeave', pCuboid1, function(p) setRadarAreaFlashing( pArea1, false ) if isTimer(capturing) then killTimer(capturing) end NeedMsg(p,7) end ) Again I'm not sure.
-
You have two checks that you don't handle.
-
No. When the script starts localPlayer is a 'userdata' that points to the local player. When you define lPlayer, it's now a 'userdata' variable that points to the local player. Before localPlayer variable was predefined, most people did this at the start of their client scripts: localPlayer = getLocalPlayer() See, the "system" doesn't need to check for the local player, as the local player will never change. Client scripts run on the client, so localPlayer doesn't change, there's no "looking" involved.
-
Yes you can do that with 'shared'. 'shared' also works with exports, you can do: <export function="functionName" type="shared"/> Yes, it gets downloaded to the client.
-
I stated the normal behavior as far as I know. Make sure that the resource is restarted, perhaps with a debug string or a chat box message. Make sure that there are no other resources running that might be doing that.
-
Practically the same thing, just use localPlayer since it's predefined and everyone knows it. Numbers, strings, booleans and nil are passed by value, you basically have 2 variables that are equal but do not affect each other. It's fine if you don't get what I mean here, you can read more about it here: http://www.lua.org/manual/5.1/manual.html#2.2
-
A quote from the wiki: You can also use callRemote along with the PHP SDK. Read more: https://wiki.multitheftauto.com/wiki/CallRemote
-
You're either using includes or have a code that restarts the resource, normally it shouldn't restart the other resource.
-
function NeedMsg(p,n,getOwnedBy) if (n) then outputChatBox(unpack(messages[n])) end end --[[ ZONE CREATION ]]-- addEventHandler('onColShapeHit', pCuboid1, function(p) NeedMsg(p,6) local pTeam = getPlayerTeam( p ) if (not pTeam) then return end local teamName = getTeamName(pTeam) if (teamName == "Equipo2") then NeedMsg(p,1) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then elseif ( pTeam ) and ( teamName ) then else setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( p, 4000 ) NeedMsg(p,4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) end, 6000, 1 ) end else NeedMsg(p,3) end if (getPedOccupiedVehicle( p )) then NeedMsg(p,5) end end ) addEventHandler('onColShapeLeave', pCuboid1, function(p) setRadarAreaFlashing( pArea1, false ) if isTimer(capturing) then killTimer(capturing) end NeedMsg(p,7) end )
-
Just don't use XML or files and you will be fine. SQLite and MySQL are both perfect for a game-server. Just Google to find out their differences. Again, the internet. I also made a tutorial, might help: viewtopic.php?f=148&t=38203 For your other 2 questions, useful depends on what you need. And probably no one can tell you what the community needs, you just have to search for a good idea that wasn't made before.
-
Any errors in /debugscript 3? Where do you create the team? Before or after the resource is started?
-
The thing is (which I missed when I first posted) that you get the ground position of the current localPlayer's position, you then change it server-side so the original ground position (which is related to the localPlayer) is not the ground position of the ped's position.
-
Perhaps this will help: function haha() local x, y, z = getElementPosition(localPlayer) if math.random(1,2) == 1 then x = x + math.random(15,40) else x = x + math.random(-40,-15) end if math.random(1,2) == 1 then y = y + math.random(15,40) else y = y + math.random(-40,-15) end triggerServerEvent("makeped", root, x, y, getGroundPosition(x, y, z + 500)) end setTimer(haha,math.random(2000,5000),0) addEvent("makeped", true) function makeped (x, y, z) local ped = createPed (290, x, y, z+5, 0) setElementSyncer(ped, client) end addEventHandler("makeped", root, makeped)
-
Use [lua] tags and read this: viewtopic.php?f=91&t=47897
-
I remember doing something similar using getGroundPosition, it was also buggy and sometimes they would spawn underground. I think I fixed it by increasing the z coordinate so that's above the ground at all possible cases. Try this: function haha() local x, y, z = getElementPosition(localPlayer) triggerServerEvent("makeped", root, x, y, getGroundPosition(x, y, z + 500)) end setTimer(haha,math.random(2000,5000),0)
-
Are you talking about a single script file or a whole resource? In case it's a whole resource, just put the folder in your resources folder. MTA Folder/server/mods/deathmatch/resources/ You can then execute 'refresh' in the console to load the new resource, then 'start resourceName' to start it. If it's a single file, then you need to add the file name along with its type in meta.xml. <script src="script.lua" type="server"/> <script src="folder/scriptc.lua" type="client"/> Read more: https://wiki.multitheftauto.com/wiki/Resources https://wiki.multitheftauto.com/wiki/Meta.xml
-
This is not a forum for requests. Try something yourself first and then post for help.
-
One possible problem you have is that you use triggerClientEvent when the resource starts, this means that the event will not be triggered for whoever joins after the resource started. Also, it's wrong to send 'resourceRoot' as the baseElement for triggerClientEvent. It's recommended that you just use 'root' Also, you have attached the 'onResourceStart' event to 'getRootElement()', this means that any resource that starts will trigger the function. By replacing 'getRootElement()' with 'resourceRoot', the event will only be triggered when the actual resource starts. function barriernotbreakable() triggerClientEvent("setbarriernotbreakable",root,barrier) end addEventHandler("onResourceStart",resourceRoot,barriernotbreakable) function barriernotbrekableOnJoin() triggerClientEvent(source, "setbarriernotbreakable", root, barrier) end addEventHandler("onPlayerJoin", barriernotbreakableOnJoin)