PDA

View Full Version : M4/AK script from eventscript to sourcemod


robdeniro
06-02-2009, 13:41
Hello guys!

I 've a short request: Our M4/AK script is running with eventscript atm and we need to get it changed to sourcemod as it costs us too much server-resources.
Is there anyone who can help us with this?
Just reply and you get the details!

Thanks a lot in advance

greetz rob

bl4nk
06-02-2009, 18:01
Moved to the proper forum. Give us a description of what the plugin does and you'll most likely get a response on if someone will do it for you or not.

robdeniro
06-03-2009, 11:24
Ok thanks for your help bl4nk.
Here my description of what the script does:

The Terrorteam is able to buy M4 and AUG in their buyzone by writing "!m4" or "!aug" in the chat. The CT-Team has the same options with the AK and Krieg by typing "!ak" and "!krieg". The chat commands can be changed to anything else if necessary, because most of the ppl use a bind key to buy those weapons. Attached to the post you can find the actual script.

I hope somenone can help us.

Rob

Fyren
06-04-2009, 15:08
I'm surprised I couldn't find this in the approved plugins, but maybe I didn't look hard enough. I don't actually have CSS installed so I can't test, but you can try this. !ak, !m4, !au, !sg in chat while in a buyzone (or /ak in chat, or sm_ak in console, etc.).

robdeniro
06-04-2009, 16:09
Thanks a lot Fyren!

We will test the script now and reply again :)

robdeniro
06-05-2009, 10:28
Hi Fyren,

Your script is working well so far!
We have only two things, perhaps you can include them:
1. a message coming up each round that T's can buy M4 and AUG by pushing "!m4" or "!au" into chat and the same for the CT's with "!ak" and "!sg".
2. the guns are dropping to the ground at the moment. Is it possible to script it that you have them in your hands automatically?

Looking forward to hear from you :)

Fyren
06-07-2009, 21:14
Again, couldn't really test without CS. If you want colors or something, find someone else to do that, since I don't want to try without being able to see the text myself.

Der Moppel
01-26-2012, 03:06
Hello,

is it possible to rewrite it, that you get one of the weapons automaticly at the roundstart, boundet to steam idīs?

Regards

Doulos
08-30-2014, 20:17
I know I am resurrecting an old post. But....

I am trying to modify the above AKM4 version by Fyren to include more weapons but am having a problem. Everything works fine when I add other rifles, but the problem arises when I try to include pistols. When a player uses the command to get the AK the current rifle he has disappears and the new one appears in his hands. I am able to get different pistols after adding them to the plugin, but when the new one does not replace the current pistol with the old but instead throws it onto the ground. Any ideas?#include <sourcemod>
#include <sdktools>

public Plugin:myinfo =
{
name = "AKM4-2",
author = "",
description = "",
version = "",
url = ""
}

#define NWEAPONS 7
new String:commands[NWEAPONS][] = { "sm_ak", "sm_m4", "sm_au", "sm_sg", "sm_ga", "sm_fa", "sm_el" };
new String:weapons[NWEAPONS][] = { "weapon_ak47", "weapon_m4a1", "weapon_aug", "weapon_sg552", "weapon_galil", "weapon_famas", "weapon_elite" };

public OnPluginStart()
{
for (new i = 0; i < NWEAPONS; i++)
RegConsoleCmd(commands[i], akm4);

HookEvent("round_start", rs);
}

public Action:rs(Handle:event, String:name[], bool:broadcast)
{
decl String:msg[192];
msg[0] = '\0';
strcopy(msg, sizeof(msg), "Say");

for (new i = 0; i < NWEAPONS - 1; i++)
Format(msg, sizeof(msg), "%s%s%s%s", msg, " !", commands[i][3], ",");
Format(msg, sizeof(msg), "%s%s%s%s", msg, " or !", commands[NWEAPONS - 1][3], " for weapons.");

PrintToChatAll(msg);
}

public Action:akm4(client, args)
{
if (!IsClientInGame(client) || !IsPlayerAlive(client) || !GetEntProp(client, Prop_Send, "m_bInBuyZone"))
return Plugin_Handled;

decl String:cmd[64];
GetCmdArg(0, cmd, sizeof(cmd));

new found;
new weapon = -1;

while (!found && (weapon++ < NWEAPONS))
found = StrEqual(cmd, commands[weapon]);

if (found)
{
new old = GetPlayerWeaponSlot(client, 0);
if (old != -1)
{
RemovePlayerItem(client, old);
RemoveEdict(old);
}

GivePlayerItem(client, weapons[weapon]);
}

return Plugin_Handled;
}