Jump to content

Es Posible?


Alexs

Recommended Posts

Posted

Queria saber si es posible esto o si el "isObjectInACLGroup" esta mal o si esta mal el Cliente/Servidor, o algun problema, para saber si el script que tengo en mente es posible

function spawnmcc () 
local grupomcc = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if isObjectInACLGroup ("user."..grupomcc, aclGetGroup ( "MCC" ) ) 
then spawnPlayer (thePlayer, 0, 0, 5, 0, 204, 0, 0, MCC) 
end 
addEventHandler ( "onClientGUIClick", button1, spawnmcc, true ) 

Developer @ MYVAL

Posted
onClientGUIClick es un evento client side, y isObjectInACLGroup, aclGetGroup, spawnPlayer son funciones server side, tenes que usar triggerServerEvent.

Eso es capaz de hacer funcionar un ServerSide en un Client Side, o es para pasar informacion como hacer la parte de una funcion en un Server Side y la otra en el Client Side??

PD: Lamento preguntarte, pero me queda la duda con lo que muestra la wiki

PD2: Paso el onClientGuiClick al server side o los demas al client side?

Developer @ MYVAL

Posted

triggerServerEvent envia datos desde el client side al server side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)
triggerServerEvent envia datos desde el client side al server side.

Es decir que pongo el script en server side y con el trigger agrego el OnGuiClientClick?? :shock::?:?::?:

Edited by Guest

Developer @ MYVAL

Posted
alexs_steel al revez onclientguiclick es client-side

Este es el momento en que me confundo :S a ver, denme un momento, intento un ejemplo del script

Algo asi :?:

function spawnmcc () 
local grupomcc = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if triggerServerEvent (isObjectInACLGroup ("user."..grupomcc, triggerServerEvent( aclGetGroup ) ( "MCC" ) ) ) 
then triggerServerEvent (spawnPlayer (thePlayer, 0, 0, 5, 0, 204, 0, 0, MCC) ) 
end 
addEventHandler ( "onClientGUIClick", button1, spawnmcc, true ) 

PD: Soy yo o no tiene sentido :S

Developer @ MYVAL

Posted

Eso no tiene el menor sentido, enserio, ni estas pensando en lo que haces o que?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Eso no tiene el menor sentido, enserio, ni estas pensando en lo que haces o que?

No logro comprender el uso de

triggerServerEvent 

normalmente me guio en los Examples, pero ese que aparece ahi me confunde...

Developer @ MYVAL

Posted

El ejemplo de la wiki es muy facil, si no podes entender eso, pues te recomiendo que vuelvas a lo basico.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
El ejemplo de la wiki es muy facil, si no podes entender eso, pues te recomiendo que vuelvas a lo basico.

no, creo que ya comprendi, debo utilizar el

addEvent 

y agregar los eventos para luego usar el trigger

Developer @ MYVAL

Posted
El ejemplo de la wiki es muy facil, si no podes entender eso, pues te recomiendo que vuelvas a lo basico.

no, creo que ya comprendi, debo utilizar el

addEvent 

y agregar los eventos para luego usar el trigger

Te esta pasando lo que me ocurria a mi cuando empezaba a programar. Me queria adelantar a TODO.

Osea, vos no tenes que hacerlo de memoria. Pensa que es como la matematica, todo tiene su logica.

Fijate que todo son funciones y las funciones tienen variables como tambien no.

Hay una guia de LUA en español que explica perfectamente cada cosa. Asi que, te recomiendo que lo leas porque te ayuda mucho encerio.

http://www.lua.org/manual/5.1/es/manual.html

WRS( World Racing Server) [server] = 8%

Posted

Server-side:

function spawnmcc () 
local grupomcc = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if isObjectInACLGroup ("user."..grupomcc, aclGetGroup ( "MCC" ) ) 
then spawnPlayer (thePlayer, 0, 0, 5, 0, 204, 0, 0, MCC) 
end 
addEvent( "callingSpawn", true ) 
addEventHandler( "callingSpawn", getRootElement(), spawnmcc ) 

Client-side:

function callingSpawnmcc () 
    triggerServerEvent ( "callingSpawn", getLocalPlayer())  
end 
addEventHandler ( "onClientGUIClick", button1, callingSpawnmcc, true ) 

Posted
Server-side:
function spawnmcc () 
local grupomcc = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if isObjectInACLGroup ("user."..grupomcc, aclGetGroup ( "MCC" ) ) 
then spawnPlayer (thePlayer, 0, 0, 5, 0, 204, 0, 0, MCC) 
end 
addEvent( "callingSpawn", true ) 
addEventHandler( "callingSpawn", getRootElement(), spawnmcc ) 

Client-side:

function callingSpawnmcc () 
    triggerServerEvent ( "callingSpawn", getLocalPlayer())  
end 
addEventHandler ( "onClientGUIClick", button1, callingSpawnmcc, true ) 

Cercita pero seguro no sabes ni de donde salio "thePlayer"....

Al triggear hay dos variables obligatorias (el nombre del evento y el source del evento), y los optativos que son los argumentos opcionales.

function spawnmcc () 
local grupomcc = getAccountName ( getPlayerAccount ( source ) ) 
if isObjectInACLGroup ("user."..grupomcc, aclGetGroup ( "MCC" ) )then  
spawnPlayer (source, 0, 0, 5, 0, 204, 0, 0, MCC) 
end 
addEvent( "callingSpawn", true ) 
addEventHandler( "callingSpawn", getRootElement(), spawnmcc ) 

Client-side:

function callingSpawnmcc () 
    triggerServerEvent ( "callingSpawn", getLocalPlayer())  
end 
addEventHandler ( "onClientGUIClick", button1, callingSpawnmcc, true ) 

WRS( World Racing Server) [server] = 8%

Posted

Te falto un 'end' en el server side:

function spawnmcc ( ) 
    local grupomcc = getAccountName ( getPlayerAccount ( source ) ) 
    if isObjectInACLGroup ("user.".. grupomcc, aclGetGroup ( "MCC" ) )then 
        spawnPlayer ( source, 0, 0, 5, 0, 204, 0, 0, MCC ) 
    end 
end 
addEvent( "callingSpawn", true ) 
addEventHandler( "callingSpawn", getRootElement(), spawnmcc ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Te falto un 'end' en el server side:
function spawnmcc ( ) 
    local grupomcc = getAccountName ( getPlayerAccount ( source ) ) 
    if isObjectInACLGroup ("user.".. grupomcc, aclGetGroup ( "MCC" ) )then 
        spawnPlayer ( source, 0, 0, 5, 0, 204, 0, 0, MCC ) 
    end 
end 
addEvent( "callingSpawn", true ) 
addEventHandler( "callingSpawn", getRootElement(), spawnmcc ) 

Ouch, la verdad ni me habia fijado en los end :):)

WRS( World Racing Server) [server] = 8%

  • Recently Browsing   0 members

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