Jump to content

Character system


Soren

Recommended Posts

Posted

no :P ya lo solucione -.- tenia todo bueno pero abia puesto para obtener el edit 2 y era el 4 xDD epic fail error

ahora necesitamos tu ayuda edikosh necesitamos que crees la tabla sql con el skin y que se guarde en el row

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) 
showPlayerHudComponent ("radar",false) 
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 row = guiGridListAddRow ( GUIEditor_Grid[1] ) 
guiGridListSetItemText(GUIEditor_Grid[1], row, column, (guiGetText(GUIEditor_Edit[4])), false, false) 
end 
end 
) 

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 
) 

  • Replies 110
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted (edited)

Entonces :

  
function resourceStart() 
  
executeSQLQuery("CREATE TABLE IF NOT EXISTS personajes (ID STRING,Skin NUMBER,r NUMBER,g NUMBER,b NUMBER)") 
  
end 
addEventHandler("onResourceStart",root,resourceStart) 
  

Ahora vos hace el triggerServerEvent con los datos del skin

Edited by Guest
Posted

No soy el genio ni a palos jaja, pero necesito que vos trigges los datos del skin que eligio + el Color Tag para que los pueda insertar en una fila

PD : Cambie la estructura de la tabla

Posted

Liisto nose si sirva soy malo triggeando estas cosas :/

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) 
  
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) 
showPlayerHudComponent ("radar",false) 
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] ) ) ) 
showPlayerHudComponent ("radar",true) 
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 row = guiGridListAddRow ( GUIEditor_Grid[1] ) 
guiGridListSetItemText(GUIEditor_Grid[1], row, column, (guiGetText(GUIEditor_Edit[4])), false, false) 
end 
end 
) 
  
addEvent("onClientGetModel", true) 
addEventHandler("onClientGetModel", getLocalPlayer(),  
function() 
getElementModel(ped) 
end 
) 

sv-side

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 
) 
  
function resourceStart() 
triggerClientEvent("onClientGetModel", ped) 
  
executeSQLQuery("CREATE TABLE IF NOT EXISTS personajes (ID STRING,SkinUno NUMBER,SkinDos NUMBER,SkinTres NUMBER)") 
  
end 
addEventHandler("onResourceStart",root,resourceStart) 

Posted

Ahora me da la re paja sinceramente xD...porque tenes que triggear al server no agregar un evento porque si.

Igual lo de getElementModel(ped) esta bien porque es uno de los datos que te pedi, pero despues lo tenes que agregar como argumento en el evento triggeado.

Posted

en el CL o en el SV ?

addEvent("onClientGetModel", true) 
addEventHandler("onClientGetModel", getModel,  
function() 
getModel = getElementModel(ped) 
end 
) 

Posted

??

addEvent("onClientGetModel", true) 
addEventHandler("onClientGetModel", getLocalPlayer(), 
function() 
getModel = getElementModel(ped) 
end 
) 

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 
) 
  
function resourceStart() 
triggerClientEvent("onClientGetModel", getModel) 
  
executeSQLQuery("CREATE TABLE IF NOT EXISTS personajes (ID STRING,SkinUno NUMBER,SkinDos NUMBER,SkinTres NUMBER)") 
  
end 
addEventHandler("onResourceStart",root,resourceStart) 

Posted

No, haces cosas porque si chabon...es como queres mandar fruta para que lo haga pero bueno lo conseguiste :

  
function elBotonQueInicia() 
local getModel = getElementModel(ped) 
triggerServerEvent("guardandoDatos",localPlayer) 
end 
) 
  

Y LISTO POR HOY

Si queres experimentar, tenes que hacer que se inserte una fila de SQL

Posted
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 
) 
  
function resourceStart() 
triggerClientEvent("onClientGetModel", getModel) 
  
executeSQLQuery("CREATE TABLE IF NOT EXISTS personajes (ID STRING,SkinUno NUMBER,SkinDos NUMBER,SkinTres NUMBER)") 
end 
addEvent("guardandoDatos", true) 
addEventHandler("onResourceStart",root,resourceStart) 
addEventHandler("guardandoDatos",root,resourceStart) 

? no entiendo ni pito de SQL :/

Posted
INSERT INTO Store_Information (store_name, Sales, Date) 
VALUES ('Los Angeles', 900, '10-Jan-1999' 

store information = la tabla

sotre_names , Sales, Date = las Columnas

VALUES = los Valores a insertar ? asi es verdad ? o no ?

Posted (edited)

Pero ya la cree yo, no lo viste?

Igual no se como usar el executeSQLInsert, yo uso todo executeSQLQuery

EDIT : Igual creo que preguntaste por si necesitas tabla. De ese caso, si lo necesitas.

Edited by Guest
Posted

Estoy cansado hoy ...te digo el sistema

Vos creas una tabla con los datos del accountName (ID) , skin (SkinPed), numeroDelPersonaje(eso me olvide de ponerlo)

entonces , ponele que el chabon tenga que elegir el PJ al que spawnear...tonces :

Entonces pones :

SELECT * FROM personajes WHERE ID = '"..accountName.."' AND numeroDelPersonaje = '"..elNumeroPJ.."'")

El numero PJ seria que PJ eligio , osea el primero, segundo o tercero..

Y de ahi sacas una tabla que devuelve los datos.

Posted

Ok la ultima preguntita porq ai 3 variables SkinUno SkinDos SkinTres ?

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 
) 
  
function resourceStart() 
triggerClientEvent("onClientGetModel", getModel) 
  
executeSQLQuery("CREATE TABLE IF NOT EXISTS personajes (ID STRING,SkinUno NUMBER,SkinDos NUMBER,SkinTres NUMBER)") 
end 
addEvent("guardandoDatos", true) 
addEventHandler("onResourceStart",root,resourceStart) 
addEventHandler("guardandoDatos",root,resourceStart) 

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...