damien111
Members-
Posts
270 -
Joined
-
Last visited
Everything posted by damien111
-
I forgot to thank you!!!! Thanks so much!!!
-
Can someone re write this tutorial 4 me! And message me it. It would be greatley appreciated.
-
I am getting the hang of Lua but I need help on where to start on the wanted police system. Any links and helpnis greatly appreciated. Just gimme somestuff to look at that will help. Thx in advance
-
Hey! I didnt think of that can yu tell me how to use passwords now?
-
i have the same problem. i tryed both. i cant spawn as anything the screen gets black. you can checkout the server if you want to see what its doing. its ZomboTech: Cops|Mech| stuff like that
-
I added all that i needed. it worked with 1 but when i added more it didnt here is my code. g_root = getRootElement( ); classGroups = { }; addEvent( "spawn_clientRequestSpawn", true ); addEventHandler( "spawn_clientRequestSpawn", g_root, function( categoryIndex, classIndex, skinIndex ) if skinIndex then local class = classGroups[ categoryIndex ].classes[ classIndex ]; local skin = class.skinMngr.skins[ skinIndex ]; local spawn = true; local spawned; --[[if not classGroups[ cetegoryIndex ].owner then -- if there is NO owner of the clan/gang spawn player spawn = true; else -- if there IS owner of the clan/gang then check if he's member of the clan/gang end]] if ( skin.modelId == "165" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "SPECIALUNITS" ) ) ) then spawn = false if ( skin.modelId == "286" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "SPECIALUNITS" ) ) ) then spawn = false if ( skin.modelId == "285" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "SWAT" ) ) ) then spawn = false if ( skin.modelId == "287" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "MF" ) ) ) then spawn = false if ( skin.modelId == "312" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "MF" ) ) ) then spawn = false if ( skin.modelId == "294" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "SPECIALFORCES" ) ) ) then spawn = false if ( skin.modelId == "153" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "STAFF" ) ) ) then spawn = false if ( skin.modelId == "211" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "STAFF" ) ) ) then spawn = false if ( skin.modelId == "30" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "CLO" ) ) ) then spawn = false if ( skin.modelId == "122" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "NINJA" ) ) ) then spawn = false if ( skin.modelId == "29" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "SoA" ) ) ) then spawn = false if ( skin.modelId == "115" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "SoA" ) ) ) then spawn = false if ( skin.modelId == "165" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "MIB" ) ) ) then spawn = false if ( skin.modelId == "164" and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( client ) ), aclGetGroup ( "MIB" ) ) ) then spawn = false end if spawn then if not class.team then class.team = createTeam( class.name, class.color.red, class.color.green, class.color.blue ); end local plrTeam = getPlayerTeam( client ); if ( ( plrTeam ) and ( plrTeam ~= class.team ) and ( countPlayersInTeam( plrTeam ) == 1 ) ) then destroyElement( plrTeam ); end spawned = spawnPlayer( client, skin.spawnLoc.x, skin.spawnLoc.y, skin.spawnLoc.z, skin.spawnLoc.rot, skin.modelId, 0, 0, class.team ); end if spawned then setElementData( client, "team", class.name ) fadeCamera( client, true ); setCameraTarget( client, client ); setTimer( setCameraTarget, 200, 1, client, client ); triggerClientEvent( client, "spawn_SpawnedSuccessfully", client ); --setPlayerMoney( client, 500 ); for _, weapon in ipairs( class.weaponMngr.weapons ) do giveWeapon( client, weapon.id, weapon.ammo, false ); end createBlipAttachedTo( client, 0, 2, class.color.red, class.color.green, class.color.blue ) else triggerClientEvent( client, "spawn_FailedToSpawn", client ); if countPlayersInTeam( class.team ) == 0 then destroyElement( class.team ); class.team = nil; end end end end ); addEventHandler( "onPlayerSpawn", g_root, function ( ) end ); addEventHandler( "onPlayerWasted", g_root, function( ) fadeCamera( source, false, 4 ); setTimer( requestMenu, 5000, 1, source ); deleteAllPlayerBlips( source ) end ); function requestMenu( player ) callClientFunc( player, "showSpawnMenu", true, true ); callClientFunc( player, "classSelected" ); end addCommandHandler( "kill", function( plr ) killPed( plr ); end ) function preloadClassesInfo( ) local groups = getElementsByType( "category" ); for _, group in ipairs( groups ) do table.insert( classGroups, Group:New( group ) ); end end addEventHandler( "onResourceStart", getResourceRootElement(), preloadClassesInfo ) function deleteAllPlayerBlips(player) local elements = getAttachedElements(player) if (elements) then for i, element in ipairs(elements) do if (getElementType(element) == "blip") then destroyElement(element) end end end print( "number of players in team: " .. tostring( countPlayersInTeam( getPlayerTeam( player ) ) ) ); end addEventHandler( "onPlayerQuit", g_root, function() deleteAllPlayerBlips(source) end ); ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ function callClientFunc( player, funcName, ... ) if #{ ... } ~= 0 then triggerClientEvent( player, "_clientCallFunction", root, funcName, ... ) else triggerClientEvent( player, "_clientCallFunction", root, funcName ) end end addEvent( "_serverCallFunction", true ) addEventHandler( "_serverCallFunction", root, function( funcName, ... ) _G[ funcName ](...) end ) Also , how can i make it so it detects when someone cant spawn as the class and then displays a message box. or panel or something. ps- Thanks myonlake!
-
its just not restricting it but, ok. i didnt make it im trying to edit some stuff. Here is the basic thing im trying to do: http://www.mediafire.com/?rgzy53f0rdgt3tt i didnt make this but im gonna make it better, but i need to know hw to restrict it to teams/groups/acl's anything like that. i just need to restric them.
-
i was using it to learn, but now, i am trying to make it when a member from the mechanic am gets in a car with someone it fixs the car and deducts money and adds money to the mechanic
-
im new to this lua stuff, but i can code java script so i have a pretty good idea how stuff works. My Mechanic script creates a marker and a team. and when you are in the marker a GUI pops up. when you click the button it gives you a skin and switches your team. My medic script works the same way but gets a spray can that can heal with some other code. i am not sure how to make it when mechanic enters it fixes the car. heres my code atm. Mechanic-server.lua: function createMechanicTeam () MechanicTeam = createTeam ("Mechanic", 6, 183, 248) end addEventHandler ("onResourceStart", resourceRoot, createMechanicTeam) function joinMechanic() setPlayerTeam(source,MechanicTeam) setElementModel(source,268) setElementData( source, "Occupation", "Mechanic", true ) outputChatBox("You are now Mechanic.",source,0,255,0) end addEvent("setMechanic", true) addEventHandler("setMechanic",root,joinMechanic) addEvent("Mechanic:fixing", true) addEventHandler("Mechanic:fixing", root, function (Mechanic) if (getElementHealth(vechile) < 100) then fixVehicle(getPedOccupiedVehicle(getPlayerFromName(who))) --fixvechile if gets occupied if (VehHeal > 100) then setElementHealth(vechile, 100) end givePlayerMoney(Mechanic, 100) -- Gives 100$ to the Mechanic each time the function is executed takePlayerMoney(source, 100) -- Takes 100$ from the source when he get healed end end) mechanicj.lua: local marker = createMarker(1940.97, 2166.40, 10.82, "Cylinder", 2, 6, 183, 248, 153) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"Mechanic job") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,200,108,35,"Take job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,100,"To take Mechanic job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) guiEditSetReadOnly(GUIEditor_Memo[1],true) function Mechanicjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, Mechanicjob) function Mechanicjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, Mechanicjobleave) function joinTeam() triggerServerEvent("setMechanic",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeMechanicWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeMechanicWindow, false) addEventHandler("onClientPlayerDamage", localVechile, function(attacker, weapon, bodypart, loss) team = getPlayerTeam(attacker) if (attacker and getElementType(attacker) == "player" and weapon == 41 and team and getTeamName(team) == "Mechanic") then -- Checks if the player is using spray and is into Mechanic team cancelEvent() -- Cancels the damage cause by the spray if (not isTimer(pause)) then local health = getElementHealth(localVechile) if (health < 99) then triggerServerEvent("Mechanic:fixing", localVechile, attacker) -- Calls the Server Event pause = setTimer(function() end, 1000, 1) -- Makes a timer for the function so it won't fully heal in the first time end end end end) meta: "Damien" name="mechanic" version="0.1" type="script"/>
-
No it isnt. Sorry. I meant to post this yesterday. I have no debug errors but it is not locking the dam class. :C I will keep working but feel free to help(PLEASE)
-
AHA! I FIGURED IT OUT I added the acl/group in the in game manager, but not in acl.xml. Sorry for this. i hope you will forgive me for being so dumb.
-
ERROR:SPAWNTEST2/S_main.lua:19: attempt to concatenate a boolean value is what it gave me
-
Let me try again. i mightive clicked the wrong one they have sam name, one just has a 1 after it.
-
i did, i spawned as the class, SoT, and it came up with that error i did /debugscript 3, spawned, and it had that error. ill try again
-
nvm figured it out, this came up : SPAWNTEST\c_main.lua:28:addEventHandler:'onClientRender' with this function is already handled
-
I did the command now what
-
How to debug? is it like /debug script ZIPARCHIVENAME? or what
-
hahaha, Im almost positive. lemme check, ima be so stupid feeling if it isnt. Edit: Nope, its id 29, for the white drug dealer. https://wiki.multitheftauto.com/wiki/Skins_Page_1 the last one on that is my skin. Im stumped.
-
Thanks for replying so quicky! Its just not restricting it. i thought that would do it. but it didnt.
-
Restricting ALC Groups and Classes together is what i want. For invite only groups. But i cant figure it out. Heres my server side code which is all i edited. g_root = getRootElement( ); classGroups = { }; addEvent( "spawn_clientRequestSpawn", true ); addEventHandler( "spawn_clientRequestSpawn", g_root, function( categoryIndex, classIndex, skinIndex ) if skinIndex then local class = classGroups[ categoryIndex ].classes[ classIndex ]; local skin = class.skinMngr.skins[ skinIndex ]; local spawn = true; local spawned; --[[if not classGroups[ cetegoryIndex ].owner then -- if there is NO owner of the clan/gang spawn player spawn = true; else -- if there IS owner of the clan/gang then check if he's member of the clan/gang end]] if skin.modelId == 29 and not isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(client)), aclGetGroup ( "SoS" ) ) then spawn = false end if spawn then if not class.team then class.team = createTeam( class.name, class.color.red, class.color.green, class.color.blue ); end local plrTeam = getPlayerTeam( client ); if ( ( plrTeam ) and ( plrTeam ~= class.team ) and ( countPlayersInTeam( plrTeam ) == 1 ) ) then destroyElement( plrTeam ); end spawned = spawnPlayer( client, skin.spawnLoc.x, skin.spawnLoc.y, skin.spawnLoc.z, skin.spawnLoc.rot, skin.modelId, 0, 0, class.team ); end if spawned then setElementData( client, "team", class.name ) fadeCamera( client, true ); setCameraTarget( client, client ); setTimer( setCameraTarget, 200, 1, client, client ); triggerClientEvent( client, "spawn_SpawnedSuccessfully", client ); --setPlayerMoney( client, 500 ); for _, weapon in ipairs( class.weaponMngr.weapons ) do giveWeapon( client, weapon.id, weapon.ammo, false ); end createBlipAttachedTo( client, 0, 2, class.color.red, class.color.green, class.color.blue ) else triggerClientEvent( client, "spawn_FailedToSpawn", client ); if countPlayersInTeam( class.team ) == 0 then destroyElement( class.team ); class.team = nil; end end end end ); addEventHandler( "onPlayerSpawn", g_root, function ( ) end ); addEventHandler( "onPlayerWasted", g_root, function( ) fadeCamera( source, false, 4 ); setTimer( requestMenu, 5000, 1, source ); deleteAllPlayerBlips( source ) end ); function requestMenu( player ) callClientFunc( player, "showSpawnMenu", true, true ); callClientFunc( player, "classSelected" ); end addCommandHandler( "kill", function( plr ) killPed( plr ); end ) function preloadClassesInfo( ) local groups = getElementsByType( "category" ); for _, group in ipairs( groups ) do table.insert( classGroups, Group:New( group ) ); end end addEventHandler( "onResourceStart", getResourceRootElement(), preloadClassesInfo ) function deleteAllPlayerBlips(player) local elements = getAttachedElements(player) if (elements) then for i, element in ipairs(elements) do if (getElementType(element) == "blip") then destroyElement(element) end end end print( "number of players in team: " .. tostring( countPlayersInTeam( getPlayerTeam( player ) ) ) ); end addEventHandler( "onPlayerQuit", g_root, function() deleteAllPlayerBlips(source) end ); ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ function callClientFunc( player, funcName, ... ) if #{ ... } ~= 0 then triggerClientEvent( player, "_clientCallFunction", root, funcName, ... ) else triggerClientEvent( player, "_clientCallFunction", root, funcName ) end end addEvent( "_serverCallFunction", true ) addEventHandler( "_serverCallFunction", root, function( funcName, ... ) _G[ funcName ](...) end ) and the line i added is after line 18. its if skin.modelId == 29 and not isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(client)), aclGetGroup ( "SoS" ) ) then spawn = false end Im new to scripting but i know other langauges. Thanks in advance!