Jump to content

I cant getelementposition


iFoReX

Recommended Posts

I've added something to set the skin when you write it:

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
originalPosition = { } 
  
GUIEditor_Window[1] = guiCreateWindow(0.3242,0.6933,0.3477,0.2316,"GUI Skins",true) 
GUIEditor_Label[1] = guiCreateLabel(101,28,214,18,"Aqui Pones la ID del skin que quieras",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Edit[1] = guiCreateEdit(21,25,75,30,"",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(21,66,111,32,"Comprar Skin",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(196,66,111,32,"Cancelar",false,GUIEditor_Window[1]) 
GUIEditor_Label[2] = guiCreateLabel(17,111,323,16,"El Costo de este Skin es el siguiente : 15000 ",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[2],255,255,0) 
guiSetFont(GUIEditor_Label[2],"default-bold-small") 
GUIEditor_Window[2] = guiCreateWindow(0.3594,0.295,0.291,0.2167,"GUI Confirmacion de Cambio de Skin",true) 
guiWindowSetMovable(GUIEditor_Window[2],false) 
guiWindowSetSizable(GUIEditor_Window[2],false) 
guiSetVisible( GUIEditor_Window[2], false) 
GUIEditor_Label[3] = guiCreateLabel(39,26,207,14,"Seguro que quieres cambiar tu skin ?",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[3],255,255,0) 
guiSetFont(GUIEditor_Label[3],"default-bold-small") 
GUIEditor_Button[3] = guiCreateButton(9,82,63,29,"Si",false,GUIEditor_Window[2]) 
GUIEditor_Button[4] = guiCreateButton(206,82,63,29,"No",false,GUIEditor_Window[2]) 
  
guiSetVisible( GUIEditor_Window[1], false) 
showCursor(false) 
------------------------------------ 
---TheMarker------------------------ 
marker = createMarker ( 1654.16162, -1661.63123, 21.9, "cylinder", 2, 100, 0, 255, 100 ) 
createBlipAttachedTo ( marker, 45 ) 
  
function warp ( ) 
    setElementPosition ( localPlayer, 1651, -1661.63123, 21.9 ) 
end 
addCommandHandler ( "setpos", warp ) 
------------------------------------ 
---TheFunctions--------------------- 
  
function markerHit ( hitPlayer ) 
    if ( hitPlayer == localPlayer and source == marker ) then 
        guiSetVisible ( GUIEditor_Window[1], true ) 
        showCursor ( true ) 
        triggerServerEvent ( "cm", getLocalPlayer() ) 
        setElementDimension( localPlayer, 2 ) 
        ped = createPed ( tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) or 0, 1654.16162, -1661.63123, 21.9 ) -- If no skin was given, it'll create it with CJ skin. 
        if ( ped ) then 
            setElementFrozen ( ped, true ) 
            setElementDimension( ped, 2 ) 
            setElementAlpha( localPlayer, 0 ) 
        end 
    end 
end 
addEventHandler ( "onClientMarkerHit", root, markerHit ) 
   
function botton ( ) 
    if source == GUIEditor_Button[2] then 
        originalPosition = { getElementPosition ( localPlayer ) } 
        guiSetVisible( GUIEditor_Window[1], false) 
        guiSetVisible( GUIEditor_Window[2], false) 
        showCursor(false) 
        setCameraTarget( localPlayer ) 
        setElementDimension( localPlayer, 0 ) 
        setElementFrozen ( localPlayer, false ) 
        setElementPosition ( localPlayer, unpack ( originalPosition ) ) 
        setElementAlpha ( localPlayer, 255 ) 
    elseif source == GUIEditor_Button[1] then 
        guiSetVisible( GUIEditor_Window[1], false) 
        guiSetVisible( GUIEditor_Window[2], true) 
        showCursor(true) 
    elseif source == GUIEditor_Button[4] then 
        guiSetVisible( GUIEditor_Window[1], true ) 
        guiSetVisible( GUIEditor_Window[2], false ) 
        showCursor(true) 
    elseif source == GUIEditor_Button[3] then 
        setCameraTarget( localPlayer ) 
        guiSetVisible( GUIEditor_Window[1], false ) 
        guiSetVisible( GUIEditor_Window[2], false ) 
        showCursor(false) 
        setElementDimension( localPlayer, 0 ) 
        setElementAlpha( localPlayer, 255 ) 
        local money = getPlayerMoney( localPlayer ) 
        if ( money >= 15000 ) then 
            triggerServerEvent("qtm", getLocalPlayer() ) 
            setElementModel( localPlayer, tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) ) 
        else 
            outputChatBox( " Para Comprarte este skin necesitas $15000 y tu dinero es ".. money .." " ) 
        end 
    end 
end 
addEventHandler ( "onClientGUIClick", root, botton ) 
  
addEventHandler ( "onClientGUIChanged", GUIEditor_Edit[1], 
    function ( ) 
        local skin = guiGetText ( source ) 
        if ( isElement ( ped ) ) then 
            setElementModel ( ped, tonumber ( skin ) or 0 ) 
        end 
    end 
) 
  
function destruir ( matchingDimension ) 
    if ( localPlayer and source == marker ) then 
        if isElement ( ped ) then  
            destroyElement ( ped ) 
        end 
    end 
end 
addEventHandler ( "onClientMarkerLeave", root, destruir ) 

Link to comment

That make's no sense, is just a random code.

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
originalPosition = { } 
rotation = 0 
  
GUIEditor_Window[1] = guiCreateWindow(0.3242,0.6933,0.3477,0.2316,"GUI Skins",true) 
GUIEditor_Label[1] = guiCreateLabel(101,28,214,18,"Aqui Pones la ID del skin que quieras",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Edit[1] = guiCreateEdit(21,25,75,30,"",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(21,66,111,32,"Comprar Skin",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(196,66,111,32,"Cancelar",false,GUIEditor_Window[1]) 
GUIEditor_Label[2] = guiCreateLabel(17,111,323,16,"El Costo de este Skin es el siguiente : 15000 ",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[2],255,255,0) 
guiSetFont(GUIEditor_Label[2],"default-bold-small") 
GUIEditor_Window[2] = guiCreateWindow(0.3594,0.295,0.291,0.2167,"GUI Confirmacion de Cambio de Skin",true) 
guiWindowSetMovable(GUIEditor_Window[2],false) 
guiWindowSetSizable(GUIEditor_Window[2],false) 
guiSetVisible( GUIEditor_Window[2], false) 
GUIEditor_Label[3] = guiCreateLabel(39,26,207,14,"Seguro que quieres cambiar tu skin ?",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[3],255,255,0) 
guiSetFont(GUIEditor_Label[3],"default-bold-small") 
GUIEditor_Button[3] = guiCreateButton(9,82,63,29,"Si",false,GUIEditor_Window[2]) 
GUIEditor_Button[4] = guiCreateButton(206,82,63,29,"No",false,GUIEditor_Window[2]) 
  
guiSetVisible( GUIEditor_Window[1], false) 
showCursor(false) 
------------------------------------ 
---TheMarker------------------------ 
marker = createMarker ( 1654.16162, -1661.63123, 21.9, "cylinder", 2, 100, 0, 255, 100 ) 
createBlipAttachedTo ( marker, 45 ) 
  
function warp ( ) 
    setElementPosition ( localPlayer, 1651, -1661.63123, 21.9 ) 
end 
addCommandHandler ( "setpos", warp ) 
------------------------------------ 
---TheFunctions--------------------- 
  
function markerHit ( hitPlayer ) 
    if ( hitPlayer == localPlayer and source == marker ) then 
        guiSetVisible ( GUIEditor_Window[1], true ) 
        showCursor ( true ) 
        removeEventHandler ( "onClientRender", root, rotateTempPed ) 
        triggerServerEvent ( "cm", getLocalPlayer() ) 
        setElementDimension( localPlayer, 2 ) 
        ped = createPed ( tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) or 0, 1654.16162, -1661.63123, 21.9 ) -- If no skin was given, it'll create it with CJ skin. 
        if ( ped ) then 
            addEventHandler ( "onClientRender", root, rotateTempPed ) 
            setElementFrozen ( ped, true ) 
            setElementDimension( ped, 2 ) 
            setElementAlpha( localPlayer, 0 ) 
        end 
    end 
end 
addEventHandler ( "onClientMarkerHit", root, markerHit ) 
  
function botton ( ) 
    if source == GUIEditor_Button[2] then 
        originalPosition = { getElementPosition ( localPlayer ) } 
        guiSetVisible( GUIEditor_Window[1], false) 
        guiSetVisible( GUIEditor_Window[2], false) 
        showCursor(false) 
        setCameraTarget( localPlayer ) 
        setElementDimension( localPlayer, 0 ) 
        setElementFrozen ( localPlayer, false ) 
        setElementPosition ( localPlayer, unpack ( originalPosition ) ) 
        setElementAlpha ( localPlayer, 255 ) 
    elseif source == GUIEditor_Button[1] then 
        guiSetVisible( GUIEditor_Window[1], false) 
        guiSetVisible( GUIEditor_Window[2], true) 
        showCursor(true) 
    elseif source == GUIEditor_Button[4] then 
        guiSetVisible( GUIEditor_Window[1], true ) 
        guiSetVisible( GUIEditor_Window[2], false ) 
        showCursor(true) 
    elseif source == GUIEditor_Button[3] then 
        setCameraTarget( localPlayer ) 
        guiSetVisible( GUIEditor_Window[1], false ) 
        guiSetVisible( GUIEditor_Window[2], false ) 
        showCursor(false) 
        setElementDimension( localPlayer, 0 ) 
        setElementAlpha( localPlayer, 255 ) 
        local money = getPlayerMoney( localPlayer ) 
        if ( money >= 15000 ) then 
            triggerServerEvent("qtm", getLocalPlayer() ) 
            setElementModel( localPlayer, tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) ) 
        else 
            outputChatBox( " Para Comprarte este skin necesitas $15000 y tu dinero es ".. money .." " ) 
        end 
    end 
end 
addEventHandler ( "onClientGUIClick", root, botton ) 
  
addEventHandler ( "onClientGUIChanged", GUIEditor_Edit[1], 
    function ( ) 
        local skin = guiGetText ( source ) 
        if ( isElement ( ped ) ) then 
            setElementModel ( ped, tonumber ( skin ) or 0 ) 
        end 
    end 
) 
  
function destruir ( matchingDimension ) 
    if ( localPlayer and source == marker ) then 
        if isElement ( ped ) then 
            destroyElement ( ped ) 
            removeEventHandler ( "onClientRender", root, rotateTempPed ) 
        end 
    end 
end 
addEventHandler ( "onClientMarkerLeave", root, destruir ) 
  
function rotateTempPed ( ) 
    if isElement ( ped ) then -- If the ped exists 
        rotation = rotation + 1 -- Increase the variable "rotation" by 1. 
        if ( rotation > 359 ) then -- If the rotation is higher to 359 
            rotation = 0 -- Set the rotation back to 0. 
        end 
  
        setPedRotation ( ped, rotation ) -- Set the ped rotation to variable "rotation". 
    end 
end 

This is the last thing I make for you, because I see that you're not really learning anything, you keep posting random code and ask for a fix.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...