Jump to content

DNL291

Retired Staff
  • Posts

    3,875
  • Joined

  • Days Won

    67

Everything posted by DNL291

  1. Where debugscript shows that error?
  2. If it's attached to a command handler then it should be as you said. But if it's a function to be called, my code is correct. Edit: Client: function createVehicleHandler(button,state) if button == "left" and state == "up" then local row,col = guiGridListGetSelectedItem(PCSgridlist) if row and col and row ~= -1 and col ~= -1 then local selected = tonumber(guiGridListGetItemText(PCSgridlist, row, col)) local rotz = getPedRotation(getLocalPlayer()) local x,y,z = getElementPosition(getLocalPlayer()) x = x y = y if selected and x and y and z then triggerServerEvent("createVehicleFromGUI",localPlayer,selected,x,y,z) guiSetVisible(windowPCS,false) showCursor(false,false) else outputChatBox("Invalid arguments.") end else outputChatBox("Please select a vehicle.") end end end Server: function createMyVehicle(vehicleid,x,y,z) -- check all the arguments exist if vehicleid and x and y and z then local Vehicle = createVehicle(vehicleid,x,y,z) warpPedIntoVehicle ( source, Vehicle ) end end addEvent("createVehicleFromGUI",true) addEventHandler("createVehicleFromGUI",root,createMyVehicle)
  3. function createMyVehicle(thePlayer,vehicleid,x,y,z) -- check all the arguments exist if vehicleid and x and y and z then local Vehicle = createVehicle(vehicleid,x,y,z) warpPedIntoVehicle ( thePlayer, Vehicle ) end end
  4. What do you mean by "use it as a command"?
  5. executeCommandHandler( "Nexus", source ) ?
  6. The window will not be shown to all players because it's clientside. But the window will be shown whenever he hits an marker.
  7. Open saver.lua in the weaponsaver resource and add this: addEventHandler( "onPlayerLogout", root, function() for slot = 0, 12 do local weapon = getPedWeapon ( source, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( source, slot ) if ( ammo > 0 ) then playerWeapons [ source ] [ weapon ] = ammo end end end end ) addEventHandler( "onPlayerLogin", root, function() if ( playerWeapons [ source ] ) then for weapon, ammo in pairs ( playerWeapons [ source ] ) do giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) ) end end playerWeapons [ source ] = nil end )
  8. No, it seems to be correct. I still didn't understand what you want to do.
  9. Any errors in debugscript? I see no error in the outputConsole function.
  10. Yes, use outputConsole ( accname ) if you want to output the player's account name.
  11. addEvent('Spawn',true) addEventHandler('Spawn',root, function() local account = getPlayerAccount(source) -- get account element from player element local accname = getAccountName(account) -- get account name from account element if isObjectInACLGroup("user."..accname,aclGetGroup("PCS")) then outputConsole ( "accname" ) end end ) Try it.
  12. accname already is returning the account name. As i said, replace getAccountName(accname) with accname variable.
  13. acc isn't defined. Replace getAccountName(acc) at line 6 with accname.
  14. Use guiSetVisible(myWindow, false) after the window is created with guiCreateWindow.
  15. local M4Pickup = { {4556,-5444.4333,4555}, {76789,-98766.766,8777}, } function SpawnPicks() if not pickup then local pickup = createPickup(M4Pickup[ math.random(1, #M4Pickup) ], 2, 31) addEventHandler( "onPickupHit", pickup, onPickupHit ) end end addEventHandler ( "onResourceStart", resourceRoot, SpawnPicks ) setTimer ( SpawnPicks, 480000, 0 ) function onPickupHit() if isElement(pickup) then destroyElement(pickup) end pickup = nil end Try it.
  16. function tilisiirto ( thePlayer, command, target, amount ) local target = getPlayerFromName ( target ) if ( target ) then if not (isGuestAccount (getPlayerAccount (thePlayer))) then if (getAccountData (getPlayerAccount (thePlayer), "nordea-cash")) then if (getAccountData (getPlayerAccount (thePlayer), "nordea-cash") >= tonumber (amount)) and (tonumber (amount) > 0) then local money = (tonumber(getAccountData (getPlayerAccount (thePlayer), "nordea-cash")) - tonumber (amount)) setAccountData (getPlayerAccount (thePlayer), "nordea-cash", tonumber(money)) givePlayerMoney (target, tonumber(amount)) outputChatBox ( tostring (amount) .. "$ nostettu tililtä, ja annettu pelaajaalle "..(target)..".", thePlayer, 0, 255, 0, false) outputChatBox ( tostring (amount) .. "$ Antoi sinulle pelaaja "..getPlayerName(thePlayer)..".", target, 0,255,0) else outputChatBox ("[Nordea]Et voi siirtää enempää mitä sinulla pankkitilillä on!", thePlayer, 255, 0, 0, false) end else outputChatBox ("[Nordea]Käyttäjä luotu!", thePlayer, 255, 0, 0, false) outputChatBox ("[Nordea]Pankki antaa sinulle 250$ tervetulolahjaksi!", thePlayer, 255, 0, 0, false) setAccountData (getPlayerAccount (thePlayer), "nordea-cash", 250) end end end end addCommandHandler("siirto", tilisiirto ) Try it.
  17. The 2nd parameter is the commandName. player playerSource, string commandName, [string arg1, string arg2, ...]
  18. I did not understand why you said "replace the model", it really confused me (the model in this case is the helmet (?)). Anyway sorry for the misunderstanding.
  19. No, he wants to replace it with another texture. @manve1: You can find the ID (or the name) on this page: https://wiki.multitheftauto.com/wiki/Cl ... ponent_IDs Example: txd = engineLoadTXD("textureName.txd") engineImportTXD( txd, 30403 )
  20. Because that code is clientside, if you want to show all players whenever any player to create an event, you can use triggerServerEvent or setElementData and put the player name who created the event, then add it in gridList with guiGridListAddRow and guiGridListSetItemText. Edit: addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor.button[1] ) then --triggerServerEvent ( "onCreateEvent", getRootElement(), localPlayer) setElementData(GUIEditor.gridlist[1], "curEventAuthor", getPlayerName(localPlayer)) end end ) addEvent("addNewRow") addEventHandler("addNewRow", root, function(playerName) local year = getRealTime()["year"] + 1900 local month = getRealTime()["month"] + 1 local monthday = getRealTime()["monthday"] local hour = getRealTime()["hour"] local minute = getRealTime()["minute"] local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, column, "["..hour..":"..minute.."-"..monthday.."."..month.."."..year.."] "..playerName.." created event ", false, false) end) addEventHandler( "onClientElementDataChange", root, function (dataName, oldValue) if (dataName == "curEventAuthor") then local playerName = getElementData(source, dataName) triggerEvent("addNewRow", root, playerName) end end ) local _setElementData = setElementData function setElementData(elem, theKey, value) if (theKey == "curEventAuthor") then if (getElementData(GUIEditor.gridlist[1], "curEventAuthor") == value) then triggerEvent("addNewRow", root, value) end end _setElementData(elem, theKey, value) end Try it.
  21. Try this: addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor.button[1] ) then triggerServerEvent ( "onCreateEvent", getRootElement(), localPlayer) local year = getRealTime()["year"] + 1900 local month = getRealTime()["month"] + 1 local monthday = getRealTime()["monthday"] local hour = getRealTime()["hour"] local minute = getRealTime()["minute"] row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText ( GUIEditor.gridlist[1], row, column, "["..hour..":"..minute.."-"..monthday.."."..month.."."..year.."] "..getPlayerName(localPlayer).." created event ", false, false ) end end )
  22. Use: guiGridListAddRow guiGridListSetItemText
×
×
  • Create New...