Comments (12)
You need the string:
tag:
foreign string:getSomeString();
global string:getSomeString() {
new test[20];
test = "Some String";
return test;
}
FYI, there is also a void:
tag if you don't want to return anything at all.
from ysi-includes.
Not that if you get a string size mismatch, use YSI_MAX_STRING
for the string size instead.
from ysi-includes.
Thanks a lot.
One more thing.
If i have same native functions (except OnFilterScriptInit) in multiple filterscripts (e.g. OnPlayerConnect) ,only the first one (in "server.cfg") gets called.
from ysi-includes.
What are you returning?
from ysi-includes.
I tried with '0' and '1'.
About string as return.
When i use fuction with "string" tag outside of filterscript (where that func. is defined) i get run time error (Invalid memory access) (it works fine while used inside fs).
from ysi-includes.
Make sure the Filterscript is compiled as YSIM_IS_MASTER
and the gamemode as YSIM_IS_STUB
(or YSIM_IS_CLIENT
).
from ysi-includes.
I tried with YSIM_IS_MASTER ,STUB ,CLIENT and SERVER and can't seem to get strings working.
global GetInt()
return 15;
global string:GetString() {
new test[YSI_MAX_STRING] = "Please Work";
return test;
}
global bool:GetBool()
return true;
With this (in the main script) i get:
15
RUN TIME ERROR
1
from ysi-includes.
I would need to see more of both your server and client code, also what the run time error is and where.
from ysi-includes.
This is stripped down version of my scripts.
- This is the main script:
#include <a_samp>
#include <YSI\y_timers>
#define YSIM_IS_STUB
#define MASTER 1
#include <YSI\y_master>
#include <mytest>
main() {
print("Main started.");
}
public OnGameModeInit() {
defer test1();
defer test2();
return 1;
}
timer test1[1000]() {
printf("GetInt: %i" ,GetInt() );
}
timer test2[2000]() {
printf("GetString: %s" ,GetString() );
}
- 1st FS (test.pwn)
#include <a_samp>
#define MASTER 2
#define YSIM_IS_MASTER
#include <YSI\y_master>
#include <mytest>
public OnFilterScriptInit() {
print("Test.pwn started");
return 1;
}
global GetInt()
return 42;
global string:GetString() {
new test[YSI_MAX_STRING] = "Some String";
return test;
}
- 2nd FS (otherFS.pwn)
#include <a_samp>
#include <YSI\y_timers>
#define MASTER 3
#define YSIM_IS_MASTER
#include <YSI\y_master>
#include <mytest>
public OnFilterScriptInit() {
print("otherFS.pwn started");
defer test1();
defer test2();
return 1;
}
timer test1[4000]() {
printf("From otherFS: %i" ,GetInt() );
}
timer test2[5000]() {
printf("From otherFS: %s" ,GetString() );
}
- mytest.inc
foreign GetInt();
foreign string:GetString();
With this code i get:
42
RUN TIME ERROR (invalid memory access)
From otherFS: 42
RUN TIME ERROR (invalid memory access)
Errors are detected by crashdetect plugin.
(sorry i don't know how to fold text)
from ysi-includes.
I'm pretty sure you can't have 2 masters...
from ysi-includes.
No, you can't. You can, however, set one script as server for one MASTER
and another for another.
from ysi-includes.
But even when i had only one FS (one master) i was still getting the same error.
from ysi-includes.
Related Issues (20)
- I found a problem in y_inline_bcrypt. HOT 2
- YSI_Coding\y_timers\..\..\YSI_Core\y_core\y_scriptinit_impl.inc(434) : fatal error 111: user error: defined OnScriptInit HOT 1
- va_args stopped working after update HOT 6
- What does callbackfix.amx do? HOT 1
- (error) undefined symbol "Dialog_ShowPlayerNative HOT 2
- Error when using y_commands HOT 1
- Error when updating YSI HOT 2
- Long callback execution detected (hang or performance issue) or DDoS Attack HOT 1
- Issues with using y_iterator HOT 1
- y_inline_timers calling the timer function twice HOT 1
- AMX Size HOT 1
- Can't include y_races
- error complil HOT 1
- Y_Hooks not called with 3.10.11 Compiler and Open.MP HOT 2
- y_functional_funcs.inc(1154) : error 017: undefined symbol "j"
- bcrypt_delete File or function is not found since last YSI Update. HOT 4
- \pawno\include\YSI_Data\y_foreach\y_foreach_entry.inc(137) : fatal error 111: user error: Old <foreach.inc> found - delete it.
- Unable to compile with y_zonenames and y_races
- pawn.cc crashes when i use the last version of ysi includes
- helpp me YSI HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ysi-includes.