These are chat archives for ikkentim/SampSharp

29th
Nov 2016
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 16:25
So I fixed the bug with OnPlayerCommandText displaying the "Unknown Command" message even if I e.Success = true.
In empty.pwn just have the "callback" return 1 :)
image.png
It was frustrating my players more than me, so I looked into how sampgdk works.
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 16:32
Well shit nevermind now it won't display the message for e.Success = false; xD Ah well I'll keep trying.
donshius
@donshius
Nov 29 2016 17:50
I am currently having big issues with text encoding, it does not want to display baltic characters. I am encoding the strings in c# before passing them to sendclientmessage. Could this be because the framework handles characters differently?
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 18:31
@ikkentim
Would this be the right way to convert a string (which could be id or player name) to a BasePlayer?
image.png
Tim Potze
@ikkentim
Nov 29 2016 18:32
@donshius Which sampsharp version do you use? The latest has support for most codepages. No need to struggle with it yourself

@NewbProgramming

int id;
if(int.TryParse(str, out id))
{
    return BasePlayer.Find(id);
}
else
{
    return BasePlayer.All.FirstOrDefault(p => p.Name.ToLower() == str.ToLower());
}

But why are you using parameter[0]? Not using the command system?

donshius
@donshius
Nov 29 2016 18:33
I am using the latest version, tried many different encodings, tried changing the actual source file encoding, nothing worked
Tim Potze
@ikkentim
Nov 29 2016 18:35
@donshius by that, do you mean stable latest version 0.6.x or latest prerelease 0.7.x?
donshius
@donshius
Nov 29 2016 18:38
the latest prerelease from github
Tim Potze
@ikkentim
Nov 29 2016 18:38
If you're using the latest prerelease, you can set codepage cp1257 in your config file.
Make sure you have a codepages folder in your server root
it should at least contain a file named cp1257.txt . If you don't have it, you can download it here, https://github.com/ikkentim/SampSharp/releases/tag/0.7.6133.31753-alpha
donshius
@donshius
Nov 29 2016 18:42
Worked perfectly, thanks a lot
Tim Potze
@ikkentim
Nov 29 2016 18:42
:) Happy it works, never really got to test it myself
donshius
@donshius
Nov 29 2016 18:43
not sure how I feel about this, spent almost 2 hours trying to find a solution and it was that simple
Tim Potze
@ikkentim
Nov 29 2016 18:44
I wish I had the time to write more documentation and release a stable 0.7 version :S
donshius
@donshius
Nov 29 2016 18:47
Wish I could help, might be able to in the future when I become more familiar with the framework
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 18:53
@ikkentim
Thank you.
donshius
@donshius
Nov 29 2016 18:58
if you're still here @ikkentim , is threading safe to use in S#?
Tim Potze
@ikkentim
Nov 29 2016 18:58
yes
all calls to natives are synced to the main thread
donshius
@donshius
Nov 29 2016 18:58
thank you
Tim Potze
@ikkentim
Nov 29 2016 18:58
though I've found some hangs during this syncing, that's why it's still a prerelease
But it's really uncommon
And has something to do with shutting down the gamemode
so don't worry about it
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 19:06
I kinda... remade SSCANF... sort of, you can't 'params out' so, I did my best lol
image.png
Works :P
Tim Potze
@ikkentim
Nov 29 2016 19:07
I'm telling ye', S#'s command processor is much better :P
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 19:08
I know, I know, I'm just having fun :D
Tim Potze
@ikkentim
Nov 29 2016 19:08
phew, okay :)
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 19:08
Love your work :)
So my version of ZCMD went from:
image.png
To:
image.png
Cause of my version of SSCANF
xD
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 19:14
Yeah meaningless but it's my masterpiece dammit xD
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 19:21
Ikkentim is all like, BRO, do this:
image.png
Tim Potze
@ikkentim
Nov 29 2016 19:21
yea, ffs
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 19:24
:+1:
What are you up to @ikkentim :)
Can't imagine how ugly that would be in pawn
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 19:55
:+1:
I've been using Newtonsoft.Json to store information and HTTPListener to make JSON requests/responses for websites / server launcher, seems faster and cleaner than SQL.
donshius
@donshius
Nov 29 2016 20:00
Not really a fan of http requests for data storage as they have a large latency (50+ms). Personally I just wrote a wrapper for the .NET connector to simplify usage and its working out fine
Tim Potze
@ikkentim
Nov 29 2016 20:00
no that's quite a no go
you really need an ORM
donshius
@donshius
Nov 29 2016 20:01
Is that for me or @NewbProgramming ?
Tim Potze
@ikkentim
Nov 29 2016 20:01
any remotely larger number of players will kick your gamemode in the guts if you base it all of a web api
donshius
@donshius
Nov 29 2016 20:01
nvm
Tim Potze
@ikkentim
Nov 29 2016 20:01
for using an external web api for storage
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 20:02
I don't make requests to the web api >.< that's dumb.
donshius
@donshius
Nov 29 2016 20:02
Yes, the performance difference is huge. MySQL could query millions of rows in the time it would take for an api to respond
Tim Potze
@ikkentim
Nov 29 2016 20:02
oh sorry you do it the other way around
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 20:02
Yes :+1:
Tim Potze
@ikkentim
Nov 29 2016 20:02
oh phew
I can wipe the sweat in peace now
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 20:03
xD <3
HttpListener not HttpClient haha.
Florian van Dillen
@fvandillen
Nov 29 2016 20:04
I use Fluent nHibernate and it's amazing
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 20:04
HttpClient would be good for Google APIs though like Text-To-Speech.
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 20:06
Wow, that's some pretty code there.
Florian van Dillen
@fvandillen
Nov 29 2016 20:06
^ Complete group structure saved into the database
Thank you :)
donshius
@donshius
Nov 29 2016 20:07
damn that is some sexy code
Florian van Dillen
@fvandillen
Nov 29 2016 20:08
thank you thank you
donshius
@donshius
Nov 29 2016 20:09
Looks like macOS from the font anti aliasing
Florian van Dillen
@fvandillen
Nov 29 2016 20:09
My entire gamemode depends completely on collections
It is Xamarin Studio on OSX
donshius
@donshius
Nov 29 2016 20:09
How is SA:MP on osx?
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 20:09
Can you even run SA:MP on macOS?
Florian van Dillen
@fvandillen
Nov 29 2016 20:09
I love the collection functions such as .All() .First()
Nope, I run a script
Compile > Upload > Restart script via SSH on VPS
All automated
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 20:10
Ah.
Smart.
donshius
@donshius
Nov 29 2016 20:10
Wait, so how do you test?
Florian van Dillen
@fvandillen
Nov 29 2016 20:10
SA:MP runs fine on OSX
Except for random crashes :P
donshius
@donshius
Nov 29 2016 20:11
oh, I have a hackintosh partition, might try it out sometime
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 20:12
What kind of gamemodes are you guys developing? Mine is just a freeroam but it's starting to look more like a RPG.
donshius
@donshius
Nov 29 2016 20:12
Good 'ole RPG for me
Florian van Dillen
@fvandillen
Nov 29 2016 20:13
RP/RPG
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 20:13
@ikkentim
If we wanted to implement RNPC or FCNPC how would we do it?
donshius
@donshius
Nov 29 2016 20:32
@NewbProgramming are you using 0.7?
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 20:36
Yes
Latest pre-release.
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 21:02
image.png
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 21:50
Very interesting.
How do you get a callback?
Tim Potze
@ikkentim
Nov 29 2016 21:51
use the damn menu
:P
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 21:51
Wait
This?
Tim Potze
@ikkentim
Nov 29 2016 21:52
yes
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 21:53
I'd be lost without you guys thank you.
Tim Potze
@ikkentim
Nov 29 2016 21:53
tbh if you make it a separate library you best put the callbacks in an extension, not the gamemode (see docs)
afk
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 22:41
For native.Invoke how do you get integers returned by the native?
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 23:30
or floats.
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 23:47
Nevermind
InvokeFloat / InvokeBool / Invoke(Integer)
:P
That's cool
image.png
image.png
Do you think since it's an NPC it creates a BasePlayer instance for it?
Michael Kilpatrick
@NewbProgramming
Nov 29 2016 23:53
ohh it did
That's neat.
^.^
This is the best plugin for SA:MP ever.