TheHeadHunter Posted August 24, 2013 Share Posted August 24, 2013 Ok, so I've got this weird bug going, client-side. I've been trying to fix it myself, but nothing seems to do it. addEventHandler ( "openCharacterGUI", client, function () showCursor ( true ) guiSetVisible ( charWindow[1], true ) triggerServerEvent ( "getChars", client ) charPed = createPed ( 34, 0, 0, 0 ) setElementFrozen ( charPed, true ) setElementPosition ( charPed, 1254.7118, -1439.0953, 333.8233 ) setElementDimension ( charPed, 0 ) setElementInterior ( charPed, 0 ) setPedAnimation ( charPed, "ped", "IDLE_stance", -1 ) setElementRotation ( charPed, 0, 0, 0 ) setTimer ( function () localCharSkin = tonumber ( getElementModel ( charPed ) ) x,y,z = getElementPosition ( charPed ) setTimer ( function () outputChatBox ( "PedLoc: "..x..", "..y..", "..z ) end, 200, 10 ) if ( charPed ) then outputChatBox ( "char = true, "..tostring(charPed).." "..tostring(localCharSkin).." "..getElementInterior ( charPed).." "..getElementDimension(charPed).." "..getElementAlpha ( charPed ) ) else outputChatBox ( "char = false" ) end end, 100, 1 ) end ) Before you ask, yes, the "openCharacterGUI" event IS triggered, because the GUI does appear, and so does the cursor. The only thing that does not appear is the Ped. As you guys probably noticed, I've put in some debug messages to find out just what's wrong. And that's the point, nothing is wrong. According to the debug messages, which go: char = true, userdata: 000201E2 34 0 0 255 PedLoc: 1254.7117919922, -1439.0953369141, 333.82330322266 PedLoc: 1254.7117919922, -1439.0953369141, 333.82330322266 PedLoc: 1254.7117919922, -1439.0953369141, 333.82330322266 PedLoc: 1254.7117919922, -1439.0953369141, 333.82330322266 PedLoc: 1254.7117919922, -1439.0953369141, 333.82330322266 PedLoc: 1254.7117919922, -1439.0953369141, 333.82330322266 PedLoc: 1254.7117919922, -1439.0953369141, 333.82330322266 PedLoc: 1254.7117919922, -1439.0953369141, 333.82330322266 PedLoc: 1254.7117919922, -1439.0953369141, 333.82330322266 PedLoc: 1254.7117919922, -1439.0953369141, 333.82330322266 It's saying that yes, the ped exists. It's skin is 34, dimension is 0, interior is 0, it's Alpha is 255 and the location does not change at all. And yet, I see not ped. I've even taken a jetpack to the location the ped is suppose to be at, and it's not there. I've checked the central map coordinates, it wasn't there either. Finally, I decided that this script was basically turning into a "Where's Wally" game and came here for advice... Also, note, this IS part of a larger client-side script, but I have no reason to suspect anything else in there would be causing this. Link to comment
Sora Posted August 25, 2013 Share Posted August 25, 2013 did you try setting the x,y,z coordinates to 1254.7118, -1439.0953, 333.8233 before using setElementPosition ? also you have to know that the client element you added the event to is a server side predefined variable check :https://forum.multitheftauto.com/viewtopic.php?f=91&t=39678 try this addEvent("openCharacterGUI",true) addEventHandler ( "openCharacterGUI", root, function () showCursor ( true ) guiSetVisible ( charWindow[1], true ) triggerServerEvent ( "getChars", localPlayer ) charPed = createPed ( 34, 1254.7118, -1439.0953, 333.8233 ) setElementFrozen ( charPed, true ) --setElementPosition ( charPed, 1254.7118, -1439.0953, 333.8233 ) setElementDimension ( charPed, 0 ) setElementInterior ( charPed, 0 ) setPedAnimation ( charPed, "ped", "IDLE_stance", -1 ) setElementRotation ( charPed, 0, 0, 0 ) setTimer ( function () localCharSkin = tonumber ( getElementModel ( charPed ) ) x,y,z = getElementPosition ( charPed ) setTimer ( function () outputChatBox ( "PedLoc: "..x..", "..y..", "..z ) end, 200, 10 ) if ( charPed ) then outputChatBox ( "char = true, "..tostring(charPed).." "..tostring(localCharSkin).." "..getElementInterior ( charPed).." "..getElementDimension(charPed).." "..getElementAlpha ( charPed ) ) else outputChatBox ( "char = false" ) end end, 100, 1 ) end ) 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