diff --git a/change.log b/change.log index c8b5941..1046984 100644 --- a/change.log +++ b/change.log @@ -1,20 +1,99 @@ --=Version 0.2 alpha (LATEST)=- -+ Added callback hooks for OnPlayerEditObject and OnPlayerEditAttachedObject for a possiblity to be implemented later -+ License included in binary download archive -+ Added a Vehicle property for the Player class. Removes and places the player in a vehicle -+ Added a Seat property for the Player class. Changes and determines the seat number the player is in. - (NOTE: If the player is not currently in a vehicle, this value is stored and will be used when next placing the player in a vehicle) -+ Added vehicle component functionality -+ Added source archive available for download from the forum post -* Fixed a bug with the Util class not being part of the API namespace -* Fixed a bug where the native GetVehicleComponentInSlot wouldn't return an int -- Removed console output of the Function not found upon loading +Version 0.5 Alpha (2012-05-23) *Latest* --=Version 0.1.1 alpha=- -+ Added Example scripts + + Added 6 events: + > Vehicle.OnStreamIn + > Vehicle.OnStreamOut + > Player.OnStreamIn + > Player.OnStreamOut + > Player.OnUpdate + > Server.OnRconLoginAttempt --=Version 0.1 alpha=- -+ Majority of callbacks -+ All a_samp.inc 0.3e functions - (every function from a_objects, and various functions from other files are to be implemented soon) -+ XML documentation \ No newline at end of file + + Added 4 functions: + > Player.PlaySound (int) + (+1 overload: Player.PlaySound (int, Vector3)) + > Player.PlayCrimeReport (Player, int) + > Player.SetSkillLevel (WeaponType, int) + > Player.ShowNameTag (Player, bool) + + + Added 13 properties: + > Player.Color + > Player.Clock + > Player.DrunkLevel + > Player.Ping + > Player.Score + > Player.SpecialAction + > Player.Team + > Player.Time + > Player.WantedLevel + > Player.Weapon + > Player.WeaponState + > Player.Weather + > World.NameTags + + + Added 5 enums: + > ComponentSlot + > SpecialAction + > Weapon + > WeaponState + > WeaponType + + + Updated the mscorlib.dll library + (This should fix some big problems. Mainly the problem of the server "not working" or crashing if you use the 'exit' command) + + + Included the mono-2.0.dll library in the server directory + + * Changed static Vehicle.GetComponentType to return type SAMP.API.ComponentSlot + (SAMP.API.ComponentSlot is simply an enum containing the slots and their integer values) + + * Cleaned up source code a bit + + * Fixed an issue where Vector2 and Vector3 weren't part of the API namespace + + * Fixed an issue with the hook GetPlayerColor was returning an int instead of unsigned int + (NOTE: Also changed the .NET API from int to uint) + + - Removed Player.OnText on the VB.NET example + (I was testing something. Removed for pointlessness) + + - Deprecated the World.SendMessageToAll overload which took a 'uint' argument. + (Use SAMP.API.Color instead) + +-------------------------------------------------------------------------------------------------------------------------------------------- + +Version 0.2 Alpha (2012-05-22) + + + Added callback hooks for OnPlayerEditObject and OnPlayerEditAttachedObject for a possiblity to be implemented later + + + License included in binary download archive + + + Added a Vehicle property for the Player class. Removes and places the player in a vehicle + + + Added a Seat property for the Player class. Changes and determines the seat number the player is in + (NOTE: If the player is not currently in a vehicle, this value is stored and will be used when next placing the player in a vehicle) + + + Added vehicle component functionality + + + Added source archive available for download from the forum post + + * Fixed a bug with the Util class not being part of the API namespace + + * Fixed a bug where the native GetVehicleComponentInSlot wouldn't return an int + + - Removed console output of the Function not found upon loading + +-------------------------------------------------------------------------------------------------------------------------------------------- + +Version 0.1.1 Alpha (2012-05-18) + + + Added Example scripts to archive + +-------------------------------------------------------------------------------------------------------------------------------------------- + +Version 0.1 Alpha (2012-05-18) + + + Majority of callbacks + + + All a_samp.inc 0.3e functions ported to .NET + (NOTE: Other functions from other files will be added progressively soon) + + + XML documentation for .NET usability \ No newline at end of file diff --git a/sampdotnet/API/Enums/Alignment.cs b/sampdotnet/API/Enums/Alignment.cs index 423ac3d..8824dde 100644 --- a/sampdotnet/API/Enums/Alignment.cs +++ b/sampdotnet/API/Enums/Alignment.cs @@ -3,8 +3,8 @@ namespace SAMP.API { public enum Alignment : int { - Left = 1, + Left = 1, Centered = 2, - Right = 3 + Right = 3 }; }; \ No newline at end of file diff --git a/sampdotnet/API/Enums/ComponentSlots.cs b/sampdotnet/API/Enums/ComponentSlot.cs similarity index 91% rename from sampdotnet/API/Enums/ComponentSlots.cs rename to sampdotnet/API/Enums/ComponentSlot.cs index 03e84bd..762d657 100644 --- a/sampdotnet/API/Enums/ComponentSlots.cs +++ b/sampdotnet/API/Enums/ComponentSlot.cs @@ -1,7 +1,7 @@  namespace SAMP.API { - public enum ComponentSlots + public enum ComponentSlot : int { Spoiler = 0, Hood = 1, diff --git a/sampdotnet/API/Enums/DialogStyle.cs b/sampdotnet/API/Enums/DialogStyle.cs index fc87c2d..0480a84 100644 --- a/sampdotnet/API/Enums/DialogStyle.cs +++ b/sampdotnet/API/Enums/DialogStyle.cs @@ -4,8 +4,8 @@ namespace SAMP.API public enum DialogStyle : int { MessageBox = 0, - Input = 1, - List = 2, - Password = 3 + Input = 1, + List = 2, + Password = 3 }; }; \ No newline at end of file diff --git a/sampdotnet/API/Enums/Keys.cs b/sampdotnet/API/Enums/Keys.cs index f982f06..b098db0 100644 --- a/sampdotnet/API/Enums/Keys.cs +++ b/sampdotnet/API/Enums/Keys.cs @@ -1,7 +1,7 @@  namespace SAMP.API { - public enum Keys + public enum Keys : int { Action = 1, Crouch = 2, diff --git a/sampdotnet/API/Enums/SpecialAction.cs b/sampdotnet/API/Enums/SpecialAction.cs new file mode 100644 index 0000000..87e8f4d --- /dev/null +++ b/sampdotnet/API/Enums/SpecialAction.cs @@ -0,0 +1,28 @@ + +namespace SAMP.API +{ + public enum SpecialAction : int + { + None = 0, + UseJetpack = 2, + Dance1 = 5, + Dance2 = 6, + Dance3 = 7, + Dance4 = 8, + HandsUp = 10, + UseCellPhone = 11, + Sitting = 12, + StopUseCellPhone = 13, + + Duck = 1, // Can't be set + EnterVehicle = 3, // Can't be set + ExitVehicle = 4, // Can't be set + Beer = 20, + Ciggy = 21, + Wine = 22, + Sprunk = 23, + Pissing = 68, + + Cuffed = 24 + }; +}; \ No newline at end of file diff --git a/sampdotnet/API/Enums/Weapon.cs b/sampdotnet/API/Enums/Weapon.cs new file mode 100644 index 0000000..1d7323c --- /dev/null +++ b/sampdotnet/API/Enums/Weapon.cs @@ -0,0 +1,50 @@ + +namespace SAMP.API +{ + public enum Weapon : int + { + Fist = 0, + BrassKnucles, + GolfClub, + Nightstick, + Knife, + BaseballBat, + Shovel, + PoolCue, + Katana, + Chainsaw, + DoubleEndedDildo, + Dildo, + Vibrator, + SilverVibrator, + Flowers, + Cane, + Grenade, + TearGas, + MolotovCocktail, + NineMM, + SilencedNineMM, + DesertEagle, + Shotgun, + SawnoffShotgun, + CombatShotgun, + MicroSMG, + MP5, + AK47, + M4, + Tec9, + CountryRifle, + RPG, + HSRocket, + FlameThrower, + Minigun, + SatchelCharge, + Detonator, + Spraycan, + FireExtinguisher, + Camera, + NightVisionGoggles, + ThermalGoggles, + Parachute + }; +}; \ No newline at end of file diff --git a/sampdotnet/API/Enums/WeaponState.cs b/sampdotnet/API/Enums/WeaponState.cs new file mode 100644 index 0000000..32b7698 --- /dev/null +++ b/sampdotnet/API/Enums/WeaponState.cs @@ -0,0 +1,12 @@ + +namespace SAMP.API +{ + public enum WeaponState : int + { + Unknown = -1, + NoBullets = 0, + LastBullet = 1, + MoreBullets = 2, + Reloading = 3 + }; +}; \ No newline at end of file diff --git a/sampdotnet/API/Enums/WeaponType.cs b/sampdotnet/API/Enums/WeaponType.cs new file mode 100644 index 0000000..60baa3f --- /dev/null +++ b/sampdotnet/API/Enums/WeaponType.cs @@ -0,0 +1,18 @@ + +namespace SAMP.API +{ + public enum WeaponType : int + { + Pistol = 0, + PistolSilenced, + DesertEagle, + Shotgun, + SawnoffShotgun, + SPAS12Shotgun, + MicroUzi, + MP5, + AK47, + M4, + SniperRifle + }; +}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/all-wcprops b/sampdotnet/API/EventData/Player/.svn/all-wcprops deleted file mode 100644 index a0aedd0..0000000 --- a/sampdotnet/API/EventData/Player/.svn/all-wcprops +++ /dev/null @@ -1,77 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 61 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player -END -PlayerDeathEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 85 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerDeathEventArgs.cs -END -PlayerStateChangeEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 91 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerStateChangeEventArgs.cs -END -PlayerPickUpPickupEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 92 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerPickUpPickupEventArgs.cs -END -PlayerSpawnEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 85 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerSpawnEventArgs.cs -END -PlayerExitVehicleEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 91 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerExitVehicleEventArgs.cs -END -PlayerDisconnectEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 90 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerDisconnectEventArgs.cs -END -PlayerEnterVehicleEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 92 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerEnterVehicleEventArgs.cs -END -PlayerRequestClassEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 92 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerRequestClassEventArgs.cs -END -PlayerEnterExitModShopEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 96 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerEnterExitModShopEventArgs.cs -END -PlayerCommandTextEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 91 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerCommandTextEventArgs.cs -END -PlayerClickMapEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 88 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerClickMapEventArgs.cs -END -PlayerTextEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 84 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Player/PlayerTextEventArgs.cs -END diff --git a/sampdotnet/API/EventData/Player/.svn/entries b/sampdotnet/API/EventData/Player/.svn/entries deleted file mode 100644 index 0c6c29f..0000000 --- a/sampdotnet/API/EventData/Player/.svn/entries +++ /dev/null @@ -1,436 +0,0 @@ -10 - -dir -33 -http://samp-dot-net.googlecode.com/svn/branches/0.2/sampdotnet/API/EventData/Player -http://samp-dot-net.googlecode.com/svn - - - -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - -a955bdad-90f8-2b12-97e1-62c735084bea - -PlayerCommandTextEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -c56d97029dbb767e20decc7e486d486d -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -1259 - -PlayerClickMapEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -2975c5558913833994f5a2a17405be38 -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -847 - -PlayerTextEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -966641b9b066b6b40ce77592b6eea644 -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -1199 - -PlayerDeathEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -038ab995902bc34d0a7366be45e664a9 -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -1212 - -PlayerStateChangeEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -35ce0c40421ea8709bd68fca0e628481 -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -1178 - -PlayerPickUpPickupEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -4d984d32c5d5daa7a161c6da5da99f36 -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -800 - -PlayerSpawnEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -b646d31a7b3e162695e853ca7115a44b -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -544 - -PlayerExitVehicleEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -61baf0f104f2289e1c873f319c431c27 -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -835 - -PlayerDisconnectEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -f98b0a034d15b38946714cc7bdba8d17 -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -830 - -PlayerEnterVehicleEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -55a561c55381bf3e60fb084680b99330 -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -1465 - -PlayerRequestClassEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -c31691ed428cbe7440393314ace03b4a -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -1103 - -PlayerEnterExitModShopEventArgs.cs -file - - - - -2016-02-16T17:04:51.056990Z -6dc5f7e9175bb03893aa85364cec87fe -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -1356 - diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerClickMapEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/.svn/text-base/PlayerClickMapEventArgs.cs.svn-base deleted file mode 100644 index 096e171..0000000 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerClickMapEventArgs.cs.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class PlayerClickMapEventArgs : EventArgs - { - #region Class Variables - - private Vector3 _qPosition; - - #endregion - - #region Constructor - - /// - /// Creates a new PlayerClickMapEventArgs object. - /// - /// The coordinates of where the player clicked. - public PlayerClickMapEventArgs(Vector3 position) - { - _qPosition = position; - } - - #endregion - - #region Accessors & Mutators - - /// - /// The coordinates of where the player clicked - /// - public Vector3 Position - { - get { return _qPosition; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerCommandTextEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/.svn/text-base/PlayerCommandTextEventArgs.cs.svn-base deleted file mode 100644 index 2cc7f7e..0000000 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerCommandTextEventArgs.cs.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class PlayerCommandTextEventArgs : EventArgs - { - #region Class Variables - - private string _strMessage; - private bool _bHandled; - - #endregion - - #region Constructor - - /// - /// Creates a new PlayerCommandTextEventArgs object. - /// - /// The chat message associated with this PlayerCommandTextEventArgs. - public PlayerCommandTextEventArgs(string message) - { - _strMessage = message; - _bHandled = false; - } - - #endregion - - #region Accessors & Mutators - - /// - /// Gets the chat message associated with this event. - /// - public string Message - { - get { return _strMessage; } - } - - /// - /// Gets or sets whether the event was handled. Returning TRUE will prevent the 'SERVER: Unknown Command' message being shown. - /// - public bool Handled - { - get { return _bHandled; } - set { _bHandled = value; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerDeathEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/.svn/text-base/PlayerDeathEventArgs.cs.svn-base deleted file mode 100644 index 1ece4f0..0000000 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerDeathEventArgs.cs.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class PlayerDeathEventArgs : EventArgs - { - #region Class Variables - - private Player _qKiller; - private int _nReason; - - #endregion - - #region Constructor - - /// - /// Creates a new PlayerDeathEventArgs object. - /// - /// The player who killed the player who died. NULL if none. - /// The ID of the reason for the player's death. - public PlayerDeathEventArgs(Player killer, int reason) - { - _qKiller = killer; - _nReason = reason; - } - - #endregion - - #region Accessors & Mutators - - /// - /// Gets the player who killed the player who died. NULL if none. - /// - public Player Killer - { - get { return _qKiller; } - } - - /// - /// Gets the ID of the reason for the player's death. - /// - public int Reason - { - get { return _nReason; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerDisconnectEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/.svn/text-base/PlayerDisconnectEventArgs.cs.svn-base deleted file mode 100644 index 878d168..0000000 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerDisconnectEventArgs.cs.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class PlayerDisconnectEventArgs : EventArgs - { - #region Class Variables - - private DisconnectReason _qReason; - - #endregion - - #region Constructor - - /// - /// Creates a new PlayerDisconnectEventArgs object. - /// - /// The reason for the disconnect. - public PlayerDisconnectEventArgs(DisconnectReason reason) - { - _qReason = reason; - } - - #endregion - - #region Accessors & Mutators - - /// - /// The reason they left. - /// - public DisconnectReason Reason - { - get { return _qReason; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerEnterExitModShopEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/.svn/text-base/PlayerEnterExitModShopEventArgs.cs.svn-base deleted file mode 100644 index c5f9f8a..0000000 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerEnterExitModShopEventArgs.cs.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class PlayerEnterExitModShopEventArgs : EventArgs - { - #region Class Variables - - private bool _bEntering; - private int _nInterior; - - #endregion - - #region Constructor - - /// - /// Creates a new PlayerEnterExitModShopEventArgs object. - /// - /// TRUE if the player is entering, FALSE otherwise. - /// The interior ID of the modshop that the player is entering (or 0 if exiting). - public PlayerEnterExitModShopEventArgs(bool entering, int interiodid) - { - _bEntering = entering; - _nInterior = interiodid; - } - - #endregion - - #region Accessors & Mutators - - /// - /// Gets whether or not the player is Entering a mod shop. - /// - public bool Entering - { - get { return _bEntering; } - } - - /// - /// Gets the interior ID of the modshop that the player is entering. This property will be 0 if the player is exiting. - /// - public int Interior - { - get { return _nInterior; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerEnterVehicleEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/.svn/text-base/PlayerEnterVehicleEventArgs.cs.svn-base deleted file mode 100644 index 53c4af7..0000000 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerEnterVehicleEventArgs.cs.svn-base +++ /dev/null @@ -1,57 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class PlayerEnterVehicleEventArgs : EventArgs - { - #region Class Variables - - private Vehicle _qVehicle; - private bool _bIsPassenger; - - #endregion - - #region Constructor - - /// - /// Creates a new PlayerEnterVehicleEventArgs object. - /// - /// The vehicle the player is attempting to enter. - /// True = Driver, False = Passenger. - public PlayerEnterVehicleEventArgs(Vehicle vehicle, bool passenger) - { - _qVehicle = vehicle; - _bIsPassenger = passenger; - } - - #endregion - - #region Accessors & Mutators - - /// - /// Gets whether or not the player was entering as a driver. - /// - public bool Driver - { - get { return !_bIsPassenger; } - } - - /// - /// Gets whether or not the player was entering as a passenger. - /// - public bool Passenger - { - get { return _bIsPassenger; } - } - - /// - /// Gets the vehicle the player is attempting to enter. - /// - public Vehicle Vehicle - { - get { return _qVehicle; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerExitVehicleEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/.svn/text-base/PlayerExitVehicleEventArgs.cs.svn-base deleted file mode 100644 index d9f3a1d..0000000 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerExitVehicleEventArgs.cs.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class PlayerExitVehicleEventArgs : EventArgs - { - #region Class Variables - - private Vehicle _qVehicle; - - #endregion - - #region Constructor - - /// - /// Creates a new PlayerExitVehicleEventArgs object. - /// - /// The vehicle the player is exiting. - public PlayerExitVehicleEventArgs(Vehicle vehicle) - { - _qVehicle = vehicle; - } - - #endregion - - #region Accessors & Mutators - - /// - /// Gets the vehicle the player is exiting. - /// - public Vehicle Vehicle - { - get { return _qVehicle; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerPickUpPickupEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/.svn/text-base/PlayerPickUpPickupEventArgs.cs.svn-base deleted file mode 100644 index 42c4901..0000000 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerPickUpPickupEventArgs.cs.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class PlayerPickUpPickupEventArgs : EventArgs - { - #region Class Variables - - private int _nPickupId; - - #endregion - - #region Constructor - - /// - /// Creates a new PlayerPickUpPickupEventArgs object. - /// - /// The ID of the pickup. - public PlayerPickUpPickupEventArgs(int pickupid) - { - _nPickupId = pickupid; - } - - #endregion - - #region Accessors & Mutators - - /// - /// The ID of the pickup. - /// - public int PickUp - { - get { return _nPickupId; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerRequestClassEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/.svn/text-base/PlayerRequestClassEventArgs.cs.svn-base deleted file mode 100644 index 2cfce7e..0000000 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerRequestClassEventArgs.cs.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class PlayerRequestClassEventArgs : EventArgs - { - #region Class Variables - - private int _nClassId; - private bool _bCancel; - - #endregion - - #region Constructor - - /// - /// Creates a new OnPlayerDisconnectEventArgs object. - /// - /// The reason for the disconnect. - public PlayerRequestClassEventArgs(int classid) - { - _nClassId = classid; - } - - #endregion - - #region Accessors & Mutators - - /// - /// The ID of the current class being viewed. - /// - public int Class - { - get { return _nClassId; } - } - - /// - /// Gets or sets whether the event should cancel (class denied.) - /// - public bool Cancel - { - get { return _bCancel; } - set { _bCancel = value; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerStateChangeEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/.svn/text-base/PlayerStateChangeEventArgs.cs.svn-base deleted file mode 100644 index 22fbf36..0000000 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerStateChangeEventArgs.cs.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class PlayerStateChangeEventArgs : EventArgs - { - #region Class Variables - - private PlayerState[] state = { PlayerState.None, PlayerState.None }; - - #endregion - - #region Constructor - - /// - /// Creates a new PlayerStateChangeEventArgs object. - /// - /// The player's new state. - /// The player's old state. - public PlayerStateChangeEventArgs(PlayerState newState, PlayerState oldState) - { - state[0] = newState; - state[1] = oldState; - } - - #endregion - - #region Accessors & Mutators - - /// - /// Gets the player's new state. - /// - public PlayerState NewState - { - get { return state[0]; } - } - - /// - /// Gets the player's old state. - /// - public PlayerState OldState - { - get { return state[1]; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerTextEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/.svn/text-base/PlayerTextEventArgs.cs.svn-base deleted file mode 100644 index f34704c..0000000 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerTextEventArgs.cs.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class PlayerTextEventArgs : EventArgs - { - #region Class Variables - - private string _strMessage; - private bool _bCancel; - internal bool _bSet = false; - - #endregion - - #region Constructor - - /// - /// Creates a new PlayerTextEventArgs object. - /// - /// The chat message associated with this PlayerTextEventArgs. - public PlayerTextEventArgs(string message) - { - _strMessage = message; - _bCancel = false; - } - - #endregion - - #region Accessors & Mutators - - /// - /// Gets the chat message. - /// - public string Message - { - get { return _strMessage; } - } - - /// - /// Gets or sets whether the event should cancel (chat message displayed). - /// - public bool Cancel - { - get { return _bCancel; } - set { _bCancel = value; _bSet = true; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/PlayerStreamEventArgs.cs b/sampdotnet/API/EventData/Player/PlayerStreamEventArgs.cs new file mode 100644 index 0000000..3ea944c --- /dev/null +++ b/sampdotnet/API/EventData/Player/PlayerStreamEventArgs.cs @@ -0,0 +1,38 @@ +using System; + +namespace SAMP.API.EventData +{ + public class PlayerStreamEventArgs : EventArgs + { + #region Class Variables + + private Player _qPlayer; + + #endregion + + #region Constructor + + /// + /// Creates a new PlayerStreamEventArgs object. + /// + /// The player who the player streamed in or out for. + public PlayerStreamEventArgs(Player forplayer) + { + _qPlayer = forplayer; + } + + #endregion + + #region Accessors & Mutators + + /// + /// Gets the player who the player streamed in or out for. + /// + public Player ForPlayer + { + get { return _qPlayer; } + } + + #endregion + }; +}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerSpawnEventArgs.cs.svn-base b/sampdotnet/API/EventData/Player/PlayerUpdateEventArgs.cs similarity index 72% rename from sampdotnet/API/EventData/Player/.svn/text-base/PlayerSpawnEventArgs.cs.svn-base rename to sampdotnet/API/EventData/Player/PlayerUpdateEventArgs.cs index 8eefaef..a887e39 100644 --- a/sampdotnet/API/EventData/Player/.svn/text-base/PlayerSpawnEventArgs.cs.svn-base +++ b/sampdotnet/API/EventData/Player/PlayerUpdateEventArgs.cs @@ -2,7 +2,7 @@ namespace SAMP.API.EventData { - public class PlayerSpawnEventArgs : EventArgs + public class PlayerUpdateEventArgs : EventArgs { #region Class Variables @@ -13,7 +13,7 @@ namespace SAMP.API.EventData #region Accessors & Mutators /// - /// Gets or sets whether the event should be cancelled (send back to class selection). + /// Gets or sets whether the event should cancel. /// public bool Cancel { diff --git a/sampdotnet/API/EventData/RconLoginAttemptEventArgs.cs b/sampdotnet/API/EventData/RconLoginAttemptEventArgs.cs new file mode 100644 index 0000000..572518b --- /dev/null +++ b/sampdotnet/API/EventData/RconLoginAttemptEventArgs.cs @@ -0,0 +1,61 @@ +using System; + +namespace SAMP.API.EventData +{ + public class RconLoginAttemptEventArgs : EventArgs + { + #region Class Variables + + private string + _strIp, // strip. lol. + _strPassword; + private bool _bSuccess; + + #endregion + + #region Constructor + + /// + /// Creates a new RconLoginAttemptEventArgs object. + /// + /// The IP of the player that tried to login to RCON. + /// The password used to login with. + /// False if the password was incorrect or True if it was correct. + public RconLoginAttemptEventArgs(string ip, string password, bool success) + { + _strIp = ip; + _strPassword = password; + _bSuccess = success; + } + + #endregion + + #region Accessors & Mutators + + /// + /// Gets the IP of the player that tried to login to RCON. + /// + public string IP + { + get { return _strIp; } + } + + /// + /// Gets the password used to login with. + /// + public string Password + { + get { return _strPassword; } + } + + /// + /// Gets whether or not the password was correct. + /// + public bool Success + { + get { return _bSuccess; } + } + + #endregion + }; +}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Vehicle/.svn/all-wcprops b/sampdotnet/API/EventData/Vehicle/.svn/all-wcprops deleted file mode 100644 index 6a74aaf..0000000 --- a/sampdotnet/API/EventData/Vehicle/.svn/all-wcprops +++ /dev/null @@ -1,11 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 62 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Vehicle -END -VehicleDeathEventArgs.cs -K 25 -svn:wc:ra_dav:version-url -V 87 -/svn/!svn/ver/30/branches/0.2/sampdotnet/API/EventData/Vehicle/VehicleDeathEventArgs.cs -END diff --git a/sampdotnet/API/EventData/Vehicle/.svn/entries b/sampdotnet/API/EventData/Vehicle/.svn/entries deleted file mode 100644 index b32ff28..0000000 --- a/sampdotnet/API/EventData/Vehicle/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -33 -http://samp-dot-net.googlecode.com/svn/branches/0.2/sampdotnet/API/EventData/Vehicle -http://samp-dot-net.googlecode.com/svn - - - -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - -a955bdad-90f8-2b12-97e1-62c735084bea - -VehicleDeathEventArgs.cs -file - - - - -2016-02-16T17:04:51.032999Z -8acf669b8e88ba1897b39a4ab18be97c -2012-07-07T17:04:38.829891Z -30 -yasahiro93 - - - - - - - - - - - - - - - - - - - - - -816 - diff --git a/sampdotnet/API/EventData/Vehicle/.svn/text-base/VehicleDeathEventArgs.cs.svn-base b/sampdotnet/API/EventData/Vehicle/.svn/text-base/VehicleDeathEventArgs.cs.svn-base deleted file mode 100644 index 4ab6390..0000000 --- a/sampdotnet/API/EventData/Vehicle/.svn/text-base/VehicleDeathEventArgs.cs.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -using System; - -namespace SAMP.API.EventData -{ - public class VehicleDeathEventArgs : EventArgs - { - #region Class Variables - - private Player _qKiller; - - #endregion - - #region Constructor - - /// - /// Creates a new VehicleDeathEventArgs object. - /// - /// The player who destroyed the vehicle. - public VehicleDeathEventArgs(Player killer) - { - _qKiller = killer; - } - - #endregion - - #region Accessors & Mutators - - /// - /// Gets the player who destroyed the vehicle. - /// - public Player Killer - { - get { return _qKiller; } - } - - #endregion - }; -}; \ No newline at end of file diff --git a/sampdotnet/API/EventData/Vehicle/VehicleStreamEventArgs.cs b/sampdotnet/API/EventData/Vehicle/VehicleStreamEventArgs.cs new file mode 100644 index 0000000..b7f22d5 --- /dev/null +++ b/sampdotnet/API/EventData/Vehicle/VehicleStreamEventArgs.cs @@ -0,0 +1,38 @@ +using System; + +namespace SAMP.API.EventData +{ + public class VehicleStreamEventArgs : EventArgs + { + #region Class Variables + + private Player _qPlayer; + + #endregion + + #region Constructor + + /// + /// Creates a new VehicleStreamEventArgs object. + /// + /// The player who the vehicle streamed in or out for. + public VehicleStreamEventArgs(Player forplayer) + { + _qPlayer = forplayer; + } + + #endregion + + #region Accessors & Mutators + + /// + /// Gets the player who the vehicle streamed in or out for. + /// + public Player ForPlayer + { + get { return _qPlayer; } + } + + #endregion + }; +}; \ No newline at end of file diff --git a/sampdotnet/API/Objects/GameMode.cs b/sampdotnet/API/Objects/GameMode.cs index 30c66b6..b22faa0 100644 --- a/sampdotnet/API/Objects/GameMode.cs +++ b/sampdotnet/API/Objects/GameMode.cs @@ -93,7 +93,7 @@ namespace SAMP.API Core.Natives.UsePlayerPedAnims(); } else - throw Core.Exceptions.GameModeInitialized; + throw new Exception("The GmaeMode has already been initialized."); } } diff --git a/sampdotnet/API/Objects/Player.cs b/sampdotnet/API/Objects/Player.cs index 965f2d8..85c8ce5 100644 --- a/sampdotnet/API/Objects/Player.cs +++ b/sampdotnet/API/Objects/Player.cs @@ -1,4 +1,5 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using System.Text; @@ -9,8 +10,10 @@ namespace SAMP.API #region Class Variables private bool _bFindZOnPosChange; + private bool _bClock; private int _nPlayerID; private int _nSeat; + private int _nWeather; private SpawnInfo _qSpawnInfo; private PlayerCamera _qCamera; @@ -34,444 +37,6 @@ namespace SAMP.API #endregion - #region Accessors & Mutators - - /// - /// Gets an array representing the currently connected players. - /// - public static Player[] All - { - get - { - // Create a temporary buffer list to store the player collection - List l = new List(); - - // Iterate through the player collection - foreach(DictionaryEntry line in playerStore) - { - // Add the current player entry to the buffer - l.Add((Player)line.Value); - } - - // Return an array representing the players - return l.ToArray(); - } - } - - /// - /// Gets or sets the player's facing angle. - /// - public float Angle - { - get - { - float angle = 0f; - Core.Natives.GetPlayerFacingAngle(this.ID, ref angle); - return angle; - } - set - { - Core.Natives.SetPlayerFacingAngle(this.ID, value); - } - } - - /// - /// Gets or sets the player's armour. - /// - public float Armour - { - get - { - float armour = 0f; - Core.Natives.GetPlayerArmour(this.ID, ref armour); - return armour; - } - set - { - Core.Natives.SetPlayerArmour(this.ID, value); - } - } - - /// - /// Gets the PlayerCamera associated with this player (for use with GetPlayerCameraPos etc.) - /// - public PlayerCamera Camera - { - get - { - return _qCamera; - } - } - - /// - /// Gets or sets whether the player's position adjusts on the Z axis to the nearest solid ground under the position. - /// NOTE: This value is reset to FALSE after every position change. - /// - public bool FindZOnPosChange - { - get { return _bFindZOnPosChange; } - set { _bFindZOnPosChange = value; } - } - - /// - /// Gets or sets the player's health. - /// - public float Health - { - get - { - float health = 0f; - Core.Natives.GetPlayerHealth(this.ID, ref health); - return health; - } - set - { - Core.Natives.SetPlayerHealth(this.ID, value); - } - } - - /// - /// Gets the player's ID. - /// - public int ID - { - get { return this._nPlayerID; } - } - - /// - /// Gets the player's IP address. - /// - public string IPAddress - { - get - { - StringBuilder sb = new StringBuilder(16); - Core.Natives.GetPlayerIp(this.ID, sb, sb.Capacity); - return sb.ToString(); - } - } - - /// - /// Gets whether the player is logged into RCON. - /// - public bool IsAdmin - { - get { return Core.Natives.IsPlayerAdmin(this.ID) == 1; } - } - - /// - /// Gets the Menu the player is currently viewing, or NULL if they aren't viewing one. - /// - public Menu Menu - { - get - { - int menuid = Core.Natives.GetPlayerMenu(this.ID); - return menuid == 255 ? null : Menu.Get(menuid); - } - } - - /// - /// Gets the player's name - /// - public string Name - { - get - { - StringBuilder sb = new StringBuilder(24); - Core.Natives.GetPlayerName(this.ID, sb, sb.Capacity); - return sb.ToString(); - } - } - - /// - /// Gets or sets the player's money. - /// - public int Money - { - get - { - return Core.Natives.GetPlayerMoney(this.ID); - } - set - { - Core.Natives.ResetPlayerMoney(this.ID); - Core.Natives.GivePlayerMoney(this.ID, value); - } - } - - /// - /// Gets or sets a player's position. - /// - public Vector3 Position - { - get - { - float - x = 0f, - y = 0f, - z = 0f; - Core.Natives.GetPlayerPos(this.ID, ref x, ref y, ref z); - return new Vector3(x, y, z); - } - set - { - if(this.FindZOnPosChange) - { - this.FindZOnPosChange = false; - Core.Natives.SetPlayerPosFindZ(this.ID, value.X, value.Y, value.Z); - } - else - Core.Natives.SetPlayerPos(this.ID, value.X, value.Y, value.Z); - } - } - - /// - /// Gets or sets the seat of the vehicle the player is in. - /// - public int Seat - { - get - { - return Core.Natives.GetPlayerVehicleSeat(this.ID); - } - set - { - if(Core.Natives.IsPlayerInAnyVehicle(this.ID) == 0) - _nSeat = value; - else - Core.Natives.PutPlayerInVehicle(this.ID, this.Vehicle.ID, value); - } - } - - /// - /// Gets or sets the player's skin. - /// - public int Skin - { - get - { - return Core.Natives.GetPlayerSkin(this.ID); - } - set - { - Core.Natives.SetPlayerSkin(this.ID, value); - } - } - - /// - /// Gets the SpawnInfo of this player. - /// - public SpawnInfo SpawnInfo - { - get { return _qSpawnInfo; } - } - - /// - /// Gets or sets a player's vehicle. - /// - public Vehicle Vehicle - { - get - { - if(Core.Natives.IsPlayerInAnyVehicle(this.ID) == 0) - return null; - - return Vehicle.Get(Core.Natives.GetPlayerVehicleID(this.ID)); - } - set - { - if(value == null) - Core.Natives.RemovePlayerFromVehicle(this.ID); - else - Core.Natives.PutPlayerInVehicle(this.ID, value.ID, _nSeat); - } - } - - /// - /// Gets the player's client version. - /// - public string Version - { - get - { - StringBuilder sb = new StringBuilder(10); - Core.Natives.GetPlayerVersion(this.ID, sb, sb.Capacity); - return sb.ToString(); - } - } - - #endregion - - #region Public Methods - - /// - /// Gets a player by their player ID. - /// - /// The player ID to search for. - /// Returns a Player object whose ID is playerid, or NULL if no such player is connected. - public static Player Get(int playerid) - { - // Iterate through the player collection store - foreach(DictionaryEntry d in playerStore) - { - if(d.Key.Equals(playerid)) - return (Player)d.Value; - } - - // The player doesn't exist. - return null; - } - - /// - /// Bans the player from the server. Bans are IP-based, and stored in samp.ban. - /// - public void Ban() - { - Core.Natives.Ban(this.ID); - } - - /// - /// Bans the player from the server with a reason. Bans are IP-based, and stored in samp.ban. - /// - public void Ban(string reason) - { - Core.Natives.BanEx(this.ID, reason); - } - - /// - /// Gets all players in a given range of this player. - /// - /// The range to scan. - /// An array of Player objects representing the players within the given range of this player. - public Player[] GetInRange(float range) - { - // Create variables - List buffer = new List(); - Player[] players = Player.All; - - // Iterate through the connected players - for(int i = 0; i < players.Length; i++) - { - // Check their distance - if(Vector3.Distance(this.Position, players[i].Position) <= range) - // Add them to the buffer if they are in range - buffer.Add(players[i]); - } - - // Return the buffer as an array - return buffer.ToArray(); - } - - /// - /// Gives the player a weapon. - /// - /// The ID of the weapon you want to give the player. - /// How much ammo to giev the player. - public void GiveWeapon(int weapon, int ammo) - { - Core.Natives.GivePlayerWeapon(this.ID, weapon, ammo); - } - - /// - /// Hides a menu to the player. - /// - /// The menu to hide. - public void HideMenu(Menu menu) - { - Core.Natives.HideMenuForPlayer(menu.ID, this.ID); - } - - /// - /// Determines if the player is in any vehicle. - /// - /// Returns a System.Boolean representing whether or not the player is in any vehicle. - public bool IsInVehicle() - { - return Core.Natives.IsPlayerInAnyVehicle(this.ID) == 1; - } - - /// - /// Determines if the player is in the specified vehicle. - /// - /// The vehicle to check. - /// Returns a System.Boolean representing whether or not the player is in the vehicle. - public bool IsInVehicle(Vehicle vehicle) - { - return Core.Natives.IsPlayerInVehicle(this.ID, vehicle.ID) == 1; - } - - /// - /// Determines if a player is streamed in another player's client. - /// - /// The player to check if this player is streamed in for. - /// Returns a System.Boolean representing whether or not the player is streamed in for the given player. - public bool IsStreamedIn(Player player) - { - return Core.Natives.IsPlayerStreamedIn(this.ID, player.ID) == 1; - } - - /// - /// Kicks the player from the server. - /// - public void Kick() - { - Core.Natives.Kick(this.ID); - } - - /// - /// Show a dialog to the player. - /// - /// The style of the dialog. - /// The text to display. - /// The title at the top of the dialog. - /// The text on the left button. - /// The text on the right button. Leave blank to hide it. - public void ShowDialog(DialogStyle style, int dialogid, string text, string caption, string button1, string button2 = "") - { - Core.Natives.ShowPlayerDialog(this.ID, dialogid, (int)style, caption, text, button1, button2); - } - - /// - /// Sends a message to the player with white text. SA-MP color embedding is supported. - /// - /// The string of text you would like to send. - /// - public void SendMessage(string message) - { - SendMessage(message, Color.White); - } - - /// - /// Sends a message to the player with the certain color. SA-MP color embedding is supported. - /// - /// The string of text you would like to send. - /// The color it should be in. This overload supports a SAMP.Color. - /// - public void SendMessage(string message, Color color) - { - Core.Natives.SendClientMessage(this.ID, color.ToArgb(), message); - } - - /// - /// Shows a menu to the player. - /// - /// The menu to show. - public void ShowMenu(Menu menu) - { - Core.Natives.ShowMenuForPlayer(menu.ID, this.ID); - } - - /// - /// Spawns or respawns the player with the given SpawnInfo. - /// - public void Spawn() - { - Core.Natives.SpawnPlayer(this.ID); - } - - #endregion - #region Events, Delegates and Method Calls // TODO: Implement more events @@ -654,16 +219,38 @@ namespace SAMP.API catch { } } #endregion - #region OnPickupPickUp + #region OnPickUpPickup public delegate void OnPickUpPickupHandler(object sender, EventData.PlayerPickUpPickupEventArgs e); public static event OnPickUpPickupHandler OnPickUpPickup; - internal void _OnPickupPickUp(int pickupid) + internal void _OnPickUpPickup(int pickupid) { EventData.PlayerPickUpPickupEventArgs args = new EventData.PlayerPickUpPickupEventArgs(pickupid); try { OnPickUpPickup(this, args); } catch { } } + #endregion #region OnStreamIn + #region OnStreamIn + public delegate void OnStreamInHandler(object sender, EventData.PlayerStreamEventArgs e); + public static event OnStreamInHandler OnStreamIn; + + internal void _OnStreamIn(int forplayerid) + { + EventData.PlayerStreamEventArgs args = new EventData.PlayerStreamEventArgs(Player.Get(forplayerid)); + try { OnStreamIn(this, args); } + catch { } + } + #endregion + #region OnStreamOut + public delegate void OnStreamOutHandler(object sender, EventData.PlayerStreamEventArgs e); + public static event OnStreamOutHandler OnStreamOut; + + internal void _OnStreamOut(int forplayerid) + { + EventData.PlayerStreamEventArgs args = new EventData.PlayerStreamEventArgs(Player.Get(forplayerid)); + try { OnStreamOut(this, args); } + catch { } + } #endregion #region OnClickMap public delegate void OnClickMapHandler(object sender, EventData.PlayerClickMapEventArgs e); @@ -697,6 +284,669 @@ namespace SAMP.API catch { } } #endregion + #region OnUpdate + public delegate void OnUpdateHandler(object sender, EventData.PlayerUpdateEventArgs e); + public static event OnUpdateHandler OnUpdate; + + internal int _OnUpdate() + { + EventData.PlayerUpdateEventArgs args = new EventData.PlayerUpdateEventArgs(); + try { OnUpdate(this, args); } + catch { } + return args.Cancel ? 0 : 1; + } + #endregion + + #endregion + + #region Accessors & Mutators + + /// + /// Gets an array representing the currently connected players. + /// + public static Player[] All + { + get + { + // Create a temporary buffer list to store the player collection + List l = new List(); + + // Iterate through the player collection + foreach(DictionaryEntry line in playerStore) + { + // Add the current player entry to the buffer + l.Add((Player)line.Value); + } + + // Return an array representing the players + return l.ToArray(); + } + } + + /// + /// Gets or sets the player's facing angle. + /// + public float Angle + { + get + { + float angle = 0f; + Core.Natives.GetPlayerFacingAngle(this.ID, ref angle); + return angle; + } + set + { + Core.Natives.SetPlayerFacingAngle(this.ID, value); + } + } + + /// + /// Gets or sets the player's armour. + /// + public float Armour + { + get + { + float armour = 0f; + Core.Natives.GetPlayerArmour(this.ID, ref armour); + return armour; + } + set + { + Core.Natives.SetPlayerArmour(this.ID, value); + } + } + + /// + /// Gets the PlayerCamera associated with this player (for use with GetPlayerCameraPos etc.) + /// + public PlayerCamera Camera + { + get + { + return _qCamera; + } + } + + /// + /// Gets or sets the player's color. + /// + public Color Color + { + get { return Color.FromArgb(Core.Natives.GetPlayerColor(this.ID)); } + set { Core.Natives.SetPlayerColor(this.ID, value.ToArgb()); } + } + + /// + /// Gets or sets the visibility of the in-game clock for the player. + /// + public bool Clock + { + get { return _bClock; } + set { _bClock = value; Core.Natives.TogglePlayerClock(this.ID, value ? 1 : 0); } + } + + /// + /// Gets or sets the player's drunk level. + /// + /// + /// Note: Drunk level will automatically decrease over time (players with 50 FPS will lose 50 'levels' per second. This is useful for determining a player's FPS!) + /// + /// Note: In 0.3a drunk level will decrement and stop at 2000. In 0.3b+ drunk level decrements to zero.) + /// + /// Note: Levels over 2000 make the player drunk. Max drunk level is 50000. If the drunk level is above 5000, the player's radar will be hidden. + /// + public int DrunkLevel + { + get { return Core.Natives.GetPlayerDrunkLevel(this.ID); } + set { Core.Natives.SetPlayerDrunkLevel(this.ID, value); } + } + + /// + /// Gets or sets whether the player's position adjusts on the Z axis to the nearest solid ground under the position. + /// NOTE: This value is reset to FALSE after every position change. + /// + public bool FindZOnPosChange + { + get { return _bFindZOnPosChange; } + set { _bFindZOnPosChange = value; } + } + + /// + /// Gets or sets the player's health. + /// + public float Health + { + get + { + float health = 0f; + Core.Natives.GetPlayerHealth(this.ID, ref health); + return health; + } + set + { + Core.Natives.SetPlayerHealth(this.ID, value); + } + } + + /// + /// Gets the player's ID. + /// + public int ID + { + get { return this._nPlayerID; } + } + + /// + /// Gets the player's IP address. + /// + public string IPAddress + { + get + { + StringBuilder sb = new StringBuilder(16); + Core.Natives.GetPlayerIp(this.ID, sb, sb.Capacity); + return sb.ToString(); + } + } + + /// + /// Gets whether the player is logged into RCON. + /// + public bool IsAdmin + { + get { return Core.Natives.IsPlayerAdmin(this.ID) == 1; } + } + + /// + /// Gets the player's currently pressed keys. + /// + public Keys Keys + { + get + { + int keys = 0, updown = 0, leftright = 0; + Core.Natives.GetPlayerKeys(this.ID, ref keys, ref updown, ref leftright); + return (Keys)keys; + } + } + + /// + /// Gets the player's currently pressed left/right analog keys. + /// + public int KeysLeftRight + { + get + { + int keys = 0, updown = 0, leftright = 0; + Core.Natives.GetPlayerKeys(this.ID, ref keys, ref updown, ref leftright); + return leftright; + } + } + + /// + /// Gets the player's currently pressed up/down analog keys. + /// + public int KeysUpDown + { + get + { + int keys = 0, updown = 0, leftright = 0; + Core.Natives.GetPlayerKeys(this.ID, ref keys, ref updown, ref leftright); + return updown; + } + } + + /// + /// Gets the Menu the player is currently viewing, or NULL if they aren't viewing one. + /// + public Menu Menu + { + get + { + int menuid = Core.Natives.GetPlayerMenu(this.ID); + return menuid == 255 ? null : Menu.Get(menuid); + } + } + + /// + /// Gets the player's name + /// + public string Name + { + get + { + StringBuilder sb = new StringBuilder(24); + Core.Natives.GetPlayerName(this.ID, sb, sb.Capacity); + return sb.ToString(); + } + } + + /// + /// Gets or sets the player's money. + /// + public int Money + { + get + { + return Core.Natives.GetPlayerMoney(this.ID); + } + set + { + Core.Natives.ResetPlayerMoney(this.ID); + Core.Natives.GivePlayerMoney(this.ID, value); + } + } + + /// + /// Gets the ping of the player (expressed in milliseconds.) + /// + public int Ping + { + get { return Core.Natives.GetPlayerPing(this.ID); } + } + + /// + /// Gets or sets a player's position. + /// + public Vector3 Position + { + get + { + float + x = 0f, + y = 0f, + z = 0f; + Core.Natives.GetPlayerPos(this.ID, ref x, ref y, ref z); + return new Vector3(x, y, z); + } + set + { + if(this.FindZOnPosChange) + { + this.FindZOnPosChange = false; + Core.Natives.SetPlayerPosFindZ(this.ID, value.X, value.Y, value.Z); + } + else + Core.Natives.SetPlayerPos(this.ID, value.X, value.Y, value.Z); + } + } + + /// + /// Gets or sets the seat of the vehicle the player is in. + /// + public int Seat + { + get + { + return Core.Natives.GetPlayerVehicleSeat(this.ID); + } + set + { + if(Core.Natives.IsPlayerInAnyVehicle(this.ID) == 0) + _nSeat = value; + else + Core.Natives.PutPlayerInVehicle(this.ID, this.Vehicle.ID, value); + } + } + + /// + /// Gets or sets the player's score. + /// + public int Score + { + get { return Core.Natives.GetPlayerScore(this.ID); } + set { Core.Natives.SetPlayerScore(this.ID, value); } + } + + /// + /// Gets or sets the player's skin. + /// + public int Skin + { + get { return Core.Natives.GetPlayerSkin(this.ID); } + set { Core.Natives.SetPlayerSkin(this.ID, value); } + } + + /// + /// Gets the SpawnInfo of this player. + /// + public SpawnInfo SpawnInfo + { + get { return _qSpawnInfo; } + } + + /// + /// Gets or sets the special action of the player. + /// + public SpecialAction SpecialAction + { + get { return (SpecialAction)Core.Natives.GetPlayerSpecialAction(this.ID); } + set + { + switch(value) + { + case API.SpecialAction.Duck: + case API.SpecialAction.EnterVehicle: + case API.SpecialAction.ExitVehicle: + throw new Exception("This special action cannot be set."); + default: + Core.Natives.SetPlayerSpecialAction(this.ID, (int)value); + break; + } + } + } + + /// + /// Gets or sets the player's team. + /// + public int Team + { + get { return Core.Natives.GetPlayerTeam(this.ID); } + set { Core.Natives.SetPlayerTeam(this.ID, value); } + } + + /// + /// Gets or sets the player's time. + /// + /// Only the Hour and Minute values take effect here. You can pass any valid year, month, day and second - it doesn't make a difference. + public DateTime Time + { + get + { + int hour = 0, minute = 0; + Core.Natives.GetPlayerTime(this.ID, ref hour, ref minute); + return new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hour, minute, 0); + } + set { Core.Natives.SetPlayerTime(this.ID, value.Hour, value.Minute); } + } + + /// + /// Gets or sets a player's vehicle. + /// + public Vehicle Vehicle + { + get + { + if(Core.Natives.IsPlayerInAnyVehicle(this.ID) == 0) + return null; + + return Vehicle.Get(Core.Natives.GetPlayerVehicleID(this.ID)); + } + set + { + if(value == null) + Core.Natives.RemovePlayerFromVehicle(this.ID); + else + Core.Natives.PutPlayerInVehicle(this.ID, value.ID, _nSeat); + } + } + + /// + /// Gets the player's client version. + /// + public string Version + { + get + { + StringBuilder sb = new StringBuilder(10); + Core.Natives.GetPlayerVersion(this.ID, sb, sb.Capacity); + return sb.ToString(); + } + } + + /// + /// Gets or sets the player's wanted level (6 brown stars under HUD.) + /// + public int WantedLevel + { + get { return Core.Natives.GetPlayerWantedLevel(this.ID); } + set { Core.Natives.SetPlayerWantedLevel(this.ID, value); } + } + + /// + /// Gets or sets the player's currently armed weapon. + /// + public Weapon Weapon + { + get { return (Weapon)Core.Natives.GetPlayerWeapon(this.ID); } + set { Core.Natives.SetPlayerArmedWeapon(this.ID, (int)value); } + } + + /// + /// Gets the state of the player's weapon. + /// + public WeaponState WeaponState + { + get { return (WeaponState)Core.Natives.GetPlayerWeaponState(this.ID); } + } + + /// + /// Gets or sets the player's current weather. + /// + public int Weather + { + get { return _nWeather; } + set { _nWeather = value; Core.Natives.SetPlayerWeather(this.ID, value); } + } + + #endregion + + #region Public Methods + + /// + /// Gets a player by their player ID. + /// + /// The player ID to search for. + /// Returns a Player object whose ID is playerid, or NULL if no such player is connected. + public static Player Get(int playerid) + { + // Iterate through the player collection store + foreach(DictionaryEntry d in playerStore) + { + if(d.Key.Equals(playerid)) + return (Player)d.Value; + } + + // The player doesn't exist. + return null; + } + + /// + /// Bans the player from the server. Bans are IP-based, and stored in samp.ban. + /// + public void Ban() + { + Core.Natives.Ban(this.ID); + } + + /// + /// Bans the player from the server with a reason. Bans are IP-based, and stored in samp.ban. + /// + public void Ban(string reason) + { + Core.Natives.BanEx(this.ID, reason); + } + + /// + /// Gets all players in a given range of this player. + /// + /// The range to scan. + /// An array of Player objects representing the players within the given range of this player. + public Player[] GetInRange(float range) + { + // Create variables + List buffer = new List(); + Player[] players = Player.All; + + // Iterate through the connected players + for(int i = 0; i < players.Length; i++) + { + // Check their distance + if(Vector3.Distance(this.Position, players[i].Position) <= range) + // Add them to the buffer if they are in range + buffer.Add(players[i]); + } + + // Return the buffer as an array + return buffer.ToArray(); + } + + /// + /// Gives the player a weapon. + /// + /// The ID of the weapon you want to give the player. + /// How much ammo to giev the player. + public void GiveWeapon(int weapon, int ammo) + { + Core.Natives.GivePlayerWeapon(this.ID, weapon, ammo); + } + + /// + /// Hides a menu to the player. + /// + /// The menu to hide. + public void HideMenu(Menu menu) + { + Core.Natives.HideMenuForPlayer(menu.ID, this.ID); + } + + /// + /// Determines if the player is in any vehicle. + /// + /// Returns a System.Boolean representing whether or not the player is in any vehicle. + public bool IsInVehicle() + { + return Core.Natives.IsPlayerInAnyVehicle(this.ID) == 1; + } + + /// + /// Determines if the player is in the specified vehicle. + /// + /// The vehicle to check. + /// Returns a System.Boolean representing whether or not the player is in the vehicle. + public bool IsInVehicle(Vehicle vehicle) + { + return Core.Natives.IsPlayerInVehicle(this.ID, vehicle.ID) == 1; + } + + /// + /// Determines if a player is streamed in another player's client. + /// + /// The player to check if this player is streamed in for. + /// Returns a System.Boolean representing whether or not the player is streamed in for the given player. + public bool IsStreamedIn(Player player) + { + return Core.Natives.IsPlayerStreamedIn(this.ID, player.ID) == 1; + } + + /// + /// Kicks the player from the server. + /// + public void Kick() + { + Core.Natives.Kick(this.ID); + } + + /// + /// Plays a crime report for the player (similar to that of SP when CJ commits a crime.) + /// + /// The suspect which commited the crime. + /// The Crime ID. + public void PlayCrimeReport(Player suspect, int crime) + { + Core.Natives.PlayCrimeReportForPlayer(this.ID, suspect.ID, crime); + } + + /// + /// Plays the specified sound for the player. + /// + /// The sound to play. + public void PlaySound(int sound) + { + PlaySound(sound, Vector3.Zero); + } + + /// + /// Plays the specified sound for the player at the given position. + /// + /// The sound to play. + /// The position at which to play the sound. Vector3.Zero for no position + public void PlaySound(int sound, Vector3 position) + { + Core.Natives.PlayerPlaySound(this.ID, sound, position.X, position.Y, position.Z); + } + + /// + /// Show a dialog to the player. + /// + /// The style of the dialog. + /// The text to display. + /// The title at the top of the dialog. + /// The text on the left button. + /// The text on the right button. Leave blank to hide it. + public void ShowDialog(DialogStyle style, int dialogid, string text, string caption, string button1, string button2 = "") + { + Core.Natives.ShowPlayerDialog(this.ID, dialogid, (int)style, caption, text, button1, button2); + } + + /// + /// Allows the toggling of the specified player's name tag being visible to the player. + /// + /// Player whose name tag will be shown or hidden. + /// True - show name tag, False - hide name tag. + public void ShowNameTag(Player showPlayer, bool show) + { + Core.Natives.ShowPlayerNameTagForPlayer(this.ID, showPlayer.ID, show ? 1 : 0); + } + + /// + /// Sends a message to the player with white text. SA-MP color embedding is supported. + /// + /// The string of text you would like to send. + /// + public void SendMessage(string message) + { + SendMessage(message, Color.White); + } + + /// + /// Sends a message to the player with the certain color. SA-MP color embedding is supported. + /// + /// The string of text you would like to send. + /// The color it should be in. This overload supports a SAMP.Color. + /// + public void SendMessage(string message, Color color) + { + Core.Natives.SendClientMessage(this.ID, color.ToArgb(), message); + } + + /// + /// Sets the skill level of a certain weapon type for a player. + /// + /// The weapon type you want to set the skill of. + /// The skill level to set for that weapon, ranging from 0 to 999. (A level out of range will max it out.) + public void SetSkillLevel(WeaponType type, int skillLevel) + { + Core.Natives.SetPlayerSkillLevel(this.ID, (int)type, skillLevel); + } + + /// + /// Shows a menu to the player. + /// + /// The menu to show. + public void ShowMenu(Menu menu) + { + Core.Natives.ShowMenuForPlayer(menu.ID, this.ID); + } + + /// + /// Spawns or respawns the player with the given SpawnInfo. + /// + public void Spawn() + { + Core.Natives.SpawnPlayer(this.ID); + } #endregion }; diff --git a/sampdotnet/API/Objects/Vehicle.cs b/sampdotnet/API/Objects/Vehicle.cs index 0fc7f43..1dfeb2a 100644 --- a/sampdotnet/API/Objects/Vehicle.cs +++ b/sampdotnet/API/Objects/Vehicle.cs @@ -60,6 +60,28 @@ namespace SAMP.API catch { } } #endregion + #region OnStreamIn + public delegate void OnStreamInHandler(object sender, EventData.VehicleStreamEventArgs e); + public static event OnStreamInHandler OnStreamIn; + + internal void _OnStreamIn(int forplayerid) + { + EventData.VehicleStreamEventArgs args = new EventData.VehicleStreamEventArgs(Player.Get(forplayerid)); + try { OnStreamIn(this, args); } + catch { } + } + #endregion + #region OnStreamOut + public delegate void OnStreamOutHandler(object sender, EventData.VehicleStreamEventArgs e); + public static event OnStreamOutHandler OnStreamOut; + + internal void _OnStreamOut(int forplayerid) + { + EventData.VehicleStreamEventArgs args = new EventData.VehicleStreamEventArgs(Player.Get(forplayerid)); + try { OnStreamOut(this, args); } + catch { } + } + #endregion #endregion @@ -272,10 +294,10 @@ namespace SAMP.API /// Determines what type of component (the slot) of a component id Find out what type of component a certain ID is. /// /// The component ID to check. - /// Returns the component slot ID of the specified component. - public static int GetComponentType(int component) + /// Returns the component slot of the specified component. + public static ComponentSlot GetComponentType(int component) { - return Core.Natives.GetVehicleComponentType(component); + return (ComponentSlot)Core.Natives.GetVehicleComponentType(component); } /// diff --git a/sampdotnet/API/Objects/World.cs b/sampdotnet/API/Objects/World.cs index 0d029d7..92913ce 100644 --- a/sampdotnet/API/Objects/World.cs +++ b/sampdotnet/API/Objects/World.cs @@ -9,6 +9,7 @@ namespace SAMP.API private static bool _bTirePopping = true; private static bool _bInteriorWeapons = true; private static bool _bInteriorEnterExits = true; + private static bool _bNameTags = true; private static float _fNameTagDrawDistance = 70f; private static float _fGlobalChatRadius = 0.0f; private static float _fGravity = 0.008f; @@ -67,6 +68,15 @@ namespace SAMP.API set { _fPlayerMarkerRadius = value; Core.Natives.LimitPlayerMarkerRadius(value); } } + /// + /// Gets or sets whether name tags, health bars and armor bars are visible above players. + /// + public static bool NameTags + { + get { return _bNameTags; } + set { _bNameTags = value; Core.Natives.ShowNameTags(value ? 1 : 0); } + } + /// /// Gets or sets the world time to a specific hour. /// @@ -143,7 +153,7 @@ namespace SAMP.API { int ret = Core.Natives.CreatePickup(model, type, position.X, position.Y, position.Z, virtualworld); if(ret == -1) - throw Core.Exceptions.PickupMaxLimit; + throw new Exception("The maximum number of pickups has been exceeded."); return ret; } @@ -193,16 +203,14 @@ namespace SAMP.API SendMessageToAll(message, Color.White); } + [Obsolete("Use SAMP.API.World.SendMessageToAll(string, SAMP.API.Color) instead.", true)] /// /// Sends a message to all players connected, specifying both the message the players will receive as the colour in which the message should show up. This is a multiple-user equivalent of Player.SendMessage(). /// /// The string of text you would like to send. /// The color it should be in. This overload supports HEX notation. /// - public static void SendMessageToAll(string message, uint color) - { - SendMessageToAll(message, Color.FromArgb(color)); - } + public static void SendMessageToAll(string message, uint color) { } /// /// Sends a message to all players connected, specifying both the message the players will receive as the colour in which the message should show up. This is a multiple-user equivalent of Player.SendMessage(). diff --git a/sampdotnet/API/Util/Server.cs b/sampdotnet/API/Util/Server.cs index d8ec6c9..ebc5af9 100644 --- a/sampdotnet/API/Util/Server.cs +++ b/sampdotnet/API/Util/Server.cs @@ -14,7 +14,7 @@ namespace SAMP.API #region Events, Delegates and Method Calls #region OnRconCommand - public delegate void OnRconCommandHandler(object sender, System.EventArgs e); + public delegate void OnRconCommandHandler(object sender, EventData.RconCommandEventArgs e); public static event OnRconCommandHandler OnRconCommand; internal static int _OnRconCommand(string cmd) @@ -25,6 +25,17 @@ namespace SAMP.API return args.Handled ? 1 : 0; } #endregion + #region OnRconLoginAttempt + public delegate void OnRconLoginAttemptHandler(object sender, EventData.RconLoginAttemptEventArgs e); + public static event OnRconLoginAttemptHandler OnRconLoginAttempt; + + internal static void _OnRconLoginAttempt(string ip, string password, int success) + { + EventData.RconLoginAttemptEventArgs args = new EventData.RconLoginAttemptEventArgs(ip, password, success == 1); + try { OnRconLoginAttempt(null, args); } + catch { } + } + #endregion #endregion diff --git a/sampdotnet/API/Util/Vector2.cs b/sampdotnet/API/Util/Vector2.cs index 38d064f..fdd57fe 100644 --- a/sampdotnet/API/Util/Vector2.cs +++ b/sampdotnet/API/Util/Vector2.cs @@ -1,6 +1,6 @@ using System; -namespace SAMP +namespace SAMP.API { public struct Vector2 { diff --git a/sampdotnet/API/Util/Vector3.cs b/sampdotnet/API/Util/Vector3.cs index 5179b36..f8b71bb 100644 --- a/sampdotnet/API/Util/Vector3.cs +++ b/sampdotnet/API/Util/Vector3.cs @@ -1,6 +1,6 @@ using System; -namespace SAMP +namespace SAMP.API { public struct Vector3 { diff --git a/sampdotnet/ClassDiagram.cd b/sampdotnet/ClassDiagram.cd index 7dc2bd3..34df673 100644 --- a/sampdotnet/ClassDiagram.cd +++ b/sampdotnet/ClassDiagram.cd @@ -14,55 +14,55 @@ API\Objects\GangZone.cs - - + + BAAgAAAEAAAAgABAAAgAAAAIgABAAAAAAAAgAAAAAAA= API\Objects\Menu.cs - + - I0ASSBAQAEhCsFhgAqmEAKeACBAcgEBIBMBgpQYHpAA= + I0ASSBAIAEhCuFhgKumERK+EHBMcgUhaFMDgpQcPpwA= API\Objects\Player.cs - + AAAAAAQAAIAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAI= API\Objects\PlayerCamera.cs - - + + AAACAAAAAAAEgAAAAhAAAAAIAAEAAEBAAAAAiAAAAAA= API\Objects\Text3D.cs - - + + AAACAQgABBAAgABAEyCAAKhIUAFEAABAoAgACQADAAA= API\Objects\TextDraw.cs - + - AAAADAAAMRAAoABiAAECAKAIAABAAABAgEgABAACAgA= + AAAADAAAMRAIqAByAAACBKANAABAAABEgEgABAAKAgA= API\Objects\Vehicle.cs - + - AAAAAAGAAIAIAIAAAAAAAAAEACjEAgCSoAAIAAAgAwQ= + AAAAAAGAAIAIAIAAAAEAAAAEACjEAgCSoAAIAAAgCwQ= API\Objects\World.cs @@ -74,12 +74,26 @@ - + - AAAQAAACAACAACAAABAAAAAAAAAAAAAAAAAAAAAACAA= + AAAQAEACAACAACAAABAAAAAAAAAAAAAAAAAAAAAACAQ= API\Util\Server.cs + + + + AAAgAAAAAAAYAAAgBIAAACIAAAAEBABZEEAAAAQIAAA= + API\Util\SpawnInfo.cs + + + + + + AAAAAAAAAAAAEAAAAAAAAAAAAAgAAAAAAAAACAAAAAA= + API\Util\Util.cs + + @@ -88,179 +102,277 @@ - + AAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAgAAAAAAAA= API\EventData\Player\PlayerClickMapEventArgs.cs - + AAAIAAAAIAAIAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAA= API\EventData\Player\PlayerCommandTextEventArgs.cs + + + + AAECAAAAAAAQAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + API\EventData\Player\PlayerDeathEventArgs.cs + + - + AAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAACAAA= API\EventData\Player\PlayerDisconnectEventArgs.cs - + BAAAAAAAAAAAAAAAAAAAAAgAACAAAAAAAAAAgAAAAAA= API\EventData\Player\PlayerEnterExitModShopEventArgs.cs - + + + + AAAAAAAAAAAAAAAAAAAAAAAAFAAAgAAAAAgAAAAAIAA= + API\EventData\Player\PlayerEnterVehicleEventArgs.cs + + + + + AAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAA= + API\EventData\Player\PlayerExitVehicleEventArgs.cs + + + + + + AAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ= + API\EventData\Player\PlayerPickUpPickupEventArgs.cs + + + + AAAAAAAAQAAAABAAAAIAAAAAAAAAAgAAAAAAAAAAAAA= API\EventData\Player\PlayerRequestClassEventArgs.cs - + AAAAAAAAQAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAA= API\EventData\Player\PlayerSpawnEventArgs.cs + + + + AAAAAAAAAAAAAAAIAAAAAAAAAIAAAAAEAAAAAAAAAAA= + API\EventData\Player\PlayerStateChangeEventArgs.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAgAAAAAABAAAAAAAAAAAAAA= + API\EventData\Player\PlayerStreamEventArgs.cs + + - + AAAAAAAAQAAIAAAAAAAAAAAAAEAAAgAAAAAAIAAAAAA= API\EventData\Player\PlayerTextEventArgs.cs - + + + + AAAAAAAAQAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAA= + API\EventData\Player\PlayerUpdateEventArgs.cs + + + + + + AAAIAAAAIAAAAAAAAAAABAAAgAAAAAAAAAAAAAAAAAA= + API\EventData\RconCommandEventArgs.cs + + + - AAAAAAAAAAAAEAAAAAAAAAAAAAgAAAAAAAAACAAAAAA= - API\Util\Util.cs + CACAAAAAAAAAAAAAAAAAAAAAIgAAAAAiAAAAAAAAAAA= + API\EventData\RconLoginAttemptEventArgs.cs + + + + + + AAECAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + API\EventData\Vehicle\VehicleDeathEventArgs.cs + + + + + + AAAAAAAAAAAAAAAAAAAAAgAAAAAABAAAAAAAAAAAAAA= + API\EventData\Vehicle\VehicleStreamEventArgs.cs - AAAAAAAAgAAAAAAAAAAAgACACAAAAAAAAAAAAAAAAAA= + AAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAA= Core\Exceptions.cs - + - RACSAFCBDAAgAKDAhQgQIAECKxhADASgQIBIRAQAEAQ= + RACSAFCBDAAggKDAhQgQIAECKxhADASgSIBIRAQAEAQ= Core\Internal.cs - + /vcn3It/nfqy7rT3f/vN923h/+/vfv8479vea9f3f7w= Core\Natives.cs - - - - AAAgAAAAAAAYAAAgBIAAACIAAAAEBABZEEAAAAQIAAA= - API\Util\SpawnInfo.cs - - - + Y/s/AcRdQXu8I7OmoRkQ11WRFJBxxgSLiLRt/TUZl4E= API\Util\Color.cs - - + + AAAAAAAIAAQAAAAEYAUAAAAACQAAAABAAAAAAAAAYAA= API\Util\Vector2.cs - - + + AAAAAAAIAAQAAAAEYAUAAAAACQAAAABAAAAAAAAAYAE= API\Util\Vector3.cs - + AAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= Core\Interfaces\ICountable.cs - + AAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= Core\Interfaces\IScriptBase.cs - + AAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAA= Core\Interfaces\IWorldEntity.cs - + AAAAAAAAAAAAAAAAAAAAABAAAAAAAAAACACAAAAAAAA= API\Enums\Alignment.cs - + BAAAwBAAAAAAEAIAAQQAAAQAAAEAAAAAAAACAAAEAIA= API\Enums\CameraMode.cs + + + + KAAAAAAAgAAAACAAAAAAAAAAEBgABAASBAAQAQAAAAE= + API\Enums\ComponentSlot.cs + + - + AAAAAAAIAAAAAAAAAAAAAAAAEAAAAAACAAAAAAAAAAI= API\Enums\DialogStyle.cs - + AAAAAAgAAAAAAAAAAAAAAAAABAAAAAAAACAAAAAAAAA= API\Enums\DisconnectReason.cs - + AAAAAAIAIoAUCAAAAYQAAEAiAqAEoAAACACAAIAAAAY= API\Enums\Keys.cs - + AAAAAAAQACAAAAAAACAAAAAAAAAAwCAAAAAAAIEAIAA= API\Enums\PlayerState.cs - + t1bXfuYbJw3c99+0fb/XQdvrB4f9vt93DJHqmjNIc/0= API\Enums\Skin.cs + + + + AABAAAAAAAAAAAIMACQAAEAIAAIABAAAAACYAAEAAEA= + API\Enums\SpecialAction.cs + + + + + + IQOCASAAAAYAxBAAAUCABABAKoAFEIyAAFIACAgJCKA= + API\Enums\Weapon.cs + + + + + + AAgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAgBA= + API\Enums\WeaponState.cs + + + + + + AEAAACBAAAIAAAEAAAAAAAAAAgAEAAQACAAAAAgAAAA= + API\Enums\WeaponType.cs + + \ No newline at end of file diff --git a/sampdotnet/Core/Exceptions.cs b/sampdotnet/Core/Exceptions.cs index 8889dc2..4367cb7 100644 --- a/sampdotnet/Core/Exceptions.cs +++ b/sampdotnet/Core/Exceptions.cs @@ -5,9 +5,6 @@ namespace SAMP.Core internal class Exceptions { // API - public static Exception GameModeInitialized = new Exception("The GmaeMode has already been initialized."); public static Exception TextDrawDestroyed = new Exception("The TextDraw has been destroyed."); - public static Exception PlayerNotConnected = new Exception("The player isn't connected."); - public static Exception PickupMaxLimit = new Exception("The maximum number of pickups has been exceeded."); }; }; \ No newline at end of file diff --git a/sampdotnet/Core/Interfaces/IWorldEntity.cs b/sampdotnet/Core/Interfaces/IWorldEntity.cs index 7c125e2..9a3af28 100644 --- a/sampdotnet/Core/Interfaces/IWorldEntity.cs +++ b/sampdotnet/Core/Interfaces/IWorldEntity.cs @@ -2,6 +2,6 @@ { public interface IWorldEntity { - Vector3 Position { get; set; } + API.Vector3 Position { get; set; } }; }; \ No newline at end of file diff --git a/sampdotnet/Core/Internal.cs b/sampdotnet/Core/Internal.cs index 994071b..29fa8fb 100644 --- a/sampdotnet/Core/Internal.cs +++ b/sampdotnet/Core/Internal.cs @@ -133,7 +133,7 @@ namespace SAMP.Core public static void OnPlayerObjectMoved(int playerid, int objectid) { } // TODO: Implement public static void OnPlayerPickUpPickup(int playerid, int pickupid) { - Player.Get(playerid)._OnPickupPickUp(pickupid); + Player.Get(playerid)._OnPickUpPickup(pickupid); } public static int OnVehicleMod(int playerid, int vehicleid, int componentid) { return 1; } // TODO: Implement public static void OnEnterExitModShop(int playerid, int enterexit, int interiorid) @@ -149,12 +149,30 @@ namespace SAMP.Core public static void OnPlayerExitedMenu(int playerid) { } // TODO: Implement public static void OnPlayerInteriorChange(int playerid, int newinteriorid, int oldinteriorid) { } // TODO: Implement public static int OnPlayerKeyStateChange(int playerid, int newkeys, int oldkeys) { return 1; } // TODO: Implement - public static void OnRconLoginAttempt(string ip, string password, int success) { } // TODO: Implement - public static int OnPlayerUpdate(int playerid) { return 1; } // TODO: Implement - public static void OnPlayerStreamIn(int playerid, int forplayerid) { } // TODO: Implement - public static void OnPlayerStreamOut(int playerid, int forplayerid) { } // TODO: Implement - public static void OnVehicleStreamIn(int vehicleid, int forplayerid) { } // TODO: Implement - public static void OnVehicleStreamOut(int vehicleid, int forplayerid) { } // TODO: Implement + public static void OnRconLoginAttempt(string ip, string password, int success) + { + Server._OnRconLoginAttempt(ip, password, success); + } + public static int OnPlayerUpdate(int playerid) + { + return Player.Get(playerid)._OnUpdate(); + } + public static void OnPlayerStreamIn(int playerid, int forplayerid) + { + Player.Get(playerid)._OnStreamIn(forplayerid); + } + public static void OnPlayerStreamOut(int playerid, int forplayerid) + { + Player.Get(playerid)._OnStreamOut(forplayerid); + } + public static void OnVehicleStreamIn(int vehicleid, int forplayerid) + { + Vehicle.Get(vehicleid)._OnStreamIn(forplayerid); + } + public static void OnVehicleStreamOut(int vehicleid, int forplayerid) + { + Vehicle.Get(vehicleid)._OnStreamOut(forplayerid); + } public static int OnDialogResponse(int playerid, int dialogid, int response, int listitem, string inputtext) { // Predef a variable for pass-on diff --git a/sampdotnet/Core/Natives.cs b/sampdotnet/Core/Natives.cs index c1312df..f873491 100644 --- a/sampdotnet/Core/Natives.cs +++ b/sampdotnet/Core/Natives.cs @@ -292,7 +292,7 @@ namespace SAMP.Core [DllImport("__Internal", EntryPoint="SetPlayerColor")] public static extern void SetPlayerColor(int playerid, uint color); [DllImport("__Internal", EntryPoint="GetPlayerColor")] - public static extern int GetPlayerColor(int playerid); + public static extern uint GetPlayerColor(int playerid); [DllImport("__Internal", EntryPoint="SetPlayerSkin")] public static extern void SetPlayerSkin(int playerid, int skinid); [DllImport("__Internal", EntryPoint="GetPlayerSkin")] diff --git a/sampdotnet/Properties/AssemblyInfo.cs b/sampdotnet/Properties/AssemblyInfo.cs index b00b61c..026fe8f 100644 --- a/sampdotnet/Properties/AssemblyInfo.cs +++ b/sampdotnet/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.2.0.0")] -[assembly: AssemblyFileVersion("0.2.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] +[assembly: AssemblyFileVersion("0.5.0.0")] diff --git a/sampdotnet/sampdotnet.csproj b/sampdotnet/sampdotnet.csproj index 0a01828..d802dcc 100644 --- a/sampdotnet/sampdotnet.csproj +++ b/sampdotnet/sampdotnet.csproj @@ -42,8 +42,14 @@ - + + + + + + + @@ -54,7 +60,9 @@ + + @@ -90,7 +98,6 @@ -