Jump to content

Character system


Soren

Recommended Posts

  • Replies 110
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

sigue sin servir edikosh <.<

cl-side

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Grid = {} 
rotation = 0 
  
GUIEditor_Window[1] = guiCreateWindow(0.75,0,0.25,0.9967,"GUI IDs",true) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Label[1] = guiCreateLabel(25,28,113,21,"Escoge el ID ",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Grid[1] = guiCreateGridList(9,63,182,463,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
guiGridListAddColumn(GUIEditor_Grid[1],"ID",0.2) 
GUIEditor_Button[1] = guiCreateButton(10,532,181,37,"Empezar a Jugar",false,GUIEditor_Window[1]) 
  
GUIEditor_Window[2] = guiCreateWindow(0,0,0.245,0.4567,"GUI Seleccion",true) 
guiWindowSetMovable(GUIEditor_Window[2],false) 
guiWindowSetSizable(GUIEditor_Window[2],false) 
GUIEditor_Button[2] = guiCreateButton(23,36,57,31,"<",false,GUIEditor_Window[2]) 
GUIEditor_Button[3] = guiCreateButton(80,36,57,31,">",false,GUIEditor_Window[2]) 
GUIEditor_Label[2] = guiCreateLabel(27,78,100,22,"NameTag Color",false,GUIEditor_Window[2]) 
GUIEditor_Edit[1] = guiCreateEdit(65,98,61,23,"",false,GUIEditor_Window[2]) 
guiEditSetMaxLength(GUIEditor_Edit[1],3) 
GUIEditor_Label[3] = guiCreateLabel(52,101,9,15,"R",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[3],255,0,0) 
GUIEditor_Edit[2] = guiCreateEdit(65,123,61,23,"",false,GUIEditor_Window[2]) 
guiEditSetMaxLength(GUIEditor_Edit[2],3) 
GUIEditor_Label[4] = guiCreateLabel(52,127,9,15,"G",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[4],0,255,0) 
GUIEditor_Edit[3] = guiCreateEdit(65,147,61,23,"",false,GUIEditor_Window[2]) 
GUIEditor_Label[5] = guiCreateLabel(52,151,9,15,"B",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[5],0,0,255) 
GUIEditor_Label[6] = guiCreateLabel(9,189,83,17,"Nombre del ID",false,GUIEditor_Window[2]) 
GUIEditor_Edit[4] = guiCreateEdit(96,186,91,23,"",false,GUIEditor_Window[2]) 
GUIEditor_Button[4] = guiCreateButton(9,230,169,28,"Crear Personaje/ID",false,GUIEditor_Window[2]) 
  
guiSetVisible(GUIEditor_Window[1],false) 
guiSetVisible(GUIEditor_Window[2],false) 
showCursor(false) 
  
addEvent("onVisible",true) 
addEventHandler("onVisible", getLocalPlayer(),  
function() 
guiSetVisible(GUIEditor_Window[1],true) 
guiSetVisible(GUIEditor_Window[2],true) 
showCursor(true) 
triggerServerEvent("onCameraMatrix", getLocalPlayer()) 
ped = createPed( 0, -1586.671875, 1351.53125, 8.2823114395142 ) 
getSkin = getElementModel( ped ) 
end 
) 
  
addEventHandler("onClientGUIClick", root,  
function() 
if source == GUIEditor_Button[1] then 
guiSetVisible(GUIEditor_Window[1],false) 
guiSetVisible(GUIEditor_Window[2],false) 
showCursor(false) 
setElementPosition( localPlayer, 2580.7265625, 2328.77734375, 17.822208404541) 
setCameraTarget( localPlayer ) 
elseif source == GUIEditor_Button[2] then 
end 
end 
) 
  
function rotateTempPed ( ) 
    if isElement ( ped ) then 
        rotation = rotation + 1 
        if ( rotation > 359 ) then 
            rotation = 0 
        end 
  
        setPedRotation ( ped, rotation ) 
    end 
end 
addEvent("onRotatePed", true) 
addEventHandler("onRotatePed", root, rotateTempPed) 

sv-side

addEventHandler("onPlayerLogin", getRootElement(),  
function() 
triggerClientEvent(source,"onVisible",source) 
triggerClientEvent("onRotatePed", getRootElement()) 
end 
) 
  
addEvent("onCameraMatrix", true) 
addEventHandler("onCameraMatrix", getRootElement(),  
function() 
setCameraMatrix( source, -1570.66796875, 1358.087890625, 11.218300819397, -1586.671875, 1351.53125, 8.2823114395142 ) 
end 
) 

-.-

Link to comment

ya ta funcionando *-*

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Grid = {} 
rotation = 0 
  
GUIEditor_Window[1] = guiCreateWindow(0.75,0,0.25,0.9967,"GUI IDs",true) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Label[1] = guiCreateLabel(25,28,113,21,"Escoge el ID ",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Grid[1] = guiCreateGridList(9,63,182,463,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
guiGridListAddColumn(GUIEditor_Grid[1],"ID",0.2) 
GUIEditor_Button[1] = guiCreateButton(10,532,181,37,"Empezar a Jugar",false,GUIEditor_Window[1]) 
  
GUIEditor_Window[2] = guiCreateWindow(0,0,0.245,0.4567,"GUI Seleccion",true) 
guiWindowSetMovable(GUIEditor_Window[2],false) 
guiWindowSetSizable(GUIEditor_Window[2],false) 
GUIEditor_Button[2] = guiCreateButton(23,36,57,31,"<",false,GUIEditor_Window[2]) 
GUIEditor_Button[3] = guiCreateButton(80,36,57,31,">",false,GUIEditor_Window[2]) 
GUIEditor_Label[2] = guiCreateLabel(27,78,100,22,"NameTag Color",false,GUIEditor_Window[2]) 
GUIEditor_Edit[1] = guiCreateEdit(65,98,61,23,"",false,GUIEditor_Window[2]) 
guiEditSetMaxLength(GUIEditor_Edit[1],3) 
GUIEditor_Label[3] = guiCreateLabel(52,101,9,15,"R",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[3],255,0,0) 
GUIEditor_Edit[2] = guiCreateEdit(65,123,61,23,"",false,GUIEditor_Window[2]) 
guiEditSetMaxLength(GUIEditor_Edit[2],3) 
GUIEditor_Label[4] = guiCreateLabel(52,127,9,15,"G",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[4],0,255,0) 
GUIEditor_Edit[3] = guiCreateEdit(65,147,61,23,"",false,GUIEditor_Window[2]) 
GUIEditor_Label[5] = guiCreateLabel(52,151,9,15,"B",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[5],0,0,255) 
GUIEditor_Label[6] = guiCreateLabel(9,189,83,17,"Nombre del ID",false,GUIEditor_Window[2]) 
GUIEditor_Edit[4] = guiCreateEdit(96,186,91,23,"",false,GUIEditor_Window[2]) 
GUIEditor_Button[4] = guiCreateButton(9,230,169,28,"Crear Personaje/ID",false,GUIEditor_Window[2]) 
  
guiSetVisible(GUIEditor_Window[1],false) 
guiSetVisible(GUIEditor_Window[2],false) 
showCursor(false) 
  
addEvent("onVisible",true) 
addEventHandler("onVisible", getLocalPlayer(),  
function() 
guiSetVisible(GUIEditor_Window[1],true) 
guiSetVisible(GUIEditor_Window[2],true) 
showCursor(true) 
triggerServerEvent("onCameraMatrix", getLocalPlayer()) 
ped = createPed( 0, -1586.671875, 1351.53125, 8.2823114395142 ) 
end 
) 
  
addEventHandler("onClientGUIClick", root,  
function() 
if source == GUIEditor_Button[1] then 
guiSetVisible(GUIEditor_Window[1],false) 
guiSetVisible(GUIEditor_Window[2],false) 
showCursor(false) 
setElementPosition( localPlayer, 2580.7265625, 2328.77734375, 17.822208404541) 
setCameraTarget( localPlayer ) 
elseif source == GUIEditor_Button[2] then 
end 
end 
) 
  
function rotateTempPed ( ) 
    if isElement ( ped ) then 
        rotation = rotation + 1 
        if ( rotation > 359 ) then 
            rotation = 0 
        end 
  
        setPedRotation ( ped, rotation ) 
    end 
end 
addEventHandler("onClientRender", root, rotateTempPed) 

addEventHandler("onPlayerLogin", getRootElement(),  
function() 
triggerClientEvent(source,"onVisible",source) 
end 
) 
  
addEvent("onCameraMatrix", true) 
addEventHandler("onCameraMatrix", getRootElement(),  
function() 
setCameraMatrix( source, -1570.66796875, 1358.087890625, 11.218300819397, -1586.671875, 1351.53125, 8.2823114395142 ) 
end 
) 

ahora faltan los 2 jodidos botones :/

Link to comment

sv-side

addEventHandler("onPlayerLogin", getRootElement(), 
function() 
triggerClientEvent(source,"onVisible",source) 
triggerClientEvent(source, "onRotatePed", source) 
end 
) 
  
addEvent("onCameraMatrix", true) 
addEventHandler("onCameraMatrix", getRootElement(), 
function() 
setCameraMatrix( source, -1570.66796875, 1358.087890625, 11.218300819397, -1586.671875, 1351.53125, 8.2823114395142 ) 
end 
) 

Oye el mota, en tu tienda de skins se vei cuando estaba elijiendo el skin? osea cuando estaba viendo los skins y le picaba para ver se cambiaba el skind del ped?

Si si lo hacia puede sernos util esa funcion

Edited by Guest
Link to comment

Ya ta funcionando soren le puse onClientRender y que al precionar el boton empezar a jugar se destruyera el ped porque se puede hacer colapso de peds hehe, ahora faltan los 2 botones :/

Si pero el otro no era con botones era con un edit y al poner el ID se iba cambiando el skin con un

            setElementModel( localPlayer, tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) ) 

:/

Link to comment

Lo se pero se necesita algo para que si al precionar el boton se balla cambiando el skin :/ algo en ipairs o algo asi

ya estoy asiendo lo del nametag pero no me funciona :/ solo se cambia en el scoreboard no en realidad :/

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Grid = {} 
rotation = 0 
  
GUIEditor_Window[1] = guiCreateWindow(0.75,0,0.25,0.9967,"GUI IDs",true) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Label[1] = guiCreateLabel(25,28,113,21,"Escoge el ID ",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Grid[1] = guiCreateGridList(9,63,182,463,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
guiGridListAddColumn(GUIEditor_Grid[1],"ID",0.2) 
GUIEditor_Button[1] = guiCreateButton(10,532,181,37,"Empezar a Jugar",false,GUIEditor_Window[1]) 
  
GUIEditor_Window[2] = guiCreateWindow(0,0,0.245,0.4567,"GUI Seleccion",true) 
guiWindowSetMovable(GUIEditor_Window[2],false) 
guiWindowSetSizable(GUIEditor_Window[2],false) 
GUIEditor_Button[2] = guiCreateButton(23,36,57,31,"<",false,GUIEditor_Window[2]) 
GUIEditor_Button[3] = guiCreateButton(80,36,57,31,">",false,GUIEditor_Window[2]) 
GUIEditor_Label[2] = guiCreateLabel(27,78,100,22,"NameTag Color",false,GUIEditor_Window[2]) 
GUIEditor_Edit[1] = guiCreateEdit(65,98,61,23,"",false,GUIEditor_Window[2]) 
guiEditSetMaxLength(GUIEditor_Edit[1],3) 
GUIEditor_Label[3] = guiCreateLabel(52,101,9,15,"R",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[3],255,0,0) 
GUIEditor_Edit[2] = guiCreateEdit(65,123,61,23,"",false,GUIEditor_Window[2]) 
guiEditSetMaxLength(GUIEditor_Edit[2],3) 
GUIEditor_Label[4] = guiCreateLabel(52,127,9,15,"G",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[4],0,255,0) 
GUIEditor_Edit[3] = guiCreateEdit(65,147,61,23,"",false,GUIEditor_Window[2]) 
GUIEditor_Label[5] = guiCreateLabel(52,151,9,15,"B",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[5],0,0,255) 
GUIEditor_Label[6] = guiCreateLabel(9,189,83,17,"Nombre del ID",false,GUIEditor_Window[2]) 
GUIEditor_Edit[4] = guiCreateEdit(96,186,91,23,"",false,GUIEditor_Window[2]) 
GUIEditor_Button[4] = guiCreateButton(9,230,169,28,"Crear Personaje/ID",false,GUIEditor_Window[2]) 
  
guiSetVisible(GUIEditor_Window[1],false) 
guiSetVisible(GUIEditor_Window[2],false) 
showCursor(false) 
  
addEvent("onVisible",true) 
addEventHandler("onVisible", getLocalPlayer(),  
function() 
guiSetVisible(GUIEditor_Window[1],true) 
guiSetVisible(GUIEditor_Window[2],true) 
showCursor(true) 
triggerServerEvent("onCameraMatrix", getLocalPlayer()) 
ped = createPed( 0, -1586.671875, 1351.53125, 8.2823114395142 ) 
end 
) 
  
addEventHandler("onClientGUIClick", root,  
function() 
if source == GUIEditor_Button[1] then 
guiSetVisible(GUIEditor_Window[1],false) 
guiSetVisible(GUIEditor_Window[2],false) 
showCursor(false) 
setElementPosition( localPlayer, 2580.7265625, 2328.77734375, 17.822208404541) 
destroyElement(ped) 
setCameraTarget( localPlayer ) 
setPlayerNametagColor ( localPlayer, tonumber ( guiGetText ( GUIEditor_Edit[1] ) ), tonumber ( guiGetText ( GUIEditor_Edit[2] ) ), tonumber ( guiGetText ( GUIEditor_Edit[3] ) ) ) 
end 
end 
) 
  
function rotateTempPed ( ) 
    if isElement ( ped ) then 
        rotation = rotation + 1 
        if ( rotation > 359 ) then 
            rotation = 0 
        end 
  
        setPedRotation ( ped, rotation ) 
    end 
end 
addEventHandler("onClientRender", root, rotateTempPed) 

:/

Link to comment

Bien mota, pusiste lo de clientRender PERO ahi vas a tener un error que solo no lo podes ver :

1) Si pones el clientRender abajo de la funcion, se lo va a ejecutar a todos . Pone adentro de la funcion "onVisible"

2) El ped lo van a ver todos, por lo cual vas a triggear un Server event con la funcion "setElementVisibleTo(player)"

Y lo de cambiar el skin, yo tengo un sistema parecido al que hacen por lo cual paso ese fragmento

  
numero = 0 
  
function on_pushButton_2_clicked(button,state) 
    if (button == "left" and state == "up") then 
    if(numero == 1) then return end 
    numero = numero - 1 
    setElementModel(thePed,numero) 
     
    end 
end 
  
function on_pushButton_3_clicked(button,state) 
    if (button == "left" and state == "up") then 
    if (numero == 200) then return end 
    numero = numero + 1 
    setElementModel(thePed,numero) 
    end 
end 
  
  

Fijate si te sirve

PD : Intenta aprender los conceptos con un poco mas de logica asi lo podes razonar con facilidad. Sino se te va a complicar realizar cosas con mas dificultad.

Edited by Guest
Link to comment
  
numero = 0 
  
function on_pushButton_2_clicked(button,state) 
    if (button == "left" and state == "up") then 
    if(numero == 1) then return end 
    numero = numero - 1 
    setElementModel(thePed,numero) 
    
    end 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[2], on_pushButton_2_clicked) 
  
function on_pushButton_3_clicked(button,state) 
    if (button == "left" and state == "up") then 
    if (numero == 200) then return end 
    numero = numero + 1 
    setElementModel(thePed,numero) 
    end 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[3], on_pushButton_3_clicked) 

bad argument SetElementModel

Link to comment

Ok ahora ya gira pero el problema es el gridlist ahora no se obtiene el texto aqui el codigo no me arroja ningun error el debug

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Grid = {} 
rotation = 0 
  
GUIEditor_Window[1] = guiCreateWindow(0.75,0,0.25,0.9967,"GUI IDs",true) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Label[1] = guiCreateLabel(25,28,113,21,"Escoge el ID ",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Grid[1] = guiCreateGridList(9,63,182,463,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
column = guiGridListAddColumn(GUIEditor_Grid[1],"ID",0.2) 
GUIEditor_Button[1] = guiCreateButton(10,532,181,37,"Empezar a Jugar",false,GUIEditor_Window[1]) 
  
GUIEditor_Window[2] = guiCreateWindow(0,0,0.245,0.4567,"GUI Seleccion",true) 
guiWindowSetMovable(GUIEditor_Window[2],false) 
guiWindowSetSizable(GUIEditor_Window[2],false) 
GUIEditor_Button[2] = guiCreateButton(23,36,57,31,"<",false,GUIEditor_Window[2]) 
GUIEditor_Button[3] = guiCreateButton(80,36,57,31,">",false,GUIEditor_Window[2]) 
GUIEditor_Label[2] = guiCreateLabel(27,78,100,22,"NameTag Color",false,GUIEditor_Window[2]) 
GUIEditor_Edit[1] = guiCreateEdit(65,98,61,23,"",false,GUIEditor_Window[2]) 
guiEditSetMaxLength(GUIEditor_Edit[1],3) 
GUIEditor_Label[3] = guiCreateLabel(52,101,9,15,"R",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[3],255,0,0) 
GUIEditor_Edit[2] = guiCreateEdit(65,123,61,23,"",false,GUIEditor_Window[2]) 
guiEditSetMaxLength(GUIEditor_Edit[2],3) 
GUIEditor_Label[4] = guiCreateLabel(52,127,9,15,"G",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[4],0,255,0) 
GUIEditor_Edit[3] = guiCreateEdit(65,147,61,23,"",false,GUIEditor_Window[2]) 
GUIEditor_Label[5] = guiCreateLabel(52,151,9,15,"B",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[5],0,0,255) 
GUIEditor_Label[6] = guiCreateLabel(9,189,83,17,"Nombre del ID",false,GUIEditor_Window[2]) 
GUIEditor_Edit[4] = guiCreateEdit(96,186,91,23,"",false,GUIEditor_Window[2]) 
GUIEditor_Button[4] = guiCreateButton(9,230,169,28,"Crear Personaje/ID",false,GUIEditor_Window[2]) 
  
guiSetVisible(GUIEditor_Window[1],false) 
guiSetVisible(GUIEditor_Window[2],false) 
showCursor(false) 
  
addEvent("onVisible",true) 
addEventHandler("onVisible", getLocalPlayer(),  
function() 
guiSetVisible(GUIEditor_Window[1],true) 
guiSetVisible(GUIEditor_Window[2],true) 
showCursor(true) 
guiSetInputMode("no_binds_when_editing") 
triggerServerEvent("onCameraMatrix", getLocalPlayer()) 
ped = createPed( 0, -1586.671875, 1351.53125, 8.2823114395142 ) 
end 
) 
  
addEventHandler("onClientGUIClick", root,  
function() 
if source == GUIEditor_Button[1] then 
guiSetVisible(GUIEditor_Window[1],false) 
guiSetVisible(GUIEditor_Window[2],false) 
showCursor(false) 
setElementPosition( localPlayer, 2580.7265625, 2328.77734375, 17.822208404541) 
destroyElement(ped) 
setCameraTarget( localPlayer ) 
setPlayerNametagColor ( localPlayer, tonumber ( guiGetText ( GUIEditor_Edit[1] ) ), tonumber ( guiGetText ( GUIEditor_Edit[2] ) ), tonumber ( guiGetText ( GUIEditor_Edit[3] ) ) ) 
end 
end 
) 
  
function rotateTempPed ( ) 
    if isElement ( ped ) then 
        rotation = rotation + 1 
        if ( rotation > 359 ) then 
            rotation = 0 
        end 
  
        setPedRotation ( ped, rotation ) 
    end 
end 
addEventHandler("onClientRender", root, rotateTempPed) 
  
  
  
numero = 0 
  
function on_pushButton_2_clicked(button,state) 
    if (button == "left" and state == "up") then 
    if(numero == 1) then return end 
    numero = numero - 1 
    setElementModel(ped,numero) 
    
    end 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[2], on_pushButton_2_clicked) 
  
function on_pushButton_3_clicked(button,state) 
    if (button == "left" and state == "up") then 
    if (numero == 200) then return end 
    numero = numero + 1 
    setElementModel(ped,numero) 
    end 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[3], on_pushButton_3_clicked) 
  
addEventHandler("onClientGUIClick", root,  
function() 
if source == GUIEditor_Button[4] then 
guiSetVisible(GUIEditor_Window[2],false) 
local getTheText = guiGetText(GUIEditor_Edit[2]) 
local row = guiGridListAddRow ( GUIEditor_Grid[1] ) 
guiGridListSetItemText(GUIEditor_Grid[1], row, column, getTheText, false, false) 
end 
end 
) 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...