marty000123 Posted April 15, 2017 Share Posted April 15, 2017 (edited) Problem 1: function getInMarker(hitElement, matchingDimension) local acc = getPlayerAccount(hitElement) if getAccountData(acc, "green") == true then triggerClientEvent("skin", hitElement) end if not getAccountData(acc, "green") == true then else outputChatBox("You're not with the Special Military Unit!", hitElement, 255, 0, 0) end end addEventHandler("onMarkerHit", marker1, getInMarker) My AccountData(acc, "green") is true. I made sure of that. Yet, it also gives the chatbox output. Why is that? Btw can u guys make it so when a vehicle enters the marker, nothing happens? I tried a few things but couldn't figure out how to do it. Problem 2: This problem occured to me, and a few others. To others, it didn't. Weird. After the player logs in, they can choose between a team and class. Normally they would spawn, but now they don't. They're stuck on a black screen, and if the mode Freeroam is on, all they can see is a sky (above the Mt Chilliad). To spawn, you have to click on F1, map, then double click somewhere. But normally, you should be able to just spawn when you enter the class panel. Some players are able to do it just this way, so I'm wondering why not us? I'm thinking this is a server problem as I'm not the only one. But what's weird is that when the player logged out at a certain spot, and when he logs back in, the player's blip is still at the old place. (Only when freeroam is on). There we are, problem number 3. Problem 3: When I change team and die, the blip doesn't change color. No warnings/errors. When I do /kill (simple script: function() killPlayer addcommandhandler kill), it gives a couple of warnings (the same time each time): playerblips.lua:66: Bad Argument @ getElementType expected element at argument 1 got boolean. I suspect this has something to do with problem 2, maybe the blip doesn't disappear on logout, or something goes wrong? As the blip stays at the location when the bug of problem 2 appears, on the location where the player logged out last time. Part of the script: function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do LINE 66= if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end Problem 4: I have a Skin Selector script. 6 buttons, 6 skins. If you click a button, a server-side script will be triggered. But for some reason, only one of those buttons work. Well, they all work as the gui disappears everytime someone clicks a button, but the skin actually changes on only one button and I have no idea why as I copy-pasted the same script, so it's weird that a random button works and the rest don't. For some strange :Oing reason, only the VIP skin change works.. Script: SERVER: function sergeant() setElementModel(source, 278) end addEventHandler ( "sergeant", getRootElement(), sergeant ) addEvent("sergeant", true) function commander() setElementModel(source, 279) end addEventHandler ( "commander", getRootElement(), commander ) addEvent("commander", true) function vip() setElementModel(source, 50) end addEventHandler ( "vip", getRootElement(), vip ) addEvent("vip", true) -- CLIENT: GUIEditor.button[3] = guiCreateButton(92, 227, 250, 83, "Male 2", false, GUIEditor.window[1]) GUIEditor.button[4] = guiCreateButton(448, 229, 271, 81, "V I P", false, GUIEditor.window[1]) GUIEditor.button[5] = guiCreateButton(91, 353, 251, 85, "Male 3", false, GUIEditor.window[1]) addEventHandler("onClientGUIClick",root, function() if source == GUIEditor.button[1] then triggerServerEvent("recruit", localPlayer) showCursor(false) guiSetVisible(GUIEditor.window[1], false) end if source == GUIEditor.button[2] then triggerServerEvent("commander", localPlayer) showCursor(false) guiSetVisible(GUIEditor.window[1], false) end if source == GUIEditor.button[3] then triggerServerEvent("soldier", localPlayer) showCursor(false) guiSetVisible(GUIEditor.window[1], false) end if source == GUIEditor.button[4] then triggerServerEvent("vip", localPlayer) showCursor(false) guiSetVisible(GUIEditor.window[1], false) end if source == GUIEditor.button[5] then triggerServerEvent("sergeant", localPlayer) showCursor(false) guiSetVisible(GUIEditor.window[1], false) end if source == GUIEditor.button[6] then triggerServerEvent("female", localPlayer) showCursor(false) guiSetVisible(GUIEditor.window[1], false) end if source == GUIEditor.button[7] then showCursor(false) guiSetVisible(GUIEditor.window[1], false) end end ) Edited April 15, 2017 by marty000123 Link to comment
FaydenFX. Posted April 15, 2017 Share Posted April 15, 2017 function getInMarker(player, dimension) if getElementType(player) == "player" and dimension then if source == marker1 then local account = getPlayerAccount(player) if getAccountData(account, "green") then triggerClientEvent(source, "skin", player) else outputChatBox("You're not with the Special Military Unit!", player, 255, 0, 0) end end end end addEventHandler("onMarkerHit", resourceRoot, getInMarker) Link to comment
Mr.Loki Posted April 15, 2017 Share Posted April 15, 2017 Problem 1: function getInMarker(hitElement, matchingDimension) if getElementType(hitElement) ~= "player" then return end local acc = getPlayerAccount(hitElement) if getAccountData(acc, "green") then -- no need to use "== true" unless you are looking for specific data triggerClientEvent("skin", hitElement) else outputChatBox("You're not with the Special Military Unit!", hitElement, 255, 0, 0) end end addEventHandler("onMarkerHit", marker1, getInMarker) Problem 2: Use debugscript before choosing your team it should show you the error Problem 4: try this --SERVER: function setSelectedSkin(skin) setElementModel(source, skin) end addEvent("onPlayerChooseSkin", true) addEventHandler ( "onPlayerChooseSkin", root, setSelectedSkin ) --CLIENT: addEventHandler("onClientGUIClick",GUIEditor.window[1],function() local skin = 0 if source == GUIEditor.button[1] then --skin = YOUR SKIN ID elseif source == GUIEditor.button[2] then skin = 279 elseif source == GUIEditor.button[3] then --skin = YOUR SKIN ID elseif source == GUIEditor.button[4] then skin = 50 elseif source == GUIEditor.button[5] then skin = 278 elseif source == GUIEditor.button[6] then --skin = YOUR SKIN ID elseif source == GUIEditor.button[7] then --skin = YOUR SKIN ID end showCursor(false) guiSetVisible(GUIEditor.window[1], false) triggerServerEvent("onPlayerChooseSkin", localPlayer) end) Link to comment
marty000123 Posted April 15, 2017 Author Share Posted April 15, 2017 Loki, Thanks for the problem 1 fix, it worked. Problem 4 fix didn't sadly. Problem 2: No errors/warnings/whatsoever. It appears that I actually spawn after login, but the screen stays black. It's like the camera+player position freezes. Because I can see the spawn protection gui on my screen, even tho it's all black. I can also scroll my weapons, as I can see it in my admin panel. But I can't hear my shooting, making me think that the camera is somewhere at the edge of the universe. Link to comment
Mr.Loki Posted April 15, 2017 Share Posted April 15, 2017 how do you spawn the player? Can u show that part of the code please? 1 Link to comment
marty000123 Posted April 15, 2017 Author Share Posted April 15, 2017 (edited) Spawn after login: function greenLogin() local acc = getPlayerAccount(source) if getAccountData(acc, "green") == true then setPlayerTeam(source, getTeamFromName("Special Military Unit")) spawnPlayer (source, 235.47963, 1872.47766, 11.46094, 180, 287, 0) triggerClientEvent("class", source) end end addEventHandler("onPlayerLogin", getRootElement(), greenLogin) (I have 3 scripts like this, one for the SMU team, and 2 other teams, but im not sure if thats relevant...) Edited April 15, 2017 by marty000123 Link to comment
Mr.Loki Posted April 15, 2017 Share Posted April 15, 2017 Sorry for late reply, add fadeCamera to the function. Link to comment
DarkChemical Posted April 16, 2017 Share Posted April 16, 2017 And also use setCameraTarget (if that's what it's called) on the player himself. Link to comment
marty000123 Posted April 16, 2017 Author Share Posted April 16, 2017 (edited) Works, thanks! Now could someone fix Problem 3 and 4? Update problem 3: The blip gives the error when u do /kill, and when u changeteam, the blip stays the same color. Edited April 16, 2017 by marty000123 Link to comment
marty000123 Posted April 16, 2017 Author Share Posted April 16, 2017 Problem 4 is also fixed, thx to everyone for ur input. Now can someone help me with the blip/marker prob? Link to comment
Mr.Loki Posted April 16, 2017 Share Posted April 16, 2017 Are you destroying the blip when a player dies? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now