SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 26/02/2016, 11:35 AM   #191
Crayder
High-roller
 
Crayder's Avatar
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,867
Reputation: 553
Default Re: SampSharp - Write gamemodes in .NET

Quote:
Originally Posted by xyyy018 View Post
I can compile this plugin for Linux using Cygwin?
No because Windows doesn't contain the required Linux libraries. It's best to compile it on the Linux OS you plan to use it on so it conforms completely. Each Linux OS has it's own specific variations of everything, so compiling it on a completely different Linux OS isn't always the best (that's why a lot of big time developers require the users to compile the programs themselves).
__________________
Those who deserve reputation, do not need to beg for it.
Also, don't expect the help you need when offering reputation, you'll just be attracting Rep Hunters.
Join SA-MP Discord!
Crayder is offline   Reply With Quote
Old 26/02/2016, 02:32 PM   #192
xyyy018
Little Clucker
 
Join Date: Feb 2016
Posts: 27
Reputation: 0
Default Re: SampSharp - Write gamemodes in .NET

Quote:
Originally Posted by ikkentim View Post
If you're running on windows, you can build a symbols file for your game mode in order to get more useful stack traces. http://sampsharp.timpotze.nl/configu...#debug-symbols

Did you Register your player class in your own PlayerController, which you replaced the GtaPlayerController with? See my previous post: http://forum.sa-mp.com/showpost.php?...&postcount=172
I have debug symbols and I replace GtaPlayerController with my PlayerController but this stack has not changed
Quote:
[26/02/2016 16:19:01] Exception thrownOnPlayerTakeDamage:
System.NullReferenceException: Object reference not set to an instance of an object
at SSS.Player.OnTakeDamage (SampSharp.GameMode.Events.DamageEventArgs e) [0x00000] in <filename unknown>:0
at SampSharp.GameMode.Controllers.GtaPlayerController .<RegisterEvents>b__19 (System.Object sender, SampSharp.GameMode.Events.DamageEventArgs args) [0x00000] in <filename unknown>:0
at SampSharp.GameMode.BaseMode.OnPlayerTakeDamage (SampSharp.GameMode.World.GtaPlayer player, SampSharp.GameMode.Events.DamageEventArgs e) [0x00000] in <filename unknown>:0
at SampSharp.GameMode.BaseMode.OnPlayerTakeDamage (Int32 playerid, Int32 issuerid, Single amount, Int32 weaponid, Int32 bodypart) [0x00000] in <filename unknown>:0
It looks like another stack (for example)
Quote:
[26/02/2016 16:17:39] Exception thrownOnPlayerDisconnect:
System.NullReferenceException: Object reference not set to an instance of an object
at SSS.Player.OnDisconnected (SampSharp.GameMode.Events.DisconnectEventArgs e) [0x00009] in c:\path\to\sampfolder\with\server\source\Player.cs :188
at SampSharp.GameMode.Controllers.GtaPlayerController .<RegisterEvents>b__1 (System.Object sender, SampSharp.GameMode.Events.DisconnectEventArgs args) [0x00000] in <filename unknown>:0
at (wrapper delegate-invoke) System.EventHandler`1<SampSharp.GameMode.Events.Di sconnectEventArgs>:invoke_void_object_TEventArgs (object,SampSharp.GameMode.Events.DisconnectEventA rgs)
at SampSharp.GameMode.BaseMode.OnPlayerDisconnected (SampSharp.GameMode.World.GtaPlayer player, SampSharp.GameMode.Events.DisconnectEventArgs e) [0x00000] in <filename unknown>:0
at SampSharp.GameMode.BaseMode.OnPlayerDisconnect (Int32 playerid, Int32 reason) [0x00000] in <filename unknown>:0
And in GameMode.cs (main file) I have this in LoadController
Code:
base.LoadControllers(controllers);
controllers.Remove<GtaPlayerController>();
controllers.Add(new PlayerController());
But where does this stack? It occurs only when I get the damage himself

The same is true when committed suicide
Quote:
26/02/2016 16:27:38] Exception thrownOnPlayerDeath:
System.NullReferenceException: Object reference not set to an instance of an object
at SSS.Player.OnDeath (SampSharp.GameMode.Events.DeathEventArgs e) [0x00000] in <filename unknown>:0
at SampSharp.GameMode.Controllers.GtaPlayerController .<RegisterEvents>b__4 (System.Object sender, SampSharp.GameMode.Events.DeathEventArgs args) [0x00000] in <filename unknown>:0
at SampSharp.GameMode.BaseMode.OnPlayerDied (SampSharp.GameMode.World.GtaPlayer player, SampSharp.GameMode.Events.DeathEventArgs e) [0x00000] in <filename unknown>:0
at SampSharp.GameMode.BaseMode.OnPlayerDeath (Int32 playerid, Int32 killerid, Int32 reason) [0x00000] in <filename unknown>:0
OnDeath
http://pastebin.com/wkpd5N3N
OnTakeDamage
http://pastebin.com/6A9mrTmr
PlayerController class
http://pastebin.com/9ZiqNS9q
xyyy018 is offline   Reply With Quote
Old 26/02/2016, 10:05 PM   #193
ikkentim
High-roller
 
ikkentim's Avatar
 
Join Date: Jan 2010
Location: Kampen, The Netherlands
Posts: 1,068
Reputation: 171
Default Re: SampSharp - Write gamemodes in .NET

@xyyy018: Which line is this? c:\path\to\sampfolder\with\server\source\Player.cs :188
__________________
Greetings,
Tim Potze

Projects
GAMEDEV | Part-time developer working on Parkitect. | Steampage
LSRES | A SA:MP server from the past, and hopefully, back in the future.
SampSharp | Plugin for writing SA:MP gamemodes in C#. | Topic Website Github
SanMap | San Andreas in Google Maps! | Topic Github Sample
ikkentim is offline   Reply With Quote
Old 27/02/2016, 10:05 AM   #194
xyyy018
Little Clucker
 
Join Date: Feb 2016
Posts: 27
Reputation: 0
Default Re: SampSharp - Write gamemodes in .NET

I put it for example to show that in other cases, the stack provides more information. There is no longer an error. I did it on purpose. The problem with OnDeath and still OnTakeDamage
xyyy018 is offline   Reply With Quote
Old 02/03/2016, 07:46 AM   #195
xyyy018
Little Clucker
 
Join Date: Feb 2016
Posts: 27
Reputation: 0
Default Re: SampSharp - Write gamemodes in .NET

How to fix OnDeath & OnTakeDamage stacks?
xyyy018 is offline   Reply With Quote
Old 02/03/2016, 06:46 PM   #196
ikkentim
High-roller
 
ikkentim's Avatar
 
Join Date: Jan 2010
Location: Kampen, The Netherlands
Posts: 1,068
Reputation: 171
Default Re: SampSharp - Write gamemodes in .NET

Sorry for the late reaction;

You should put some debug code in, eg:
Code:
Console.WriteLine("player: " + player);
Console.WriteLine("e.Player: " + e.Player);
Console.WriteLine("TakeBy: " + TakeBy);
This way you can easily find what's null. With that information debugging is more of a smooth process and less of a guessing game.
__________________
Greetings,
Tim Potze

Projects
GAMEDEV | Part-time developer working on Parkitect. | Steampage
LSRES | A SA:MP server from the past, and hopefully, back in the future.
SampSharp | Plugin for writing SA:MP gamemodes in C#. | Topic Website Github
SanMap | San Andreas in Google Maps! | Topic Github Sample
ikkentim is offline   Reply With Quote
Old 03/03/2016, 01:31 PM   #197
xyyy018
Little Clucker
 
Join Date: Feb 2016
Posts: 27
Reputation: 0
Default Re: SampSharp - Write gamemodes in .NET

#fail
I fix him by add in OnTakeDamage
Code:
 if (e.OtherPlayer != null && e != null)
And him in OnDeath
Code:
if(e.Killer != null)
Sorry for the hassle and thanks
xyyy018 is offline   Reply With Quote
Old 04/03/2016, 04:29 PM   #198
xyyy018
Little Clucker
 
Join Date: Feb 2016
Posts: 27
Reputation: 0
Default Re: SampSharp - Write gamemodes in .NET

Okay, I have simple problem.
How I can create GangZone/Area, set range (minX, maxX, minY, maxY), color and detect when player leave this zone? I tried used StreamerWrapper, but I don't find functions/field to this

Code:
CHZone = new DynamicArea(Config.ZoneID);
CHZone.Interior = arena.Interior;
CHZone.IsVisibleInInterior(arena.Interior);
CHZone.IsVisibleInWorld((int)AttractionTypes.Attraction_CH * 100);
CHZone.StreamDistance = 100f;
CHZone.Position = new Vector3(arena.HidingSpawnX, arena.HidingSpawnY, arena.HidingSpawnZ);
How set color/position?

And I don't know how to add extra arguments to timer, e.x how add in timer player object?

#Fixed

Last edited by xyyy018; 05/03/2016 at 10:48 AM.
xyyy018 is offline   Reply With Quote
Old 04/03/2016, 05:47 PM   #199
Buero
Little Clucker
 
Join Date: Jul 2015
Posts: 18
Reputation: 0
Default Re: SampSharp - Write gamemodes in .NET

How create text label for car?
Buero is offline   Reply With Quote
Old 05/03/2016, 10:42 AM   #200
xyyy018
Little Clucker
 
Join Date: Feb 2016
Posts: 27
Reputation: 0
Default Re: SampSharp - Write gamemodes in .NET

How I can change "Detected mono version: <number>", "Loaded <number> commands" and "Number of vehicles model: <number>" text in console?

Any callback to block commands for player? I try this
Code:
public override void OnCommandText(SampSharp.GameMode.Events.CommandTextEventArgs e)
        {

            if (e.Text[0] == '/' && this.Attraction != AttractionTypes.Attraction_NONE)
            {
                SendClientMessage(Color.DarkRed + "Block!");
                e.Success = false;
            }
            else
                base.OnCommandText(e);
        }
But command not stop

Last edited by xyyy018; 06/03/2016 at 12:38 PM.
xyyy018 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Write on the map hejsan123 Scripting Help 3 23/09/2012 08:35 AM
How to write something in a VAR? Ihsan_Cingisiz Help Archive 4 29/05/2010 07:24 PM
How Do You Write This? sidhu123 Everything and Nothing 2 12/09/2009 04:05 AM
Write something in big and to the top TimBuk.Ekh Help Archive 3 18/04/2009 07:19 PM


All times are GMT. The time now is 07:35 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.