Jump to content

Jaysds1

Members
  • Posts

    4,961
  • Joined

  • Last visited

Everything posted by Jaysds1

  1. I'll help look into it. Since I was hosting some of those files on my site and dropbox...
  2. Uhmm, I swear he said to post bugs on the MTA Mantis.... Anyways, I've been using MTA 1.4 for my server development.
  3. I know, but that's why I told him to override the MTA function "getVehicleName", so when that function is called the function will loop through a table and get the replaced name for the vehicle.
  4. Your welcome, always here to help!
  5. Isn't that what you wanted? The function is triggered when a player tries to switch to a weapon; and in the function, if the player doesn't have the valid weapon that's not in the table then it switches the player weapon back to what they had before.
  6. Sick annual Motor JKL
  7. Well, of course you would need to create a script then make sure it starts when your server starts. And the only way to replace the vehicle names, is to override the MTA's "getVehicleName" function, then loop through a table and get the replaced name for the vehicle.
  8. try this: local guntable = { 23, 30, 32, 20, 9 } -- random id's function weaponDisable(preSlot) local weapon = getPedWeapon(localPlayer) if not guntable[weapon] then setPedWeaponSlot(localPlayer,preSlot) end end addEventHandler ("onClientPlayerWeaponSwitch",localPlayer, weaponDisable) --only trigger this event for local player
  9. Jaysds1

    Minor Bug

    try this: function onPlayerTargetA ( player ) if ( isPlayerInTeam ( source, "Police" ) ) then if ( isElement ( player ) and getElementType ( player ) == "player" ) then if ( not isPlayerInTeam ( player, "Police" ) ) then bindKey ( source, "N", "down",function() exports [ "TopBarChat" ] : sendClientMessage ( "You have given " .. getPlayerName ( player ) .. " a ticket , Wait for him to pay it", source, 255, 0, 0, true ) exports [ "TopBarChat" ] : sendClientMessage ( "You have gotten a ticket ! Press 'H' to pay it!", player, 255, 0, 0, true ) bindKey ( player, "H", "down", payTheTicket, source ) end) end end end end addEventHandler ( "onPlayerTarget", root, onPlayerTargetA ) function payTheTicket ( source, k, s, theCop ) if not theCop then return end givePlayerMoney ( theCop, 200 ) takePlayerMoney ( source, 200 ) setPlayerWantedLevel( source, 0 ) exports [ "TopBarChat" ] : sendClientMessage ( "The ticket has been paid by " .. getPlayerName ( source ), theCop, 255, 0, 0, true ) exports [ "TopBarChat" ] : sendClientMessage ( "You have paid the ticket to " .. getPlayerName ( theCop ), thePlayer, 255, 0, 0, true ) unbindKey ( source, k, s, payTheTicket ) end
  10. Oh ya, Damn, it's been a longtime since I scripted in MTA again... Sorry about that toxicsmoke11, Sasu is right.
  11. It changes the text only for you, no one else.
  12. Try this now: --Client function createwindow() if not guiGetVisible ( window1 ) then local playerTeam = getPlayerTeam ( localPlayer ) if getTeamName(playerTeam) == "Police" then guiSetVisible (window1, true) triggerServerEvent ( "setarrests", localPlayer, playerTeam) end else guiSetVisible (window1, false) end end addCommandHandler ( "pcomp", createwindow ) addEvent("getArrestData",true) function getArrestData(data) guiSetText ( arrests_lab2, data ) end addEventHandler("getArrestData",root,getArrestData) --Server function getdatas() local theAccount = getPlayerAccount ( source ) local getdata = getAccountData(theAccount, "Arrests.count") or "0" triggerClientEvent(client,"getArrestData",client,tostring(getdata)) end addEvent("setarrests", true) addEventHandler("setarrests", root, getdatas)
  13. Please use the LUA tags. Try this: local localPlayer = getLocalPlayer() local resX, resY = guiGetScreenSize() local startX = resX * (2 / 3) local startY = 0 local windowX = resX * (1 / 5) local windowY = resY local xml = xmlLoadFile("spawns.xml") -- open the XML file local cityNodes = xmlNodeGetChildren(xml) -- get all child nodes of the root node () local cities = {} -- create a new global variable to store the welcome messages local GUIEditor_Window = {} local GUIEditor_Button = {} local GUIEditor_Memo = {} local GUIEditor_Label = {} for i,node in ipairs(cityNodes) do cityname = xmlNodeGetAttribute(node, "name") local classnodes = xmlNodeGetChildren(node) cities[cityname] = {} for i2,node2 in ipairs(classnodes) do classname = xmlNodeGetAttribute(node2, "name") local spawnnodes = xmlNodeGetChildren(node2) cities[cityname][classname] = {} for i3, node3 in ipairs(spawnnodes) do skinName = xmlNodeGetAttribute(node3, "name") cities[cityname][classname][skinName] = {} cities[cityname][classname][skinName]["spawnX"] = xmlNodeGetAttribute(node3, "spawnX") cities[cityname][classname][skinName]["spawnY"] = xmlNodeGetAttribute(node3, "spawnY") cities[cityname][classname][skinName]["spawnZ"] = xmlNodeGetAttribute(node3, "spawnZ") cities[cityname][classname][skinName]["r"] = xmlNodeGetAttribute(node3, "r") cities[cityname][classname][skinName]["g"] = xmlNodeGetAttribute(node3, "g") cities[cityname][classname][skinName]["b"] = xmlNodeGetAttribute(node3, "b") local skinNodes = xmlNodeGetChildren(node3) cities[cityname][classname][skinName]["skins"] = {} for i4, node4 in ipairs(skinNodes) do local skinID = xmlNodeGetValue(node4) table.insert(cities[cityname][classname][skinName]["skins"], skinID) end cities[cityname][classname][skinName]["permission"] = xmlNodeGetAttribute(node3, "lock") cities[cityname][classname][skinName]["information"] = xmlNodeGetAttribute(node3, "information") cities[cityname][classname][skinName]["weapons"] = xmlNodeGetAttribute(node3, "weapons") end end end xmlUnloadFile(xml) function setCamera() setCameraMatrix(1192.3686523438, -2036.3634033203, 69.235496520996, 1191.3736572266, -2036.330078125, 69.141883850098, 0, 70) end function wastedScreenFix() guiSetVisible(GUIEditor_Window[1], true) end ---------------------------------------------- wasted selection GUI function drawWastedSelection() --Make vars cost = math.random(50,5000) --Make GUI GUIEditor_Window[1] = guiCreateWindow(0.25,0.8,0.5,0.3,"EmpireRPG - Spawn",true) guiWindowSetMovable(GUIEditor_Window[1], false) guiWindowSetSizable(GUIEditor_Window[1], false) GUIEditor_Button[2] = guiCreateButton(0.2,0.3,0.6,0.2,"Return to the spawn menu",true,GUIEditor_Window[1]) --GUIEditor_Label[4] = guiCreateLabel(0.2,0.2,0.6,0.2,"(c)EmpireRPG",true,GUIEditor_Window[1]) showCursor(true) --Button Handlers addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onHospitalbuttonclick ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], drawSpawnScreen ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], hidewastedscreen ) --Make GUI Visable guiSetVisible(GUIEditor_Window[1], false) --Wasted Screen Camera --local ,yD,zD = getElementPosition( source ) --setCameraMatrix(,yD,zD-1,,yD,zD+1,90,110) -- attach camera to players face --fadeCamera( false, 5, 119,0,0 ) --Wasted Screen Sound local sound = playSound("client/wasted.mp3",false) setSoundVolume(sound, 0.75) --Draw GUI setTimer(wastedScreenFix,500,1) end function onHospitalbuttonclick() if source == GUIEditor_Button[1] then if getPlayerMoney(getLocalPlayer()) >= cost then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) triggerServerEvent("SPAWNATHOSIPTAL", getLocalPlayer() ) takePlayerMoney ( cost ) elseif getPlayerMoney(getLocalPlayer()) < cost then has = getPlayerMoney(getLocalPlayer()) take = has - cost --outputChatBox("You respawned at hospital") triggerEvent("SAVE:RPG:addMessage", localPlayer, "You have respawned at the hospital", 255, 0, 0) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) triggerServerEvent("SPAWNATHOSIPTAL", getLocalPlayer() ) takePlayerMoney ( cost ) else outputChatBox("An error occured.", 255, 0, 0) end end end function hidewastedscreen(button) if button == "left" then guiSetVisible(GUIEditor_Window[1], false) guiSetVisible(spawnWindow, true) end end -------------------------------------------- end wasted selection GUI function drawSpawnScreen() if ( spawnWindow or infoWindow ) then guiSetVisible(spawnWindow, false) guiSetVisible(infoWindow, false) end labels = {} spawnWindow = guiCreateWindow(0.005,0.395,0.5,0.6,"EmpireRPG Spawn Menu",true) guiWindowSetMovable(spawnWindow, false) guiWindowSetSizable(spawnWindow, false) infoWindow = guiCreateWindow(0.005,0.265,0.5,0.125,"EmpireRPG Class Information",true) guiWindowSetMovable(infoWindow,false) guiWindowSetSizable(spawnWindow,false) infoMemo = guiCreateMemo(0.0243,0.1712,0.9533,0.7534,"This server is ran by the Empire",true,infoWindow) guiMemoSetReadOnly(infoMemo, true) image = guiCreateStaticImage(0.0167,0.0387,0.975,0.225,"logo.png",true,spawnWindow) cityGridList = guiCreateGridList(0.025,0.27,0.455,0.5,true,spawnWindow) guiGridListSetSelectionMode(cityGridList,2) guiGridListAddColumn(cityGridList, "City", 0.82) classGridList = guiCreateGridList(0.52,0.27,0.455,0.3,true,spawnWindow) guiGridListSetSelectionMode(classGridList,2) guiGridListAddColumn(classGridList, "Team", 0.82) spawnGridList = guiCreateGridList(0.52,0.585,0.455,0.2995,true,spawnWindow) guiGridListSetSelectionMode(spawnGridList,2) guiGridListAddColumn(spawnGridList, "Class", 0.82) -- (LEFT RIGHT, UP DOWN, WIDTH,HEIGHT) skinPrevButton = guiCreateButton(0.55,0.9,0.125,0.25,"<-",true,spawnWindow) skinNextButton = guiCreateButton(0.82,0.9,0.125,0.25,"->",true,spawnWindow) guiSetProperty(skinPrevButton, "Disabled", "True") guiSetProperty(skinNextButton, "Disabled", "True") skinNumberLabel = guiCreateLabel(0.599,0.925,0.3058,0.0326,"1",true,spawnWindow) guiLabelSetVerticalAlign(skinNumberLabel,"center") guiLabelSetHorizontalAlign(skinNumberLabel,"center",false) spawnScreenOKButton = guiCreateButton(0.025,0.8,0.455,0.6,"Spawn",true,spawnWindow) guiSetProperty(spawnScreenOKButton, "Disabled", "True") for n, v in pairs(cities) do local row = guiGridListAddRow(cityGridList) guiGridListSetItemText(cityGridList, row, 1, n, false, false) end addEventHandler("onClientGUIClick", cityGridList, onCityClick) addEventHandler("onClientGUIClick", classGridList, onClassClick) addEventHandler("onClientGUIClick", spawnGridList, onSkinClick) addEventHandler("onClientGUIClick", spawnScreenOKButton, onSpawnButtonClick) addEventHandler("onClientGUIClick", skinPrevButton, onPrevSkin) addEventHandler("onClientGUIClick", skinNextButton, onNextSkin) fadeCamera(true) setCamera() guiSetVisible(spawnWindow, true) --guiGridListSetSelectedItem(spawnGridList, -1, 0) showCursor(true) end function onCityClick(button) if source == cityGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 then guiGridListClear(classGridList) local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text local cityClasses = cities[cityName] for x, y in pairs(cityClasses) do local row = guiGridListAddRow(classGridList) guiGridListSetItemText(classGridList, row, 1, x, false, false) end guiSetProperty(spawnScreenOKButton, "Disabled", "True") guiSetProperty(skinPrevButton, "Disabled", "True") guiSetProperty(skinNextButton, "Disabled", "True") guiSetText(skinNumberLabel, 1) unRenderSkin() end end end function onClassClick(button) if source == classGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(classGridList) > 0 then guiGridListClear(spawnGridList) local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text local selectedRow, selectedCol = guiGridListGetSelectedItem( classGridList ); -- get double clicked item in the gridlist local className = guiGridListGetItemText( classGridList, selectedRow, selectedCol ) -- get its text local classSkins = cities[cityName][className] for x, y in pairs(classSkins) do local row = guiGridListAddRow(spawnGridList) guiGridListSetItemText(spawnGridList, row, 1, x, false, false) end guiSetProperty(spawnScreenOKButton, "Disabled", "True") guiSetProperty(skinPrevButton, "Disabled", "True") guiSetProperty(skinNextButton, "Disabled", "True") guiSetText(skinNumberLabel, 1) unRenderSkin() end end end function onSkinClick(button) if source == spawnGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(classGridList) > 0 and guiGridListGetSelectedCount( spawnGridList ) > 0 then local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text
  14. Ghetto Christian Language DEF
  15. I don't see any problems. Can you post or PM me your full script please.
  16. Sorry, I misread the script... Try the code I've posted again.
  17. Is this the first time it happened?
  18. You don't need that "and" on line 5 try this: function forceRedirectPlayer(player,_, who) if not who then return end if hasObjectPermissionTo ( player, "function.banPlayer", true ) then who = getPlayerFromName(who) if who then redirectPlayer( who, "192.168.1.64", 22003 ) end else cancelEvent() outputChatBox("You cannot use that command.",player,255,0,0) end end addCommandHandler("freconnect",forceRedirectPlayer)
  19. Try the code above again. The only reason why you're getting that error is because the Account Data "Arrest.Count" is false, or doesn't exist, so I made the script return either the number of arrests or 0.
×
×
  • Create New...