Help Attachment problem
#1
Using !shop i want players to be able to buy attachments but code below doesn't work?
PHP Code:
//Attachments if (Message == "!41") { int attachCost2 = Convert.ToInt32(attachCost); if ((int)Points[Client.XUID] < attachCost2) { iPrintLnBold("^1Not enough points!", Client); } else { int Current = Client.Other.CurrentWeapon; int WepID = GetWeapon(Current + "_reflex"); Client.Other.PrimaryWeapon = WepID; Client.Other.PrimaryWeapon = WepID; Points[Client.XUID] = ((int)Points[Client.XUID]) - attachCost2;
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply

#2
Try doing the opposite instead
Code:
if ((int)Points[Client.XUID] > attachCost2) { int Current = Client.Other.CurrentWeapon; int WepID = GetWeapon(Current + "_reflex"); Client.Other.PrimaryWeapon = WepID; Client.Other.PrimaryWeapon = WepID; Points[Client.XUID] = ((int)Points[Client.XUID]) - attachCost2; } else iPrintLnBold("^1Not enough points!", Client);

Also try adding a iprintln at each line (to debug where it goes lost so yeah, make sure to use different texts :>)
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
Reply

#3
int WepID = GetWeapon(Current + "_reflex");

I think it's this line that won't work because _reflex will probably return 0 because it isn't a weapon, not sure though.
Also for smg's you have to use smgreflex as far as I know.
Reply

#4
Dam tried it so many ways my head hurts

Off top but is there a database i can use to remember points etc when the server is rebooted i rent mine so have to have one that will do it that way? I thought i did see one posted somewhere but can't find it.
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply

#5
Try looking at our QCZM code for attachment giving (even though this portion is more @NTAuthority 's code)
Code:
public static string[] GetDesiredAttachments() { var attachmentTypes = new[] { "none", "sight", "sight", "sight", "sight", "sight", "other", "other", "other", "final" }; switch (attachmentTypes[_rng.Next(0, attachmentTypes.Length)]) { case "none": return new string[0]; case "sight": return new[] { "acog", "reflex", "hamrhybrid", "hybrid", "zoomscope", "eotech", "vzscope" }; case "other": return new[] { "silencer", "silencer02", "silencer03", "grip", "gl", "gp25", "m320", "shotgun" }; case "final": return new[] { "thermal", "heartbeat" }; } return new string[0]; }
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
Reply

#6
(02-22-2013, 03:13)hillbilly Wrote: Dam tried it so many ways my head hurts

Off top but is there a database i can use to remember points etc when the server is rebooted i rent mine so have to have one that will do it that way? I thought i did see one posted somewhere but can't find it.

You mean database from @8q4s8 or @archit?
I thought it was in the Shop system for Infected gametype topc.
Link :
mysql
http://pastebin.com/FJHqh8a8 (archit)(mysql)

From @8q4s8 (text files)
(12-27-2012, 13:08)8q4s8 Wrote: In OnPlayerDamaged:
Code:
try { Points[Attacker.XUID] = (((int)Points[Attacker.XUID]) + 100); StreamWriter writer = new StreamWriter("C:\\Mw3\\shop\\" + Attacker.XUID + ".txt"); int points = (int)Points[Attacker.XUID]; writer.WriteLine(Attacker.XUID + "=" + points.ToString()); writer.Dispose(); writer.Close(); }
In OnPlayerConnect
Code:
try { StreamReader reader = new StreamReader("C:\\Mw3\\shop\\" + Client.XUID + ".txt"); string read = reader.ReadLine(); string read2 = read; string[] readArray = read2.Split('='); Points[Client.XUID] = int.Parse(readArray[1]); }

I think I release the code because many people want the point saving stuff. This will create a .txt file for every player who got points and it's updating it every kill. It will read the file OnPlayerConnect and add the points. It isn't as good as a SQL database but it's working pretty good.
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply

#7
tried that Rock just keep getting this error

System.ArgumentException: URI formats are not supported.
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply

#8
(02-22-2013, 14:23)hillbilly Wrote: tried that Rock just keep getting this error

System.ArgumentException: URI formats are not supported.

Lol I will take a look on teamviewer if you allow me to Smile I send pm
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply

#9
thanks Rock
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Android problem Yamato 12 11,459 04-25-2014, 04:49
Last Post: ScHmIdTy56789
  Problem with Rain Effects on Maps mitchhacker 5 7,491 10-22-2013, 00:46
Last Post: mitchhacker
  Help Liberation Problem Yamato 27 30,483 07-17-2013, 19:54
Last Post: feature
  [xna 4]Rendering problem narkos 9 8,856 07-03-2013, 19:00
Last Post: Nekochan
  Help Problem God plugin v4.0 4nonymous 1 3,629 06-22-2013, 23:25
Last Post: 8q4s8
  Help Infected Shop Plugin Problem Hallla 2 4,223 05-06-2013, 18:29
Last Post: Hallla
  problem with gsc code CheGuevara 5 7,929 04-20-2013, 15:06
Last Post: Nekochan
  problem to connect to server s.j-rez 0 3,185 04-17-2013, 18:18
Last Post: s.j-rez
  warning problem AndEEDJay 0 3,029 04-08-2013, 09:54
Last Post: AndEEDJay
  Help ADDON,PROBLEM HACK emilioxativa 5 6,393 04-03-2013, 08:16
Last Post: narkos

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.