-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
alert1.mp3 esta en el meta.xml del recurso? P.D: playSound solo es client-side, asi que esta bien asi.
-
This may tell you what it does: http://lua-users.org/wiki/CoreFunctionsTutorial
-
Stop bumping old topics!
-
use triggerServerEvent to send data to the server side, and triggerClientEvent to send data to the client side.
-
What is that? you are messing client side with server side.....
-
Firstly, don't double-post, use the "EDIT" button. And, can you show me the script that has 'MAccount'?
-
Wrong client side. Police = createTeam("Police", 0, 0, 255) -- this will create the team everytime the teamMarker = createMarker(1553.33, -1677.37, 15, 'cylinder', 1.5, 0, 0, 255, 150 ) policeWindow = guiCreateWindow ( 0, 0, 0.5, 0.4, "Police Application",true) guiSetVisible ( policeWindow, false ) function teamMarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then if getPlayerTeam (hitElement) == Police then outputChatBox("Steven: You are already employed by this department.", hitElement) else guiSetVisible ( policeWindow, true ) setPlayerTeam ( hitElement, Police) setPlayerSkin( hitElement, 280) triggerServerEvent ("GiveWeapon", hitElement, hitElement) -- If you don't pass twice hitElement it won't work for server side: hitElement. end end end addEventHandler( "onClientMarkerHit", teamMarker , teamMarkerHit )
-
function binds() //The variable MAccount is represented in another script CName = getPlayerName(getLocalPlayer()) if ( MAccount == "Gen" ) then bindKey ( CName, "I", "down", build_MainWindow ) else if ( CName == "meep" ) then bindKey ( CName, "I" "down", build_MainWindow ) else end end end addEventHandler ("onClientResourceStart", getRootElement(), binds) function build_MainWindow() local gui = {} gui._placeHolders = {} local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 251, 174 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 gui["_root"] = guiCreateWindow(left, top, windowWidth, windowHeight, "MainWindow", false) guiWindowSetSizable(gui["_root"], false) gui["lineEdit"] = guiCreateEdit(70, 125, 161, 20, "", false, gui["_root"]) guiEditSetMaxLength(gui["lineEdit"], 32767) gui["pushButton"] = guiCreateButton(0, 35, 75, 23, "General", false, gui["_root"]) if on_pushButton_clicked then addEventHandler("onClientGUIClick", gui["pushButton"], General, false) end gui["pushButton_2"] = guiCreateButton(80, 35, 75, 23, "Coloniel", false, gui["_root"]) if on_pushButton_2_clicked then addEventHandler("onClientGUIClick", gui["pushButton_2"], Coloniel, false) end gui["pushButton_3"] = guiCreateButton(0, 65, 75, 23, "Recruit", false, gui["_root"]) if on_pushButton_3_clicked then addEventHandler("onClientGUIClick", gui["pushButton_3"], Recruit, false) end gui["pushButton_4"] = guiCreateButton(80, 65, 75, 23, "Private", false, gui["_root"]) if on_pushButton_4_clicked then addEventHandler("onClientGUIClick", gui["pushButton_4"], Private, false) end gui["pushButton_5"] = guiCreateButton(160, 35, 75, 23, "Sargent", false, gui["_root"]) if on_pushButton_5_clicked then addEventHandler("onClientGUIClick", gui["pushButton_5"], Sargent, false) end gui["pushButton_6"] = guiCreateButton(160, 65, 75, 23, "DrillSargent", false, gui["_root"]) if on_pushButton_6_clicked then addEventHandler("onClientGUIClick", gui["pushButton_6"], DrillSargent, false) end gui["pushButton_7"] = guiCreateButton(0, 95, 75, 23, "NationalGaurd", false, gui["_root"]) if on_pushButton_7_clicked then addEventHandler("onClientGUIClick", gui["pushButton_7"], NationalGaurd, false) end gui["pushButton_8"] = guiCreateButton(80, 95, 75, 23, "MilitaryScripter", false, gui["_root"]) if on_pushButton_8_clicked then addEventHandler("onClientGUIClick", gui["pushButton_8"], MilitaryScripter, false) end gui["pushButton_9"] = guiCreateButton(160, 95, 75, 23, "Remove", false, gui["_root"]) if on_pushButton_9_clicked then addEventHandler("onClientGUIClick", gui["pushButton_9"], Remove, false) end gui["label"] = guiCreateLabel(0, 15, 46, 13, "Options:", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label"], "left", false) guiLabelSetVerticalAlign(gui["label"], "center") gui["label_2"] = guiCreateLabel(0, 125, 71, 16, "AccountName:", false, gui["_root"]) guiLabelSetHorizontalAlign(gui["label_2"], "left", false) guiLabelSetVerticalAlign(gui["label_2"], "center") return gui, windowWidth, windowHeight end function General() -- You had a missing 'end' in this function. triggerServerEvent ("Gen", getLocalPlayer()) mtext = guiGetText ( editBoxgui["lineEdit"] ) end function Coloniel() triggerServerEvent ("Col", getLocalPlayer()) mtext = guiGetText ( gui["lineEdit"] ) end function Recruit() triggerServerEvent ("Rct", getLocalPlayer()) mtext = guiGetText ( gui["lineEdit"] ) end function Private() triggerServerEvent ("Pvt", getLocalPlayer()) mtext = guiGetText ( gui["lineEdit"] ) end function Sargent() triggerServerEvent ("Sgt", getLocalPlayer()) mtext = guiGetText ( gui["lineEdit"] ) end function DrillSargent() triggerServerEvent ("Dsgt", getLocalPlayer()) mtext = guiGetText ( gui["lineEdit"] ) end function NationalGaurd() triggerServerEvent ("Ng", getLocalPlayer()) mtext = guiGetText ( gui["lineEdit"] ) end function MilitaryScripter() triggerServerEvent ("Mscr", getLocalPlayer()) mtext = guiGetText ( gui["lineEdit"] ) end function Remove() triggerServerEvent ("Rem", getLocalPlayer()) mtext = guiGetText ( gui["lineEdit"] ) end Try that.
-
I think this is his profile: https://community.multitheftauto.com/index.php?p=profile&id=33540
-
door = createObject (2990, -9.0146484375, 2066.83203125, 20.4453125, 0, 0, 90) myMarker = createMarker ( -9.4607706069946, 2067.0712890625, 16.4921875, 'cylinder', 8.0, 0, 120, 225, 0 ) function markerHit (player) local theAccount = getPlayerAccount(player) if theAccount then local accountName = getAccountName(theAccount) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then moveObject ( door, 1500, -9.0146484375, 2056.33203125, 20.4453125 ) end end end addEventHandler ( "onMarkerHit", myMarker, markerHit ) function markerLeave (player) local theAccount = getPlayerAccount(player) if theAccount then local accountName = getAccountName(theAccount) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then moveObject ( door, 2990, -9.0146484375, 2066.83203125, 20.4453125 ) end end end addEventHandler ( "onMarkerLeave", myMarker, markerLeave )
-
addEvent ("Gen", true) addEvent ("Col", true) addEvent ("Rct", true) addEvent ("Pvt", true) addEvent ("Sgt", true) addEvent ("Dsgt", true) addEvent ("Ng", true) addEvent ("Mscr", true) addEvent ("Rem", true) local M1 = "Gen" local M2 = "Col" local M3 = "Rct" local M4 = "Pvt" local m5 = "Sgt" local m6 = "Dsgt" local M7 = "NG" local M8 = "Mscr" local M9 = "Banned" function Gen() MPlayeraccount = getPlayerAccount (source) MAccount = getAccountData ( MPlayeraccount, "mili.pos" ) setAccountData ( MPlayeraccount, "mili.pos", M1 ) end addEventHandler ("Gen", getRootElement(), Gen) function Col() MPlayeraccount = getPlayerAccount (source) MAccount = getAccountData ( MPlayeraccount, "mili.pos" ) setAccountData ( MPlayeraccount, "mili.pos", M2 ) end addEventHandler ("Col", getRootElement(), Col) function Rct() MPlayeraccount = getPlayerAccount (source) MAccount = getAccountData ( MPlayeraccount, "mili.pos" ) setAccountData ( MPlayeraccount, "mili.pos", M3 ) end addEventHandler ("Rct", getRootElement(), Rct) function Pvt() MPlayeraccount = getPlayerAccount (source) MAccount = getAccountData ( MPlayeraccount, "mili.pos" ) setAccountData ( MPlayeraccount, "mili.pos", M4 ) end addEventHandler ("Pvt", getRootElement(), Pvt) function Sgt() MPlayeraccount = getPlayerAccount (source) MAccount = getAccountData ( MPlayeraccount, "mili.pos" ) setAccountData ( MPlayeraccount, "mili.pos", M5 ) end addEventHandler ("Sgt", getRootElement(), Sgt) function Dsgt() MPlayeraccount = getPlayerAccount (source) MAccount = getAccountData ( MPlayeraccount, "mili.pos" ) setAccountData ( MPlayeraccount, "mili.pos", M6 ) end addEventHandler ("Dsgt", getRootElement(), Dsgt) function Ng() MPlayeraccount = getPlayerAccount (source) MAccount = getAccountData ( MPlayeraccount, "mili.pos" ) setAccountData ( MPlayeraccount, "mili.pos", M7 ) end addEventHandler ("Ng", getRootElement(), Ng) function Mscr() MPlayeraccount = getPlayerAccount (source) MAccount = getAccountData ( MPlayeraccount, "mili.pos" ) setAccountData ( MPlayeraccount, "mili.pos", M8 ) end addEventHandler ("Mscr", getRootElement(), Mscr) function Rem() MPlayeraccount = getPlayerAccount (source) MAccount = getAccountData ( MPlayeraccount, "mili.pos" ) setAccountData ( MPlayeraccount, "mili.pos", m9 ) end addEventHandler ("Rem", getRootElement(), Rem)
-
Well, you'll need to edit that script then.
-
Post your whole server side script, 2 lines won't help this time.
-
Can you post your code? this is only the map file.
-
See? you did what I told you not to... you only need one function. markers = {} markers[1] = createMarker(-303.26, 1601.41, 1054.69, 'cylinder', 2.0, 0, 0, 255, 150) markers[2] = createMarker(88.91, 2081.20, 16.78, 'cylinder', 2.0, 0, 0, 255, 150) --marker ID, ACL name, Team name, Skin, Weapon, Ammo. teamACL = { [1] = {"CIA","CIA",164,3,700}, [2] = {"LVarmy","Military",287,3,700}, } function onMarkerHitSetTeam(hitPlayer,matchingDimension) for i,v in pairs(markers) do if (source == v) then if getElementType(hitPlayer) == "player" and matchingDimension then local account = getPlayerAccount(hitPlayer) if not account then return end local accountName = getAccountName(account) if isObjectInACLGroup("user."..accountName,aclGetGroup(teamACL[i][1])) then setPlayerTeam(hitPlayer, getTeamFromName(teamACL[i][2])) giveWeapon(hitPlayer,teamACL[i][4],teamACL[i][5],true) setElementModel(hitPlayer,teamACL[i][3]) end end end end end addEventHandler("onMarkerHit",getRootElement(),onMarkerHitSetTeam)
-
Can you post here your FULL code? with CIA and Military.
-
Dude... you are using the same code for CIA, right? that's stupid and won't work, the point of my script is to make a GLOBAL team changer, so you just add markers[1], markers[2] and change teamACL table acording to the marker, ex: --marker ID, ACL name, Team name, Skin, Weapon, Ammo. teamACL = { [1] = {"CIA","CIA",164,3,700}, [2] = {"LVarmy","Military",287,3,700}, } The rest is already done by the script, nothing else is required.
-
It does change team, but you need to insert the EXACT team name in the table.
-
That's because forum has a bug with setPlayerTeam, copy the code again.
-
markers = {} markers[1] = createMarker(-303.26, 1601.41, 1054.69, 'cylinder', 2.0, 0, 0, 255, 150) --marker ID, ACL name, Team name, Skin, Weapon, Ammo. teamACL = { [1] = {"CIA","CIA Team",164,3,700}, } function onMarkerHitSetTeam(hitPlayer,matchingDimension) for i,v in pairs(markers) do if (source == v) then if getElementType(hitPlayer) == "player" and matchingDimension then local account = getPlayerAccount(hitPlayer) if not account then return end local accountName = getAccountName(account) if isObjectInACLGroup("user."..accountName,aclGetGroup(teamACL[i][1])) then setPlayerTeam(hitPlayer, getTeamFromName(teamACL[i][2])) giveWeapon(hitPlayer,teamACL[i][4],teamACL[i][5],true) setElementModel(hitPlayer,teamACL[i][3]) end end end end end addEventHandler("onMarkerHit",getRootElement(),onMarkerHitSetTeam)
-
giveWeapon is only server side.
-
markers = {} markers[1] = createMarker(-706, 966, 12, "cylinder", 1, 255, 255, 0, 200) markers[2] = createMarker(-709, 966, 12, "cylinder", 1, 255, 255, 0, 200) vehicles = { [1] = {"Civilian","411"}, [2] = {"Army","432"} } function onMarkerHitGiveVehicle(hitPlayer,matchingDimension) for i,v in pairs(markers) do if (source == v) then if getElementType(hitPlayer) == "player" and matchingDimension then local team = getPlayerTeam" class="kw2">getPlayerTeam(hitPlayer) if not team then return end local teamName = getTeamName(team) if vehicles[i][1] ~= teamName then return end local x, y, z = getElementPosition(hitPlayer) vehicle = createVehicle(vehicles[i][2],x,y,z) warpPedIntoVehicle(hitPlayer,vehicle) end end end end addEventHandler("onMarkerHit",getRootElement(),onMarkerHitGiveVehicle) Btw, next time try something by yourself first.
-
1): I don't think so, at least I don't know how to do that. 2): use the function warpPedIntoVehicle(element ped, element vehicle, int seat)
-
So you want to make like: marker1 = vehicle Infernus? and so on? If so, then use this. markers = {} markers[1] = createMarker(-706, 966, 12, "cylinder", 1, 255, 255, 0, 200) markers[2] = createMarker(-709, 966, 12, "cylinder", 1, 255, 255, 0, 200) vehicles = { [1] = "411", [2] = "432" } function onMarkerHitGiveVehicle(hitPlayer,matchingDimension) for i,v in pairs(markers) do if (source == v) then if getElementType(hitPlayer) == "player" and matchingDimension then local x, y, z = getElementPosition(hitPlayer) vehicle = createVehicle(vehicles[i],x,y,z) warpPedIntoVehicle(hitPlayer,vehicle) end end end end addEventHandler("onMarkerHit",getRootElement(),onMarkerHitGiveVehicle)
-
If i'm right, he's talking about Jaysds1.
