Mateito14 Posted October 13, 2015 Share Posted October 13, 2015 (edited) Hola, estuve haciendo para que en el chat aparezca la gang que eres y funciona, el problema es que si no eres de una gang aparece [None] y yo quiero que no aparezca nada . elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData(source, "level") local r, g, b = getPlayerNametagColor(source) local gang = exports.gang_system:getPlayerGang ( source) outputChatBox( "#FFFFFF["..gang.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text) Edited October 13, 2015 by Guest Link to comment
Enargy, Posted October 13, 2015 Share Posted October 13, 2015 elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData(source, "level") local r, g, b = getPlayerNametagColor(source) local gang = exports.gang_system:getPlayerGang ( source) local gangTag if ( gang ) then gangTag = gang outputChatBox( "#FFFFFF["..gangTag.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) else gangTag = "User" outputChatBox( "#FFFFFF["..gangTag.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) end outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text) Link to comment
Mateito14 Posted October 13, 2015 Author Share Posted October 13, 2015 elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData(source, "level") local r, g, b = getPlayerNametagColor(source) local gang = exports.gang_system:getPlayerGang ( source) local gangTag if ( gang ) then gangTag = gang outputChatBox( "#FFFFFF["..gangTag.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) else gangTag = "User" outputChatBox( "#FFFFFF["..gangTag.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) end outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text) No me funciono, gracias por responder . Link to comment
Enargy, Posted October 13, 2015 Share Posted October 13, 2015 elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData(source, "level") local r, g, b = getPlayerNametagColor(source) local gang = exports.gang_system:getPlayerGang ( source) local gangTag if ( gang ) then gangTag = gang outputChatBox( "#FFFFFF["..gangTag.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) else gangTag = "User" outputChatBox( "#FFFFFF["..gangTag.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) end outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text) No me funciono, gracias por responder . Lo veo bien lol. elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData(source, "level") local r, g, b = getPlayerNametagColor(source) local gang = exports.gang_system:getPlayerGang ( source ) or "N/A" outputChatBox( "#FFFFFF["..gang.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text) Link to comment
Mateito14 Posted October 13, 2015 Author Share Posted October 13, 2015 elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData(source, "level") local r, g, b = getPlayerNametagColor(source) local gang = exports.gang_system:getPlayerGang ( source) local gangTag if ( gang ) then gangTag = gang outputChatBox( "#FFFFFF["..gangTag.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) else gangTag = "User" outputChatBox( "#FFFFFF["..gangTag.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) end outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text) No me funciono, gracias por responder . Lo veo bien lol. elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData(source, "level") local r, g, b = getPlayerNametagColor(source) local gang = exports.gang_system:getPlayerGang ( source ) or "N/A" outputChatBox( "#FFFFFF["..gang.."] " .. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text) Sigue apareciendo None Link to comment
Razor64 Posted October 13, 2015 Share Posted October 13, 2015 Esto te podria servir... elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData( source, "level" ) local r, g, b = getPlayerNametagColor( source ) local gang = exports.gang_system:getPlayerGang ( source) if ( gang ~= "None" ) then -- Aqui compruebas que el gang del player sea diferente a 'None'. tagGang = "#FFFFFF[" .. gang .. "] " -- Si el 'getPlayerGang' retorna un resultado diferente a 'None', te saldra este tag. else tagGang = "" -- Y aqui, si el 'getPlayerGang' retorna 'None', simplemente no aparecera nada. end outputChatBox( tagGang.. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text) Link to comment
Tomas Posted October 13, 2015 Share Posted October 13, 2015 tagGang = gang ~= "None" and "#FFFFF["..gang.."]" or "" Link to comment
Mateito14 Posted October 13, 2015 Author Share Posted October 13, 2015 Esto te podria servir... elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData( source, "level" ) local r, g, b = getPlayerNametagColor( source ) local gang = exports.gang_system:getPlayerGang ( source) if ( gang ~= "None" ) then -- Aqui compruebas que el gang del player sea diferente a 'None'. tagGang = "#FFFFFF[" .. gang .. "] " -- Si el 'getPlayerGang' retorna un resultado diferente a 'None', te saldra este tag. else tagGang = "" -- Y aqui, si el 'getPlayerGang' retorna 'None', simplemente no aparecera nada. end outputChatBox( tagGang.. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text) Me sirvió , muchas gracias. Link to comment
DeathMta Posted October 13, 2015 Share Posted October 13, 2015 exports.gang_system:getPlayerGang ( source) en vez de usar eso por que no usas esto? getElementData(source, "gang" ) Link to comment
DeathMta Posted October 13, 2015 Share Posted October 13, 2015 elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then cancelEvent() local lvl = getElementData( source, "level" ) local r, g, b = getPlayerNametagColor( source ) local clan = getElementData(source, "gang" ) if ( clan ~= "None" ) then tagclan = "#FFFFFF[" .. clan .. "] " else tagclan = "" end outputChatBox( tagclan.. getPlayerName ( source ) ..":#FFFFFF " .. text, getRootElement(), r, g, b, true ) outputServerLog("CHAT: [user] " .. getPlayerName ( source ) .. ": " .. text) Link to comment
Mateito14 Posted October 14, 2015 Author Share Posted October 14, 2015 exports.gang_system:getPlayerGang ( source) en vez de usar eso por que no usas esto?getElementData(source, "gang" ) Lo había usado antes y después para tratar de que no aparezca "None" trate de hacer algo con exports.gang_system:getPlayerGang ( source ) Link to comment
DeathMta Posted October 14, 2015 Share Posted October 14, 2015 pero usa la misma logica que del export Link to comment
Recommended Posts