Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Weapon command error
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Cookiez38" data-source="post: 309131" data-attributes="member: 51350"><p>Hellow,</p><p>can someone tell me what wrong with this? because i get "ERROR in command "trois" : fatal error encountered during command execution</p><p></p><p>[PHP] case "trois":</p><p> {</p><p> Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Session.CharacterInfo.Username));</p><p> if (TargetSession == null || !TargetSession.InRoom)</p><p> {</p><p> Session.SendData(RoomChatComposer.Compose(Actor.Id, "Could not find " + Session.CharacterInfo.Username + " in this room!", 0, ChatType.Whisper));</p><p> return true;</p><p> }</p><p> int num1 = 0;</p><p> int num2 = 0;</p><p> string str1 = string.Empty;</p><p> int num3 = 0;</p><p> string Message = string.Empty;</p><p> string string2 = MergeParams(@params, 1);</p><p> int num4 = Session.CharacterInfo.CreditsBalance;</p><p> if (string2 == null && string.IsNullOrEmpty(string2))</p><p> return true;</p><p> using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())</p><p> {</p><p> DataRow row1 = MySqlClient.ExecuteQueryRow("SELECT a.*,b.* FROM zaprp_weapons AS a JOIN zaprp_user_weapons AS b ON (a.weapon_id = b.weapon_id) WHERE a.weapon_name = @wepname AND b.user_id = @userid");</p><p> MySqlClient.SetParameter("wepname", (object)string2);</p><p> MySqlClient.SetParameter("userid", (object)Session.CharacterInfo.Id);</p><p> if (row1 == null)</p><p> {</p><p> DataRow row = MySqlClient.ExecuteQueryRow("SELECT weapon_id, weapon_name, cost_credits, clip_size, type FROM zaprp_weapons WHERE weapon_name = @wepname LIMIT 1");</p><p> MySqlClient.SetParameter("wepname", (object)string2);</p><p> if (row != null)</p><p> {</p><p> num1 = (int)row["weapon_id"];</p><p> num2 = (int)row["cost_credits"];</p><p> str1 = (string)row["type"];</p><p> string2 = (string)row["weapon_name"];</p><p> num3 = (int)row["clip_size"];</p><p> }</p><p> else</p><p> {</p><p> Session.SendData(NotificationMessageComposer.Compose("That is an invalid weapon, please type :listweapons to view what is available!"));</p><p> return true;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> Session.SendData(NotificationMessageComposer.Compose("You already own this weapon!"));</p><p> return true;</p><p> }</p><p> }</p><p> if (num4 >= num2)</p><p> {</p><p> using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())</p><p> {</p><p> MySqlClient.ExecuteNonQuery("REPLACE INTO zaprp_user_weapons (user_id, weapon_id, ammo_loaded, ammo_inventory) VALUES (@userid, @weaponid, @ammoloaded, @ammoinv)");</p><p> MySqlClient.SetParameter("userid", (object)Session.CharacterInfo.Id);</p><p> MySqlClient.SetParameter("weaponid", (object)num1);</p><p> if (str1 == "gun")</p><p> {</p><p> MySqlClient.SetParameter("ammoinv", (object)num3);</p><p> MySqlClient.SetParameter("ammoloaded", (object)0);</p><p> Message = "You have successfully purchased a " + string2 + "! You get one clip of " + num3.ToString() + " bullets on the house.";</p><p> }</p><p> else</p><p> {</p><p> MySqlClient.SetParameter("ammoinv", (object)0);</p><p> MySqlClient.SetParameter("ammoloaded", (object)0);</p><p> Message = "You have successfully purchased a " + string2 + ", enjoy it!";</p><p> }</p><p> return true;</p><p> }</p><p> SqlDatabaseClient MySqlClients = SqlDatabaseManager.GetClient();</p><p> int newcoins = Session.CharacterInfo.CreditsBalance - num2;</p><p> Session.SendData(CreditsBalanceComposer.Compose(newcoins));</p><p> Session.CharacterInfo.UpdateCreditsBalance(MySqlClients, -num2);</p><p> Session.SendData(RoomChatComposer.Compose(Actor.Id, "*Buys a " + string2 + "*", 0, ChatType.Whisper));</p><p> Session.SendData(NotificationMessageComposer.Compose((Message)));</p><p> }</p><p> else</p><p> Session.SendData(NotificationMessageComposer.Compose("You cannot afford to purchase a " + string2 + "!"));</p><p> }</p><p></p><p> return true;[/PHP]</p><p></p><p>i use REALITYEMU edit </p><p>i ppay if someone fixe me it.</p></blockquote><p></p>
[QUOTE="Cookiez38, post: 309131, member: 51350"] Hellow, can someone tell me what wrong with this? because i get "ERROR in command "trois" : fatal error encountered during command execution [PHP] case "trois": { Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Session.CharacterInfo.Username)); if (TargetSession == null || !TargetSession.InRoom) { Session.SendData(RoomChatComposer.Compose(Actor.Id, "Could not find " + Session.CharacterInfo.Username + " in this room!", 0, ChatType.Whisper)); return true; } int num1 = 0; int num2 = 0; string str1 = string.Empty; int num3 = 0; string Message = string.Empty; string string2 = MergeParams(@params, 1); int num4 = Session.CharacterInfo.CreditsBalance; if (string2 == null && string.IsNullOrEmpty(string2)) return true; using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient()) { DataRow row1 = MySqlClient.ExecuteQueryRow("SELECT a.*,b.* FROM zaprp_weapons AS a JOIN zaprp_user_weapons AS b ON (a.weapon_id = b.weapon_id) WHERE a.weapon_name = @wepname AND b.user_id = @userid"); MySqlClient.SetParameter("wepname", (object)string2); MySqlClient.SetParameter("userid", (object)Session.CharacterInfo.Id); if (row1 == null) { DataRow row = MySqlClient.ExecuteQueryRow("SELECT weapon_id, weapon_name, cost_credits, clip_size, type FROM zaprp_weapons WHERE weapon_name = @wepname LIMIT 1"); MySqlClient.SetParameter("wepname", (object)string2); if (row != null) { num1 = (int)row["weapon_id"]; num2 = (int)row["cost_credits"]; str1 = (string)row["type"]; string2 = (string)row["weapon_name"]; num3 = (int)row["clip_size"]; } else { Session.SendData(NotificationMessageComposer.Compose("That is an invalid weapon, please type :listweapons to view what is available!")); return true; } } else { Session.SendData(NotificationMessageComposer.Compose("You already own this weapon!")); return true; } } if (num4 >= num2) { using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient()) { MySqlClient.ExecuteNonQuery("REPLACE INTO zaprp_user_weapons (user_id, weapon_id, ammo_loaded, ammo_inventory) VALUES (@userid, @weaponid, @ammoloaded, @ammoinv)"); MySqlClient.SetParameter("userid", (object)Session.CharacterInfo.Id); MySqlClient.SetParameter("weaponid", (object)num1); if (str1 == "gun") { MySqlClient.SetParameter("ammoinv", (object)num3); MySqlClient.SetParameter("ammoloaded", (object)0); Message = "You have successfully purchased a " + string2 + "! You get one clip of " + num3.ToString() + " bullets on the house."; } else { MySqlClient.SetParameter("ammoinv", (object)0); MySqlClient.SetParameter("ammoloaded", (object)0); Message = "You have successfully purchased a " + string2 + ", enjoy it!"; } return true; } SqlDatabaseClient MySqlClients = SqlDatabaseManager.GetClient(); int newcoins = Session.CharacterInfo.CreditsBalance - num2; Session.SendData(CreditsBalanceComposer.Compose(newcoins)); Session.CharacterInfo.UpdateCreditsBalance(MySqlClients, -num2); Session.SendData(RoomChatComposer.Compose(Actor.Id, "*Buys a " + string2 + "*", 0, ChatType.Whisper)); Session.SendData(NotificationMessageComposer.Compose((Message))); } else Session.SendData(NotificationMessageComposer.Compose("You cannot afford to purchase a " + string2 + "!")); } return true;[/PHP] i use REALITYEMU edit i ppay if someone fixe me it. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Weapon command error
Top