iFoReX Posted April 21, 2012 Author Share Posted April 21, 2012 for me doesnt Here an image Link to comment
Castillo Posted April 21, 2012 Share Posted April 21, 2012 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
iFoReX Posted April 21, 2012 Author Share Posted April 21, 2012 Thank you man very thank Now work 100%, now How I can set Rotation it Ped but I see slow Link to comment
Castillo Posted April 21, 2012 Share Posted April 21, 2012 You must use: setPedRotation. Link to comment
iFoReX Posted April 21, 2012 Author Share Posted April 21, 2012 Doesnt Work I dont view when the Ped is Rotating Link to comment
Castillo Posted April 21, 2012 Share Posted April 21, 2012 I don't understand what do you mean. Link to comment
iFoReX Posted April 21, 2012 Author Share Posted April 21, 2012 I want See the ped rotating in 360 ° slowly Link to comment
Castillo Posted April 21, 2012 Share Posted April 21, 2012 You want to slowly rotate the ped? Link to comment
iFoReX Posted April 21, 2012 Author Share Posted April 21, 2012 yeah , I want see when he is rotating Link to comment
Castillo Posted April 21, 2012 Share Posted April 21, 2012 Well, you could use onClientRender combined with getPedRotation, setPedRotation. Link to comment
iFoReX Posted April 21, 2012 Author Share Posted April 21, 2012 it is good or doesnt ? root = getRootElement () function pedr () setPedRotation ( ped, 180 ) end addEventHandler ( "onClientRender", root, pedr ) Link to comment
Castillo Posted April 21, 2012 Share Posted April 21, 2012 First line is useless. You should check if the ped exists, also, you're just setting the rotation to 180 always. Link to comment
iFoReX Posted April 21, 2012 Author Share Posted April 21, 2012 and now root = getRootElement () function pedr () if source == ped then setPedRotation ( 180 ) end addEventHandler ( "onClientRender", root, pedr ) Link to comment
Castillo Posted April 21, 2012 Share Posted April 21, 2012 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
Kenix Posted April 21, 2012 Share Posted April 21, 2012 and now root = getRootElement () function pedr () if source == ped then setPedRotation ( 180 ) end addEventHandler ( "onClientRender", root, pedr ) Omg .. Can you learn lua? 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