Jump to content

myonlake

Members
  • Posts

    2,312
  • Joined

  • Days Won

    41

Everything posted by myonlake

  1. myonlake

    Money...

    If you really have to keep your code client-side, then yes, use triggerServerEvent. If you can do the same code server-side, then do it server-side.
  2. This is used by all professional servers. There's simply no need to make multiple files instead of one.
  3. It won't remove the blood as long as I remember. Good idea but depends how much you use peds. They can make some clients crash/lag if using too many.
  4. Why use triggers when you can just set the lua file to both types: server, client. syncro_fixing/meta.xml <meta> <script src="exports.lua" type="server" /> <script src="exports.lua" type="client" /> <export function="gasmaskon" type="server" /> <export function="gasmaskon" type="client" /> </meta> You never returned a value. syncro_fixing/exports.lua function gasmaskon(player) return aPlayerCheck[player]["gasmask"]=true end s_gasmask.lua exports.syncro_fixing:gasmaskon(player)
  5. myonlake

    Help

    Use guiSetText to change the string value of a label.
  6. You make a new server file. 1. He has no single idea about servers 2. He has no single idea about scripting 3. It is not a server file, it's a lua file
  7. myonlake

    GUI Help

    It should open for one player only. It's client-side, you can't open it to all players however you wanted to. If you mean you want it to only show to an exact player name or team, then do.. getPlayerName getPlayerTeam getTeamName And such.
  8. myonlake

    Help

    It's very weird then. It should return their serial if the player is found with the exact name listed in the gridlist. If gridlist removes hex codes and the player uses hex codes anyway, it will mess up. I can give you a findPlayer function soon for no need for such exact matches.
  9. Oh god, no. Use addVehicleSirens.
  10. Oh god. Why do people use onResourceStart so much nowadays, completely waste of time. removeWorldModel doesn't require an event and as far as I know it doesn't work. You also should use this server-side of better synchronization.
  11. You can also use a timer to do this. setTimer
  12. myonlake

    Help

    getPlayerSerial() client-side only returns the client's serial, not the one's you want to know. However, guiSetText() doesn't work for grids as far as I know, you must use guiGridListSetItemText(). Use the code below, haven't tested it and I assume you have a player column in your gridlist and it is the first column? If yes, then it should work, if not, then change the columns in the below script. Client-side addEvent("onClientPlayerSerialFetched", true) addEventHandler("onClientPlayerSerialFetched", root, function(serial, row) guiGridListSetItemText(aGrid, row, 1, "Serial: " .. serial, false, false) end ) addEventHandler("onClientGUIClick", aGrid, function() local pRow = guiGridListGetSelectedItem(aGrid) if (pRow and pRow ~= -1) then triggerServerEvent("onClientPlayerSerialRequested", localPlayer, guiGridListGetItemText(aGrid, pRow, 1), pRow) end end ) Server-side addEvent("onClientPlayerSerialRequested", true) addEventHandler("onClientPlayerSerialRequested", root, function(player, row) if player and getPlayerFromName(player) then triggerClientEvent(source, "onClientPlayerSerialFetched", source, getPlayerSerial(getPlayerFromName(player)), row) else outputChatBox("DEBUG: 'onClientPlayerSerialRequested' returned false.", source, 245, 40, 40, false) end end )
  13. You want to color a GUI button? As far as I know I don't think it's possible. You need to use DX functions or something else, I am not sure how they do those colored buttons, I assume they use DX functions to print an image and then detect the click to do animations and such
  14. I don't think we understand your English right now Explain again, please.
  15. viewtopic.php?f=91&t=50113#p490260 Already fixed there.
  16. myonlake

    GUI Help

    Have to make sure you have also changed the last argument of the GUI functions.
  17. You don't necessarily need that event. Try this. createBlip(2491.2993164063, -1665.7626953125, 13.34375, 3) BorderControl = createTeam("Border Control", 0, 0, 255) Mexicans = createTeam("Mexicans", 255, 0, 0)
  18. I suggest not using his code since it is bugged, my code should be working correctly if you are set in "Mexicans" team via setPlayerTeam function. It won'y work if the name of the team is not "Mexicans". No problem though.
  19. Oh, cool. I didn't know about that issue since haven't been working with wanted levels lately Thanks for the info.
  20. Wrong a little. And it updates rarely so new players can't see the marker. addEventHandler("onPlayerSpawn", root, function() if getPlayerTeam(source) and getTeamName(getPlayerTeam(source)) == "Mexicans" then objectivemarker = createMarker(2491.2993164063, -1665.7626953125, 12.34375, "cylinder", 2.0, 255, 0, 0, 255, source) end end ) addEventHandler("onMarkerHit", objectivemarker, function(hitElement, matchingDimension) if getElementType(hitElement) == "player" and matchingDimension then outputChatBox("Mexicans have won!", root, 0, 255, 0, false) outputChatBox("Loading next round! Please wait...", root, 255, 180, 0, false) setTimer(function() for i,v in ipairs(getElementsByType("player")) do restartResource(getResourceFromName("Mexihunt")) restartResource(getResourceFromName("Teamblips")) spawnPlayer(v, 1544.4279785156, -1353.2464599609, 329.47442626953) end end, 5000, 1) end end )
  21. Check my code again by the way.
  22. You need to have the column set in the script as well Sorry for the new structure. I just like to do all scripts with my own layout style Server-side exports.scoreboard:scoreboardAddColumn("Wanted level") addEventHandler("onPlayerWasted", root, function(ammo, attacker, weapon, bodypart) if (attacker) and (attacker ~= source) then setPlayerWantedLevel(attacker, getPlayerWantedLevel(attacker)+1) setElementData(attacker, "Wanted level", tostring(getPlayerWantedLevel(attacker))) else setTimer(setPlayerWantedLevel, 60, 1, source, getPlayerWantedLevel(source)) end end ) EDIT: However, why do you use this even if you don't need it necessarily? setTimer(setPlayerWantedLevel, 60, 1, source, getPlayerWantedLevel(source)) It sets the same wanted level as the player has, doesn't make sense to me.
  23. myonlake

    GUI Help

    Using onPickupHit server-side may do some synchronization errors, experience tells, and it's a lot easier anyways. Server-side addEvent("killPlayer", true) addEventHandler("killPlayer", root, function() killPlayer(source) end ) Client-side local disk = createPickup(1685.6552734375, 993.8076171875, 10.8203125, 3, 1277) addEventHandler("onClientPickupHit", disk, function(hitElement, matchingDimension) if getElementType(hitElement) == "player" and matchingDimension then if not isElement(GUIEditor.window[1]) then GUIEditor = { gridlist = {}, button = {}, window = {}, } GUIEditor.window[1] = guiCreateWindow(56, 55, 680, 284, "", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(381, 46, 271, 58, "Kill Yourself!", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(381, 115, 271, 58, "Repair Car", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(381, 183, 271, 58, "Spawn Car", false, GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(37, 50, 316, 182, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Car NAme", 0.3) guiGridListAddColumn(GUIEditor.gridlist[1], "Damage", 0.3) guiGridListAddColumn(GUIEditor.gridlist[1], "Price To Repair", 0.3) addEventHandler("onClientGUIClick", GUIEditor.button[1], function() triggerServerEvent("killPlayer", localPlayer) destroyElement(GUIEditor.window[1]) showCursor(false) end ) showCursor(true) else guiBringToFront(GUIEditor.window[1]) end end end )
  24. Just got on my computer, your code was and is a mess. Try this. You need to be in the "Mexicans" team to make it work. If you don't have that team, then create it using createTeam. Server-side local objectivemarker = createMarker(2491.2993164063, -1665.7626953125, 12.34375, "cylinder", 2.0, 255, 0, 0, 255) addEventHandler("onMarkerHit", objectivemarker, function(hitElement, matchingDimension) if getElementType(hitElement) == "player" and matchingDimension then if getPlayerTeam(hitElement) == "Mexicans" then outputChatBox("Mexicans have won!", root, 0, 255, 0, false) outputChatBox("Loading next round! Please wait...", root, 255, 180, 0, false) setTimer(function() for i,v in ipairs(getElementsByType("player")) do restartResource(getResourceFromName("Mexihunt")) restartResource(getResourceFromName("Teamblips")) spawnPlayer(v, 1544.4279785156, -1353.2464599609, 329.47442626953) end end, 5000, 1) else outputChatBox("You aren't in the Mexicans team.", hitElement, 255, 0, 0, false) end end end )
×
×
  • Create New...