hallo leute! bin neu hier und plage mich schon mehrer tage mit folgendem problem herum:
die weaponrestriction funktioniert nicht!
einstellungen sind alle auf default, hab cod4 v1.7 / MAM 0.9.2 beta drauf laufen und sonst funktioniert auch alles. aber nur die funktion weaponrestriction will nicht. möchte gerne keine noobtubes und marty.. auf unserem server. doch wenn man es verwendet, bekommt man nicht mal ne warnung. jez weiß ich nicht mehr weiter und hoffe auf eure hilfe/erfahrung!
anbei meine daten:
Spoiler anzeigen
[weaponrestrictions]
enabled = 1
weapons = "gl,frag_grenade_short"
warnstokick = 2
mode = "tempban"
kickreason = "Used a restricted weapon: <WEAPON>"
PHP
<?php
/*
PLUGIN: Weaponrestrictions
================
Kicks players automatically when they are using a restricted weapon
CONFIG:
-------
[weaponrestrictions]
enabled = 1 ;Enable plugin
weapons = "gl,frag_grenade_short" ;restricted weapons
warnstokick = 2 ;Warns until players get kicked
mode = "tempban" ;kick/ban/tempban
kickreason = "Used a restricted weapon: <WEAPON>" ;Reason of the kick
NAMESPACE: weaponrestrictions
Functions:
weaponrestrictions_main
weaponrestrictions_playerInit
*/
$mod->setDefaultCV("weaponrestrictions", "enabled", 1);
$mod->setDefaultCV("weaponrestrictions", "weapons", "");
$mod->setDefaultCV("weaponrestrictions", "warnstokick", 2);
$mod->setDefaultCV("weaponrestrictions", "mode", "tempban");
$mod->setDefaultCV("weaponrestrictions", "kickreason", "Used a restricted weapon: <WEAPON>");
$mod->registerEvent("playerJoined", "weaponrestrictions_playerInit");
$mod->registerEvent("playerKill", "weaponrestrictions_main");
$mod->registerEvent("playerTeamKill", "weaponrestrictions_main");
//Init Players because playerJoined isn't called at startup
array_map("weaponrestrictions_playerInit", array_keys($players));
function weaponrestrictions_main($parameters) {
global $mod;
global $players;
global $logging;
list($killer_guid, $victim_guid, $weapon) = $parameters;
if ($weapon[1] == "MOD_MELEE") {
//Dont warn when player knived while he had a restricted weapon
return;
}
$weapon = $weapon[0];
if (!$mod->getCV("weaponrestrictions", "enabled")) {
return;
}
if ($players[$killer_guid]->isProtected()) {
return;
}
$weapons = explode(",", $mod->getCV("weaponrestrictions", "weapons"));
$restricted = false;
foreach ($weapons as $value) {
if (strpos($weapon, $value . "_") === 0) {
$restricted = true;
break;
}
}
if (!$restricted) return ;
$players[$killer_guid]->weaponrestrictions_warns ++;
$weaponlong = $mod->getLongWeaponName($weapon);
if ($players[$killer_guid]->weaponrestrictions_warns >= $mod->getCV("weaponrestrictions", "warnstokick")) {
switch ($mod->getCV("weaponrestrictions", "mode")) {
case "tempban":
$players[$killer_guid]->tempBan(str_replace("<WEAPON>", $weaponlong, $mod->getCV("weaponrestrictions", "kickreason")));
break;
case "kick":
$players[$killer_guid]->kick(str_replace("<WEAPON>", $weaponlong, $mod->getCV("weaponrestrictions", "kickreason")));
break;
case "ban":
$players[$killer_guid]->ban(str_replace("<WEAPON>", $weaponlong, $mod->getCV("weaponrestrictions", "kickreason")));
break;
}
}
else {
$players[$killer_guid]->say($mod->getLngString("usedRestrictedWeapon", array("<WEAPON>"), array($weaponlong)));
$logging->write(MOD_NOTICE, "Player '".$players[$killer_guid]->getName()."' has been warned for using restricted weapon: $weapon, PID: ".$players[$killer_guid]->getPID().", GUID: ".$killer_guid);
}
}
function weaponrestrictions_playerInit($guid) {
$GLOBALS['players'][$guid]->weaponrestrictions_warns = 0;
}
?>
Alles anzeigen
mfg
tiga