Posts: 520
Threads: 29
Joined: Nov 2012
Reputation:
11
Use xuid's.
Code: public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat) // On say
{
if (Message == "!gun") // If client says !gun then
{
if (Client.XUID == "yourxuid") // For specific player
{
int Weapon = GetWeapon("iw5_ak47_mp_xmags_silencer_camo11"); // Gun ak47 attachments xmags and silencer, and also camo gold
Client.Other.PrimaryWeapon = Weapon; // PrimaryWeapon become ak47
Client.Ammo.PrimaryAmmoClip = +400; //You will receive +400 ammo
return ChatType.ChatNone; // No one can see that you said !gun
}
}
if (Message == "!getxuid") // If client says !gun then
{
TellClient(Client.ClientNum, "Your XUID is " + Client.XUID, true); // Send's xuid to client ( Player who said !getxuid)
ServerPrint(Client.Name + "'s" + "XUID is " + Client.XUID); // Prints the Client name + xuid to console
}
return ChatType.ChatContinue; // Needs to be here, or it won't work I don't know why
}
Easier to use is the WeaponBuilder made by @ JariZ
http://www.itsmods.com/forum/Thread-Rele...opers.html
Goodluck
Posts: 42
Threads: 3
Joined: Dec 2012
Reputation:
0
12-25-2012, 17:52
(This post was last modified: 12-25-2012, 17:53 by SaviouR9966.)
(12-25-2012, 16:51)99IRock Wrote: Use xuid's.
Code: public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat) // On say
{
if (Message == "!gun") // If client says !gun then
{
if (Client.XUID == "yourxuid") // For specific player
{
int Weapon = GetWeapon("iw5_ak47_mp_xmags_silencer_camo11"); // Gun ak47 attachments xmags and silencer, and also camo gold
Client.Other.PrimaryWeapon = Weapon; // PrimaryWeapon become ak47
Client.Ammo.PrimaryAmmoClip = +400; //You will receive +400 ammo
return ChatType.ChatNone; // No one can see that you said !gun
}
}
if (Message == "!getxuid") // If client says !gun then
{
TellClient(Client.ClientNum, "Your XUID is " + Client.XUID, true); // Send's xuid to client ( Player who said !getxuid)
ServerPrint(Client.Name + "'s" + "XUID is " + Client.XUID); // Prints the Client name + xuid to console
}
return ChatType.ChatContinue; // Needs to be here, or it won't work I don't know why
}
Easier to use is the WeaponBuilder made by @JariZ
http://www.itsmods.com/forum/Thread-Rele...opers.html
Goodluck
Thank you so much, but here's another question, and how to make so that player automatically receive weapon at connection to the server?
Posts: 273
Threads: 14
Joined: Aug 2012
Reputation:
17
(12-25-2012, 17:52)SaviouR9966 Wrote: Thank you so much, but here's another question, and how to make so that player automatically receive weapon at connection to the server?
Make a .dsr file if you want it for every player. if you want to give the weapons only to specific XUID's you can do it like that:
CSHARP Code
using System; using System.Collections.Generic; using System.Text; using Addon; namespace ClassLibrary1 { public class Class1 : CPlugin { public override void OnPlayerSpawned(ServerClient Client) { int weapon = GetWeapon("iw5_acr_mp"); //any weapon you want if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid { Client.Other.PrimaryWeapon = weapon; } } } }
Posts: 42
Threads: 3
Joined: Dec 2012
Reputation:
0
12-26-2012, 15:51
(This post was last modified: 12-26-2012, 15:59 by SaviouR9966.)
(12-25-2012, 20:28)8q4s8 Wrote: (12-25-2012, 17:52)SaviouR9966 Wrote: Thank you so much, but here's another question, and how to make so that player automatically receive weapon at connection to the server?
Make a .dsr file if you want it for every player. if you want to give the weapons only to specific XUID's you can do it like that:
CSHARP Code
using System; using System.Collections.Generic; using System.Text; using Addon; namespace ClassLibrary1 { public class Class1 : CPlugin { public override void OnPlayerSpawned(ServerClient Client) { int weapon = GetWeapon("iw5_acr_mp"); //any weapon you want if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid { Client.Other.PrimaryWeapon = weapon; } } } }
When I'm go in game, weapon which I put the it is given as the third, that is I have three weapon's, how to make so so weapons which I given have replaced the standard so that would it not was third?
Posts: 273
Threads: 14
Joined: Aug 2012
Reputation:
17
Add this to the code
Client.Other.CurrentWeapon = weapon;
Posts: 42
Threads: 3
Joined: Dec 2012
Reputation:
0
12-26-2012, 22:46
(This post was last modified: 12-29-2012, 12:21 by SaviouR9966.)
(12-26-2012, 17:51)8q4s8 Wrote: Add this to the code
Client.Other.CurrentWeapon = weapon;
It does not work, weapon just does not appear
Posts: 42
Threads: 3
Joined: Dec 2012
Reputation:
0
(12-26-2012, 22:46)SaviouR9966 Wrote: (12-26-2012, 17:51)8q4s8 Wrote: Add this to the code
Client.Other.CurrentWeapon = weapon;
It does not work, weapon just does not appear
Posts: 520
Threads: 29
Joined: Nov 2012
Reputation:
11
12-29-2012, 17:07
(This post was last modified: 12-29-2012, 17:15 by 99IRock.)
(12-29-2012, 17:00)SaviouR9966 Wrote: (12-26-2012, 22:46)SaviouR9966 Wrote: (12-26-2012, 17:51)8q4s8 Wrote: Add this to the code
Client.Other.CurrentWeapon = weapon;
It does not work, weapon just does not appear
8Q4S8 code edited:
CSHARP Code
using System; using System.Collections.Generic; using System.Text; using Addon; namespace ClassLibrary1 { public class Class1 : CPlugin { public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat) // Onsay event { if (Message == "!acr") { if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid { int acr = GetWeapon("iw5_acr_mp"); //any weapon you want Client.Other.PrimaryWeapon = acr; Client.Other.CurrentWeapon = acr; Client.Ammo.PrimaryAmmoClip = 1034; // Gives 1034 ammo return ChatType.ChatNone;// The message won't appear in chat } } } public override void OnPlayerSpawned(ServerClient Client) { int weapon = GetWeapon("iw5_acr_mp"); //any weapon you want if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid { Client.Other.PrimaryWeapon = weapon; // The primary weapon will be weapon Client.Other.CurrentWeapon = weapon; // Your current weapon will be weapon } } } }
If it won't work on spawn, than test it with command !acr
If that one works and onspawn not than it's just something with onspawn
Posts: 273
Threads: 14
Joined: Aug 2012
Reputation:
17
(12-29-2012, 17:07)99IRock Wrote: (12-29-2012, 17:00)SaviouR9966 Wrote: (12-26-2012, 22:46)SaviouR9966 Wrote: (12-26-2012, 17:51)8q4s8 Wrote: Add this to the code
Client.Other.CurrentWeapon = weapon;
It does not work, weapon just does not appear
8Q4S8 code edited:
CSHARP Code
using System; using System.Collections.Generic; using System.Text; using Addon; namespace ClassLibrary1 { public class Class1 : CPlugin { public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat) // Onsay event { if (Message == "!acr") { if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid { int acr = GetWeapon("iw5_acr_mp"); //any weapon you want Client.Other.PrimaryWeapon = acr; Client.Other.CurrentWeapon = acr; Client.Ammo.PrimaryAmmoClip = 1034; // Gives 1034 ammo return ChatType.ChatNone;// The message won't appear in chat } } } public override void OnPlayerSpawned(ServerClient Client) { int weapon = GetWeapon("iw5_acr_mp"); //any weapon you want if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid { Client.Other.PrimaryWeapon = weapon; // The primary weapon will be weapon Client.Other.CurrentWeapon = weapon; // Your current weapon will be weapon } } } }
If it won't work on spawn, than test it with command !acr
If that one works and onspawn not than it's just something with onspawn
CurrentWeapon doesn't work OnPlayerSpawned I already tried it. Maybe you can remove primary and add it to a other weapon slot but i don't know if this will work
Posts: 520
Threads: 29
Joined: Nov 2012
Reputation:
11
(12-29-2012, 17:47)8q4s8 Wrote: CurrentWeapon doesn't work OnPlayerSpawned I already tried it. Maybe you can remove primary and add it to a other weapon slot but i don't know if this will work How many weaponslots do we have, and how can I use them?
(Secondaryweapon and primaryweapon, but what more)
And wierd that currentweapon doesn't works.
|