We are trying to show rewarded video ads in our game.
But we are getting this response for the test device/user.
{
code = 1;
message = "An unknown error has occurred.";
type = OAuthException;
url = "https://graph.facebook.com/network_ads_common/";
}
Here are the logs for the request. (Ad request Parameters)
1.AFP = b4e920
2.ALLOWS_ARBITRARY_LOADS = 1
3.APPBUILD = 29
4.APPVERS = 1.0.0
5.BUNDLE = 'my game bundle'
6.COCOS2D = 0
7.COPPA = 0
8. CORE_AFP = 54351be8
9.DENSITY = 2
10.HEIGHT = 0
11.IDFA = 5E57F11A-C663-4FAB-B9F7-DE6F7246AA84
12.IDFA_FLAG = 1
13.LOCALE = en_AM
14. M_BANNER_KEY = 'some key here'
15.MAKE = Apple
16.MEDIATION_SERVICE =
17.MODEL = iPad7,2
18.NETWORK_TYPE = 1
19.NUM_ADS_REQUESTED = 1
20.ORIENTATION = 3
21.OS = iOS
22.OSVERS = 12.1.4
23.PLACEMENT_ID = VID_HD_16_9_15S_APP_INSTALL#my_live_placement_id
24.REQUEST_TIME = 1553694293.090104
25.ROOTED = 1
26.SCREEN_HEIGHT = 768
27.SCREEN_WIDTH = 1024
28.SDK = ios
29.SDK_CAPABILITY = [3,4,5,7,9,10,12,16,17]
30.SDK_VERSION = 5.1.0
31.SESSION_ID = 5268043A-BF88-4B94-A773-833396087D5D
32.SESSION_TIME = 15.50397801399231
33.TEMPLATE_ID = 400
34.TEST_MODE = 1
35.UNITY = 0
36.VOLUME = 0.5
37.WIDTH = 0
The platform is iOS.
Any suggestions about what is going wrong?
Thanks for your help.
I am using 2.6.4-1. Since rundeck logs dont archive or rotate themselves or don't drop a conf into logrotate with the installation; what is the best way to rotate and archive it..?
I can manually drop a config into logrotate so it can rotate and archive it, may be I can use copytruncate since Java apps (such as Rundeck) usually ignore UNIX signals like SIGHUP and SIGUSR1 but what stopping me using logrotate is, rundeck is trying to rotate the logs with appending a date stamp and keeping it there without archiving.This makes logrotate not working as expected. Since the size of the logs keep on growing, any alternatives for rundeck log rotation,archiving.
Or help me on how to avoid rundeck to try rotate the logs with appending a date stamp into the log name. Like rundeck.access.log turns to rundeck.access.log.2017-06-02 which makes logrotate to not working on archiving it.
Thanks in advance.
Leo Prince
As you already know that Rundeck uses log4f as its application logging facility. All logging is controlled by log4j. The log config file is RD_BASE/log4j.properties or RD_BASE/etc/log4j.properties if you are using launcher.
If you look into your log4j.properties file. You will find for the config for all files that appear under /var/log/rundeck/ directory have following setting:
log4j.appender.cmd-logger=org.apache.log4j.DailyRollingFileAppender
log4j.appender.cmd-logger.file=/var/log/rundeck/command.log
log4j.appender.cmd-logger.datePattern='.'yyyy-MM-dd
log4j.appender.cmd-logger.append=true
log4j.appender.cmd-logger.layout=org.apache.log4j.PatternLayout
log4j.appender.cmd-logger.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c - %m%n
org.apache.log4j.DailyRollingFileAppender makes log file rotate dailly.
The log file name will have a dateParttern as '.'yyyy-MM-dd
log4j log rotation and archive
TimeBasedRollingPolicy
The setting you are looking for is FileNamePattern
Here is an example on how to log rotate and archive using log4j
How to make log files rotate per day and zip old rotated logs using log4j.properties
The previous answer doesn't seem to work in log4j2. Here is my log4j2.properties file that rotates the archived logs every 2 days:
name = Rundeck Logging Configuration
property.baseDir = /var/log/rundeck
property.classLength = 2
property.noConsoleNoAnsi = true
property.prefix = [%style{%d{ISO8601}}{dim, noConsoleNoAnsi=${noConsoleNoAnsi}}] %highlight{%-5p}{noConsoleNoAnsi=${noConsoleNoAnsi}} %style{%c{${classLength}}}{cyan,noConsoleNoAnsi=${noConsoleNoAnsi}}
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = ${prefix} - %m%n
appender.rundeck.type = RollingFile
appender.rundeck.name = rundeck
appender.rundeck.fileName = ${baseDir}/rundeck.log
appender.rundeck.append = true
appender.rundeck.bufferedIO = true
appender.rundeck.filePattern = ${baseDir}/rundeck.log.%d{yyyy-MM-dd}.gz
appender.rundeck.layout.type = PatternLayout
appender.rundeck.layout.pattern = ${prefix} [%t] - %m%n
appender.rundeck.policies.type = Policies
appender.rundeck.policies.time.type = TimeBasedTriggeringPolicy
appender.rundeck.policies.time.interval = 1
appender.rundeck.strategy.type = DefaultRolloverStrategy
appender.rundeck.strategy.delete.type = Delete
appender.rundeck.strategy.delete.basePath = ${baseDir}
appender.rundeck.strategy.delete.maxDepth = 1
appender.rundeck.strategy.delete.ifFileName.type = IfFileName
appender.rundeck.strategy.delete.ifFileName.glob = rundeck.log.*.gz
appender.rundeck.strategy.delete.ifLastModified.type = IfLastModified
appender.rundeck.strategy.delete.ifLastModified.age = 2d
appender.audit.type = RollingFile
appender.audit.name = audit
appender.audit.fileName = ${baseDir}/rundeck.audit.log
appender.audit.append = true
appender.audit.bufferedIO = true
appender.audit.filePattern = ${baseDir}/rundeck.audit.log.%d{yyyy-MM-dd}.gz
appender.audit.layout.type = PatternLayout
appender.audit.layout.pattern = ${prefix} - %m%n
appender.audit.policies.type = Policies
appender.audit.policies.time.type = TimeBasedTriggeringPolicy
appender.audit.policies.time.interval = 1
appender.audit.strategy.type = DefaultRolloverStrategy
appender.audit.strategy.delete.type = Delete
appender.audit.strategy.delete.basePath = ${baseDir}
appender.audit.strategy.delete.maxDepth = 1
appender.audit.strategy.delete.ifFileName.type = IfFileName
appender.audit.strategy.delete.ifFileName.glob = rundeck.audit.log.*.gz
appender.audit.strategy.delete.ifLastModified.type = IfLastModified
appender.audit.strategy.delete.ifLastModified.age = 2d
appender.options.type = RollingFile
appender.options.name = options
appender.options.fileName = ${baseDir}/rundeck.options.log
appender.options.append = true
appender.options.bufferedIO = true
appender.options.filePattern = ${baseDir}/rundeck.options.log.%d{yyyy-MM-dd}.gz
appender.options.layout.type = PatternLayout
appender.options.layout.pattern = ${prefix} %X{httpStatusCode} %X{contentLength}B %X{durationTime}ms %X{lastModifiedDateTime} [%X{jobName}] %X{url} %X{contentSHA1}%n
appender.options.policies.type = Policies
appender.options.policies.time.type = TimeBasedTriggeringPolicy
appender.options.policies.time.interval = 1
appender.options.strategy.type = DefaultRolloverStrategy
appender.options.strategy.delete.type = Delete
appender.options.strategy.delete.basePath = ${baseDir}
appender.options.strategy.delete.maxDepth = 1
appender.options.strategy.delete.ifFileName.type = IfFileName
appender.options.strategy.delete.ifFileName.glob = rundeck.options.log.*.gz
appender.options.strategy.delete.ifLastModified.type = IfLastModified
appender.options.strategy.delete.ifLastModified.age = 2d
appender.storage.type = RollingFile
appender.storage.name = storage
appender.storage.fileName = ${baseDir}/rundeck.storage.log
appender.storage.append = true
appender.storage.bufferedIO = true
appender.storage.filePattern = ${baseDir}/rundeck.storage.log.%d{yyyy-MM-dd}.gz
appender.storage.layout.type = PatternLayout
appender.storage.layout.pattern = ${prefix} %X{action} %X{type} %X{path} %X{status} %X{metadata}%n
appender.storage.policies.type = Policies
appender.storage.policies.time.type = TimeBasedTriggeringPolicy
appender.storage.policies.time.interval = 1
appender.storage.strategy.type = DefaultRolloverStrategy
appender.storage.strategy.delete.type = Delete
appender.storage.strategy.delete.basePath = ${baseDir}
appender.storage.strategy.delete.maxDepth = 1
appender.storage.strategy.delete.ifFileName.type = IfFileName
appender.storage.strategy.delete.ifFileName.glob = rundeck.storage.log.*.gz
appender.storage.strategy.delete.ifLastModified.type = IfLastModified
appender.storage.strategy.delete.ifLastModified.age = 2d
appender.jobchanges.type = RollingFile
appender.jobchanges.name = jobchanges
appender.jobchanges.fileName = ${baseDir}/rundeck.jobs.log
appender.jobchanges.append = true
appender.jobchanges.bufferedIO = true
appender.jobchanges.filePattern = ${baseDir}/rundeck.jobs.log.%d{yyyy-MM-dd}.gz
appender.jobchanges.layout.type = PatternLayout
appender.jobchanges.layout.pattern = ${prefix} %X{user} %X{change} [%X{id}] %X{project} "%X{groupPath}/%X{jobName}" (%X{method})%X{extraInfo}%n
appender.jobchanges.policies.type = Policies
appender.jobchanges.policies.time.type = TimeBasedTriggeringPolicy
appender.jobchanges.policies.time.interval = 1
appender.jobchanges.strategy.type = DefaultRolloverStrategy
appender.jobchanges.strategy.delete.type = Delete
appender.jobchanges.strategy.delete.basePath = ${baseDir}
appender.jobchanges.strategy.delete.maxDepth = 1
appender.jobchanges.strategy.delete.ifFileName.type = IfFileName
appender.jobchanges.strategy.delete.ifFileName.glob = rundeck.jobs.log.*.gz
appender.jobchanges.strategy.delete.ifLastModified.type = IfLastModified
appender.jobchanges.strategy.delete.ifLastModified.age = 2d
appender.execevents.type = RollingFile
appender.execevents.name = execevents
appender.execevents.fileName = ${baseDir}/rundeck.executions.log
appender.execevents.append = true
appender.execevents.bufferedIO = true
appender.execevents.filePattern = ${baseDir}/rundeck.executions.log.%d{yyyy-MM-dd}.gz
appender.execevents.layout.type = PatternLayout
appender.execevents.layout.pattern = ${prefix} %X{eventUser} %X{event} [%X{id}:%X{state}] %X{project} %X{user}/%X{abortedby} \"%X{groupPath}/%X{jobName} %X{argString}\"[%X{uuid}] %n
appender.execevents.policies.type = Policies
appender.execevents.policies.time.type = TimeBasedTriggeringPolicy
appender.execevents.policies.time.interval = 1
appender.execevents.strategy.type = DefaultRolloverStrategy
appender.execevents.strategy.delete.type = Delete
appender.execevents.strategy.delete.basePath = ${baseDir}
appender.execevents.strategy.delete.maxDepth = 1
appender.execevents.strategy.delete.ifFileName.type = IfFileName
appender.execevents.strategy.delete.ifFileName.glob = rundeck.executions.log.*.gz
appender.execevents.strategy.delete.ifLastModified.type = IfLastModified
appender.execevents.strategy.delete.ifLastModified.age = 2d
appender.apirequests.type = RollingFile
appender.apirequests.name = apirequests
appender.apirequests.fileName = ${baseDir}/rundeck.api.log
appender.apirequests.append = true
appender.apirequests.bufferedIO = true
appender.apirequests.filePattern = ${baseDir}/rundeck.api.log.%d{yyyy-MM-dd}.gz
appender.apirequests.layout.type = PatternLayout
appender.apirequests.layout.pattern = ${prefix} "%X{method} %X{uri}" %X{remoteHost} %X{secure} %X{remoteUser} %X{authToken} %X{duration} %X{project} (%X{userAgent})%n
appender.apirequests.policies.type = Policies
appender.apirequests.policies.time.type = TimeBasedTriggeringPolicy
appender.apirequests.policies.time.interval = 1
appender.apirequests.strategy.type = DefaultRolloverStrategy
appender.apirequests.strategy.delete.type = Delete
appender.apirequests.strategy.delete.basePath = ${baseDir}
appender.apirequests.strategy.delete.maxDepth = 1
appender.apirequests.strategy.delete.ifFileName.type = IfFileName
appender.apirequests.strategy.delete.ifFileName.glob = rundeck.api.log.*.gz
appender.apirequests.strategy.delete.ifLastModified.type = IfLastModified
appender.apirequests.strategy.delete.ifLastModified.age = 2d
appender.access.type = RollingFile
appender.access.name = access
appender.access.fileName = ${baseDir}/rundeck.access.log
appender.access.append = true
appender.access.bufferedIO = true
appender.access.filePattern = ${baseDir}/rundeck.access.log.%d{yyyy-MM-dd}.gz
appender.access.layout.type = PatternLayout
appender.access.layout.pattern = ${prefix} "%X{method} %X{uri}" %X{remoteHost} %X{secure} %X{remoteUser} %X{authToken} %X{duration} %X{project} [%X{contentType}] (%X{userAgent})%n
appender.access.policies.type = Policies
appender.access.policies.time.type = TimeBasedTriggeringPolicy
appender.access.policies.time.interval = 1
appender.access.strategy.type = DefaultRolloverStrategy
appender.access.strategy.delete.type = Delete
appender.access.strategy.delete.basePath = ${baseDir}
appender.access.strategy.delete.maxDepth = 1
appender.access.strategy.delete.ifFileName.type = IfFileName
appender.access.strategy.delete.ifFileName.glob = rundeck.access.log.*.gz
appender.access.strategy.delete.ifLastModified.type = IfLastModified
appender.access.strategy.delete.ifLastModified.age = 2d
appender.project.type = RollingFile
appender.project.name = project
appender.project.fileName = ${baseDir}/rundeck.project.log
appender.project.append = true
appender.project.bufferedIO = true
appender.project.filePattern = ${baseDir}/rundeck.project.log.%d{yyyy-MM-dd}.gz
appender.project.layout.type = PatternLayout
appender.project.layout.pattern = ${prefix} - %m%n
appender.project.policies.type = Policies
appender.project.policies.time.type = TimeBasedTriggeringPolicy
appender.project.policies.time.interval = 1
appender.project.strategy.type = DefaultRolloverStrategy
appender.project.strategy.delete.type = Delete
appender.project.strategy.delete.basePath = ${baseDir}
appender.project.strategy.delete.maxDepth = 1
appender.project.strategy.delete.ifFileName.type = IfFileName
appender.project.strategy.delete.ifFileName.glob = rundeck.project.log.*.gz
appender.project.strategy.delete.ifLastModified.type = IfLastModified
appender.project.strategy.delete.ifLastModified.age = 2d
appender.cleanup.type = RollingFile
appender.cleanup.name = cleanup
appender.cleanup.fileName = ${baseDir}/rundeck.cleanup.log
appender.cleanup.append = true
appender.cleanup.bufferedIO = true
appender.cleanup.filePattern = ${baseDir}/rundeck.cleanup.log.%d{yyyy-MM-dd}.gz
appender.cleanup.layout.type = PatternLayout
appender.cleanup.layout.pattern = ${prefix} - %m%n
appender.cleanup.policies.type = Policies
appender.cleanup.policies.time.type = TimeBasedTriggeringPolicy
appender.cleanup.policies.time.interval = 1
appender.cleanup.strategy.type = DefaultRolloverStrategy
appender.cleanup.strategy.delete.type = Delete
appender.cleanup.strategy.delete.basePath = ${baseDir}
appender.cleanup.strategy.delete.maxDepth = 1
appender.cleanup.strategy.delete.ifFileName.type = IfFileName
appender.cleanup.strategy.delete.ifFileName.glob = rundeck.cleanup.log.*.gz
appender.cleanup.strategy.delete.ifLastModified.type = IfLastModified
appender.cleanup.strategy.delete.ifLastModified.age = 2d
appender.webhooks.type = RollingFile
appender.webhooks.name = webhooks
appender.webhooks.fileName = ${baseDir}/rundeck.webhooks.log
appender.webhooks.append = true
appender.webhooks.bufferedIO = true
appender.webhooks.filePattern = ${baseDir}/rundeck.webhooks.log.%d{yyyy-MM-dd}.gz
appender.webhooks.layout.type = PatternLayout
appender.webhooks.layout.pattern = ${prefix} - %m%n
appender.webhooks.policies.type = Policies
appender.webhooks.policies.time.type = TimeBasedTriggeringPolicy
appender.webhooks.policies.time.interval = 1
appender.webhooks.strategy.type = DefaultRolloverStrategy
appender.webhooks.strategy.delete.type = Delete
appender.webhooks.strategy.delete.basePath = ${baseDir}
appender.webhooks.strategy.delete.maxDepth = 1
appender.webhooks.strategy.delete.ifFileName.type = IfFileName
appender.webhooks.strategy.delete.ifFileName.glob = rundeck.webhooks.log.*.gz
appender.webhooks.strategy.delete.ifLastModified.type = IfLastModified
appender.webhooks.strategy.delete.ifLastModified.age = 2d
rootLogger.level = warn
rootLogger.appenderRef.stdout.ref = STDOUT
rootLogger.appenderRef.rundeck.ref = rundeck
logger.interceptors.name = rundeck.interceptors
logger.interceptors.level = info
logger.interceptors.additivity = false
logger.interceptors.appenderRef.stdout.ref = STDOUT
logger.rundeckapp.name = rundeckapp
logger.rundeckapp.level = info
logger.rundeckapp.additivity = false
logger.rundeckapp.appenderRef.stdout.ref = STDOUT
logger.bootstrap.name = rundeckapp.BootStrap
logger.bootstrap.level = info
logger.bootstrap.additivity = false
logger.bootstrap.appenderRef.stdout.ref = STDOUT
logger.grails.name = grails
logger.grails.level = warn
logger.grails.additivity = false
logger.grails.appenderRef.stdout.ref = STDOUT
logger.grails_env.name = grails.util.Environment
logger.grails_env.level = error
logger.grails_env.additivity = false
logger.grails_env.appenderRef.stdout.ref = STDOUT
logger.prjmanager.name = grails.app.services.rundeck.services.ProjectManagerService
logger.prjmanager.level = info
logger.prjmanager.additivity = false
logger.prjmanager.appenderRef.stdout.ref = STDOUT
logger.authorization.name = com.dtolabs.rundeck.core.authorization
logger.authorization.level = info
logger.authorization.additivity = false
logger.authorization.appenderRef.stdout.ref = audit
logger.options.name = com.dtolabs.rundeck.remoteservice.http.options
logger.options.level = info
logger.options.additivity = false
logger.options.appenderRef.stdout.ref = options
logger.jobchanges.name = com.dtolabs.rundeck.data.jobs.changes
logger.jobchanges.level = info
logger.jobchanges.additivity = false
logger.jobchanges.appenderRef.stdout.ref = jobchanges
logger.execevents.name = org.rundeck.execution.status
logger.execevents.level = info
logger.execevents.additivity = false
ogger.execevents.appenderRef.stdout.ref = execevents
logger.apirequests.name = org.rundeck.api.requests
logger.apirequests.level = info
logger.apirequests.additivity = false
logger.apirequests.appenderRef.stdout.ref = apirequests
logger.access.name = org.rundeck.web.requests
logger.access.level = info
logger.access.additivity = false
logger.access.appenderRef.access.ref = access
logger.project.name = org.rundeck.project.events
logger.project.level = info
logger.project.additivity = false
logger.project.appenderRef.stdout.ref = project
logger.storage.name = org.rundeck.storage.events
logger.storage.level = info
logger.storage.additivity = false
logger.storage.appenderRef.storage.ref = storage
logger.webhook_events.name = org.rundeck.webhook.events
logger.webhook_events.level = info
logger.webhook_events.additivity = false
logger.webhook_events.appenderRef.webhooks.ref = webhooks
logger.webhook_plugins.name = org.rundeck.plugin.webhook
logger.webhook_plugins.level = debug
logger.webhook_plugins.additivity = false
logger.webhook_plugins.appenderRef.webhooks.ref = webhooks
logger.cleanup.name = rundeck.quartzjobs.ExecutionsCleanUp
logger.cleanup.level = debug
logger.cleanup.additivity = false
logger.cleanup.appenderRef.cleanup.ref = cleanup
logger.jetty.name = org.mortbay.log
logger.jetty.level = warn
logger.jetty.additivity = false
logger.jetty.appenderRef.stdout.ref = STDOUT
logger.hibernate.name = org.hibernate.orm.deprecation
logger.hibernate.level = error
logger.hibernate.additivity = false
logger.hibernate.appenderRef.stdout.ref = STDOUT
logger.rundeck_jaas.name = com.dtolabs.rundeck.jetty.jaas
logger.rundeck_jaas.level = debug
logger.rundeck_jaas.additivity = false
logger.rundeck_jaas.appenderRef.stdout.ref = STDOUT
logger.spring_security.name = grails.plugin.springsecurity.web.authentication.GrailsUsernamePasswordAuthenticationFilter
logger.spring_security.level = debug
logger.spring_security.additivity = false
logger.spring_security.appenderRef.stdout.ref = STDOUT
logger.jaas.name = org.rundeck.jaas
logger.jaas.level = debug
logger.jaas.additivity = false
logger.jaas.appenderRef.stdout.ref = STDOUT
logger.springBeanPropertyDescriptor.name = org.springframework.beans.GenericTypeAwarePropertyDescriptor
logger.springBeanPropertyDescriptor.level = error
logger.springBeanPropertyDescriptor.additivity = false
logger.springBeanPropertyDescriptor.appenderRef.stdout.ref = STDOUT
I'm writing something in lua and I come to a problem.
I know that you can execute cmd commands from lua with io.popen()
I did something like
function move(from, to)
io.popen(string.format([==[move %s %s]==], from, to))
end
but I've come to a problem because I'm german and my files sometimes have ö, ä, ü or ß in them and then it breaks.
How can I get it to work with all german characters?
I searched and found a possible solution io.popen("chcp 1252") but I can't get it to work.
edit: I'm using Window 7.
I tried your_filename:fromutf8() and no matter what I did it did not work.
I also tried chcp 1252 & echo weiß and it didn't change anything but I figured it out in the end.
local ersetzen = {
[142] = string.char(196), --Ä
[132] = string.char(228), --ä
[153] = string.char(214), --Ö
[148] = string.char(246), --ö
[154] = string.char(220), --Ü
[129] = string.char(252), --ü
[225] = string.char(223), --ß
}
local function split(...)
local output = {}
for i = 1, string.len(...) do
output[i] = string.sub(..., i, i)
end
return output
end
local function konvertieren(datei)
local a = split(datei)
local rest = {}
for k, v in pairs(a) do
table.insert(rest, (ersetzen[string.byte(v)] or v))
end
return table.concat(rest)
end
There might be a shorter way but this works for me.
local cp850_to_cp1252 = {
['\128'] = '\199',
['\129'] = '\252',
['\130'] = '\233',
['\131'] = '\226',
['\132'] = '\228',
['\133'] = '\224',
['\134'] = '\229',
['\135'] = '\231',
['\136'] = '\234',
['\137'] = '\235',
['\138'] = '\232',
['\139'] = '\239',
['\140'] = '\238',
['\141'] = '\236',
['\142'] = '\196',
['\143'] = '\197',
['\144'] = '\201',
['\145'] = '\230',
['\146'] = '\198',
['\147'] = '\244',
['\148'] = '\246',
['\149'] = '\242',
['\150'] = '\251',
['\151'] = '\249',
['\152'] = '\255',
['\153'] = '\214',
['\154'] = '\220',
['\155'] = '\248',
['\156'] = '\163',
['\157'] = '\216',
['\158'] = '\215',
['\159'] = '\131',
['\160'] = '\225',
['\161'] = '\237',
['\162'] = '\243',
['\163'] = '\250',
['\164'] = '\241',
['\165'] = '\209',
['\166'] = '\170',
['\167'] = '\186',
['\168'] = '\191',
['\169'] = '\174',
['\170'] = '\172',
['\171'] = '\189',
['\172'] = '\188',
['\173'] = '\161',
['\174'] = '\171',
['\175'] = '\187',
['\176'] = '?',
['\177'] = '?',
['\178'] = '?',
['\179'] = '?',
['\180'] = '?',
['\181'] = '\193',
['\182'] = '\194',
['\183'] = '\192',
['\184'] = '\169',
['\185'] = '?',
['\186'] = '?',
['\187'] = '?',
['\188'] = '?',
['\189'] = '\162',
['\190'] = '\165',
['\191'] = '?',
['\192'] = '?',
['\193'] = '?',
['\194'] = '?',
['\195'] = '?',
['\196'] = '?',
['\197'] = '?',
['\198'] = '\227',
['\199'] = '\195',
['\200'] = '?',
['\201'] = '?',
['\202'] = '?',
['\203'] = '?',
['\204'] = '?',
['\205'] = '?',
['\206'] = '?',
['\207'] = '\164',
['\208'] = '\240',
['\209'] = '\208',
['\210'] = '\202',
['\211'] = '\203',
['\212'] = '\200',
['\213'] = '?',
['\214'] = '\205',
['\215'] = '\206',
['\216'] = '\207',
['\217'] = '?',
['\218'] = '?',
['\219'] = '?',
['\220'] = '?',
['\221'] = '\166',
['\222'] = '\204',
['\223'] = '?',
['\224'] = '\211',
['\225'] = '\223',
['\226'] = '\212',
['\227'] = '\210',
['\228'] = '\245',
['\229'] = '\213',
['\230'] = '\181',
['\231'] = '\254',
['\232'] = '\222',
['\233'] = '\218',
['\234'] = '\219',
['\235'] = '\217',
['\236'] = '\253',
['\237'] = '\221',
['\238'] = '\175',
['\239'] = '\180',
['\240'] = '\173',
['\241'] = '\177',
['\242'] = '?',
['\243'] = '\190',
['\244'] = '\182',
['\245'] = '\167',
['\246'] = '\247',
['\247'] = '\184',
['\248'] = '\176',
['\249'] = '\168',
['\250'] = '\183',
['\251'] = '\185',
['\252'] = '\179',
['\253'] = '\178',
['\254'] = '?',
['\255'] = '\160',
}
function string.from850(filename)
return (filename:gsub(".", cp850_to_cp1252))
end
Usage: your_filename:from850()
To clarify, because it was hard to explain in the title.
-- file that contains this code is > "player.lua"
local ply = FindMetaTable("Player")
ply.LastDamageType = "N/A"
this code sets a new variable to all player entities. The variable is just a string of the last entity that did damage to the player. That is made possible by the following code:
-- file that contains this code is > "init.lua"
AddCSLuaFile("shared.lua")
AddCSLuaFile("cl_init.lua")
include("shared.lua")
include("player.lua")
-->
--> OTHER METHODS THAT I DIDN'T INCLUDE
-->
function GM:PlayerShouldTakeDamage(ply, attacker)
ply.LastDamageType=tostring(attacker)
return true
end
My point of doing all this is because I want to have a hud element that will display this string so the client can see what was the last thing that dealt damage to him.
The problem is that, the variable is coming up as nil on the client side file "cl_init", yet if I printed the table that contained all the data that was in the player through the client AND through the server side. both tables were the same excluding the variable I made "LastDamageType"
-- file that contains this code is > "cl_init.lua"
include("shared.lua")
surface.CreateFont("dayz_font",{font="Arial",size=24,weight=400})
function GM:HUDPaint()
local ply = LocalPlayer()
draw.SimpleText("you are "..ply:Nick(),"dayz_font", 150,10,Color(255,120,50),TEXT_ALIGN_CENTER)//TargetID
surface.SetFont("TargetID")
surface.SetTextColor(Color(30,70,130))
surface.SetTextPos(surface.ScreenWidth()-200 ,20)
surface.DrawText("You have ")
surface.SetTextColor(Color(200,90,30))
surface.DrawText(ply:Health())
surface.SetTextColor(Color(30,70,130))
surface.DrawText(" health")
surface.SetTextPos(surface.ScreenWidth()-200 ,35)
surface.DrawText(""..tostring(Entity(1):GetTable().LastDamageType))
-- FOR DEBUGGING PURPOSES, I'M USING "Entity(1)" TO GET MY PLAYER
-- I KNOW THAT "LocalPlayer()" PROBABLY ALSO EQUATES TO THE SAME THING
-- AS WHAT "Entity(1)" IS AT THIS MOMENT BECAUSE I'M TESTING THIS IN SINGLEPLAYER.
end
So it seems that the player data on the client side and the server side are not the SAME thing and that they have to be synchronized or something like that... Or did I miss something important that kept them synchronized?
//////////////////////////////////////////////////
ADDITIONAL INFORMATION
//////////////////////////////////////////////////
These are printed lists of all the variables of my player entity when I did
PrintTable(Entity(1):GetTable())
on both the client side and server side. The first list is on the server and the second is on the client. I will separate them with ==========================
I know you don't probably want to look through the list to just to Ctrl+F and type in "LastDamageType" to highlight it.
/////////////////////////////////////////
SERVER SIDE
CWAttachments:
am_flechetterounds = true
am_magnum = true
am_matchgrade = true
am_slugrounds = true
bg_ak74_rpkbarrel = true
bg_ak74_ubarrel = true
bg_ak74foldablestock = true
bg_ak74heavystock = true
bg_ak74rpkmag = true
bg_ar1560rndmag = true
bg_ar15heavystock = true
bg_ar15sturdystock = true
bg_bipod = true
bg_deagle_compensator = true
bg_deagle_extendedbarrel = true
bg_foldsight = true
bg_longbarrel = true
bg_longbarrelmr96 = true
bg_longris = true
bg_magpulhandguard = true
bg_mp530rndmag = true
bg_mp5_kbarrel = true
bg_mp5_sdbarrel = true
bg_nostock = true
bg_regularbarrel = true
bg_retractablestock = true
bg_ris = true
bg_sg1scope = true
md_acog = true
md_aimpoint = true
md_anpeq15 = true
md_cobram2 = true
md_eotech = true
md_foregrip = true
md_kobra = true
md_m203 = true
md_microt1 = true
md_pbs1 = true
md_pso1 = true
md_saker = true
md_tundra9mm = true
CalcIdeal = 990
CalcSeqOverride = -1
DTVar = function: 0x1ca93680
EditValue = function: 0x2ac6c878
GetEditingData = function: 0x18501238
GetNetworkKeyValue = function: 0x1caf7ec0
GetNetworkVars = function: 0x1caf9640
LastDamageType = Entity [0][worldspawn]
LastPlayerTrace = 859.94995117188
LastSpawnpoint = Entity [61][info_player_start]
NetworkVar = function: 0x2375b100
NetworkVarElement = function: 0x23785a08
NetworkVarNotify = function: 0x1844e3c8
PlayerTrace:
Entity = Entity [0][worldspawn]
Fraction = 0.49089023470879
FractionLeftSolid = 0
Hit = true
HitBox = 0
HitGroup = 0
HitNoDraw = false
HitNonWorld = false
HitNormal = -1.000000 0.000000 0.000000
HitPos = 15359.968750 950.995850 -12563.697266
HitSky = true
HitTexture = TOOLS/TOOLSSKYBOX
HitWorld = true
MatType = 88
Normal = 0.998662 0.047185 -0.021163
PhysicsBone = 0
StartPos = -704.000000 192.000000 -12223.280273
StartSolid = false
SurfaceProps = 77
RestoreNetworkVars = function: 0x184b21a8
SCarMouseMoveX = 0
SCarMouseMoveY = 0
SetNetworkKeyValue = function: 0x1838a3f8
SetupEditing = function: 0x0f107ab8
SetupKeyValue = function: 0x1844da70
WT_RagdollRoper_Roping = false
canChat = 864.94995117188
dt:
m_CurrentPlayerClass:
ClassID = 125
Func = function: 0x1ca70b58
Player = Player [1][UbErZ Andrew900460]
m_bFlashlight = true
m_bInSwim = false
m_bWasNoclipping = false
m_bWasOnGround = true
////////////////////////////////////////////////////////////////
CLIENT SIDE
CWAttachments:
am_flechetterounds = true
am_magnum = true
am_matchgrade = true
am_slugrounds = true
bg_ak74_rpkbarrel = true
bg_ak74_ubarrel = true
bg_ak74foldablestock = true
bg_ak74heavystock = true
bg_ak74rpkmag = true
bg_ar1560rndmag = true
bg_ar15heavystock = true
bg_ar15sturdystock = true
bg_bipod = true
bg_deagle_compensator = true
bg_deagle_extendedbarrel = true
bg_foldsight = true
bg_longbarrel = true
bg_longbarrelmr96 = true
bg_longris = true
bg_magpulhandguard = true
bg_mp530rndmag = true
bg_mp5_kbarrel = true
bg_mp5_sdbarrel = true
bg_nostock = true
bg_regularbarrel = true
bg_retractablestock = true
bg_ris = true
bg_sg1scope = true
md_acog = true
md_aimpoint = true
md_anpeq15 = true
md_cobram2 = true
md_eotech = true
md_foregrip = true
md_kobra = true
md_m203 = true
md_microt1 = true
md_pbs1 = true
md_pso1 = true
md_saker = true
md_tundra9mm = true
CalcIdeal = 990
CalcSeqOverride = -1
ChatGestureWeight = 0
DTVar = function: 0x2be3b410
EditValue = function: 0x3053c750
GetEditingData = function: 0x2bb01b30
GetNetworkKeyValue = function: 0x2bb01d18
GetNetworkVars = function: 0x2bb01d38
LastPlayerTrace = 859.96203613281
NetworkVar = function: 0x2bb01c98
NetworkVarElement = function: 0x2bab5340
NetworkVarNotify = function: 0x2bb01cd8
PlayerTrace:
Entity = Entity [0][worldspawn]
Fraction = 0.49089023470879
FractionLeftSolid = 0
Hit = true
HitBox = 0
HitGroup = 0
HitNoDraw = false
HitNonWorld = false
HitNormal = -1.000000 0.000000 0.000000
HitPos = 15359.968750 950.995850 -12563.697266
HitSky = true
HitTexture = TOOLS/TOOLSSKYBOX
HitWorld = true
MatType = 88
Normal = 0.998662 0.047185 -0.021163
PhysicsBone = 0
StartPos = -704.000000 192.000000 -12223.280273
StartSolid = false
SurfaceProps = 77
RestoreNetworkVars = function: 0x2bb01d58
SetNetworkKeyValue = function: 0x2bb01cf8
SetupEditing = function: 0x2bb01c38
SetupKeyValue = function: 0x2bb01c58
dt:
m_CurrentPlayerClass:
ClassID = 125
Func = function: 0x30283ff8
Player = Player [1][UbErZ Andrew900460]
m_bInSwim = false
m_bWasNoclipping = false
m_bWasOnGround = true
If you wish to have a network shared variable that you can assign to an entity (e.g. a player) you want to use NWVariables. In your situation, since you are saving an entity you want to look at SetNWEntity and GetNWEntity.
Here is how you would implement it in the PlayerShouldTakeDamage hook:
function GM:PlayerShouldTakeDamage(ply, attacker)
ply:SetNWEntity("LastDamageType", attacker)
return true
end