插件error问题(与giveoutmoney并用中)(已解决)
本帖最后由 cityhonghu 于 2009-10-4 12:02 编辑出现error提示的插件为plugin_bonus.amxx,提示如下
请问要如何改源码呢? 谢谢
L 09/22/2009 - 00:33:04: Displaying debug trace (plugin "plugin_bonus.amxx")
L 09/22/2009 - 00:33:04: Run time error 10: native error (native "cs_set_user_money")
L 09/22/2009 - 00:33:04: amxmod.inc::set_user_money (line 47)
L 09/22/2009 - 00:33:04: plugin_bonus.sma::event_death (line 60)
plugin_bonus源码如下/*
* AMXMOD script.
* (plugin_bonus1.sma)
* by DreamZSW <DreamZSW@hotmail.com>
* This file is provided as is (no warranties).
*
*/
#include <amxmod>
#include <unlimited_money>
#define MAX_NAME_LENGTH 32
#define MAX_TEXT_LENGTH 512
#define ACCESS_LEVEL ADMIN_LEVEL_A
// Default on/off
new gBonusMode = 1
new gBonusCount = 0
new gBonusIndex = { 50000, 20000, 10000, 8000, 5000 }
public admin_bonuskill(id)
{
// Check access level
if (!(get_user_flags(id)&ACCESS_LEVEL)) {
console_print(id," You have no access to that command")
return PLUGIN_HANDLED
}
// Check arguments
if (read_argc() < 2) {
console_print(id," Usage: amx_bonuskill < 1 | 0 >")
return PLUGIN_HANDLED
}
new sArg1
read_argv(1,sArg1,MAX_NAME_LENGTH)
if (str_to_num(sArg1)) {
gBonusMode = 1
client_print(id,print_console," Bonus money for kills is now ON.")
}
else {
gBonusMode = 0
client_print(id,print_console," Bonus money for kills is now OFF.")
}
return PLUGIN_HANDLED
}
public event_death()
{
if (gBonusMode) {
new iKiller = read_data(1)
new iVictim = read_data(2)
new sMsg
new sName
get_user_name(iKiller,sName,MAX_NAME_LENGTH)
if ((iKiller != iVictim) && (gBonusCount < sizeof gBonusIndex) && (get_user_team(iKiller) != get_user_team(iVictim))) {
gBonusCount++
set_user_money(iKiller,cs_get_user_money2(iKiller)+gBonusIndex)
if (gBonusCount == 1) {
format(sMsg,MAX_TEXT_LENGTH,"奖励第一杀手 %s^n金钱 +$%i",sName,gBonusIndex)
client_cmd(0, "spk misc/coin01")
set_hudmessage(200, 100, 0, 0.01, 0.65, 0, 4.0, 4.0, 0.5, 0.15, 1)
}
else if (gBonusCount == 2) {
format(sMsg,MAX_TEXT_LENGTH,"奖励第二杀手 %s^n金钱 +$%i",sName,gBonusIndex)
client_cmd(0, "spk misc/coin02")
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.01, 0.65, 0, 3.0, 3.0, 0.5, 0.15, 1)
}
else if (gBonusCount == 3) {
format(sMsg,MAX_TEXT_LENGTH,"奖励第三杀手 %s^n金钱 +$%i",sName,gBonusIndex)
client_cmd(0, "spk misc/coin03")
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.01, 0.65, 0, 3.0, 3.0, 0.5, 0.15, 1)
}
else if (gBonusCount == 4) {
format(sMsg,MAX_TEXT_LENGTH,"奖励第四杀手 %s^n金钱 +$%i",sName,gBonusIndex)
client_cmd(0, "spk misc/coin04")
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.01, 0.65, 0, 3.0, 3.0, 0.5, 0.15, 1)
}
else {
format(sMsg,MAX_TEXT_LENGTH,"奖励第五杀手 %s^n金钱 +$%i",sName,gBonusIndex)
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.01, 0.65, 0, 3.0, 3.0, 0.5, 0.15, 1)
}
show_hudmessage(0,sMsg)
}
}
return PLUGIN_CONTINUE
}
public event_round_end() {
gBonusCount = 0
}
public plugin_precache(){
precache_sound( "misc/coin01.wav")
precache_sound( "misc/coin02.wav")
precache_sound( "misc/coin03.wav")
precache_sound( "misc/coin04.wav")
return PLUGIN_CONTINUE
}
/************************************************************
* PLUGIN FUNCTIONS
************************************************************/
public plugin_init()
{
register_plugin("Plugin Money Bonus","1.0","DreamZSW")
register_event("DeathMsg","event_death","a")
register_event("SendAudio","event_round_end","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
register_concmd("amx_bonuskill","admin_bonuskill",ACCESS_LEVEL,"amx_powers < authid | part of nick >")
}
試試看吧
我是覺得少了
#include <amxmodx>
#include <cstrike> 本帖最后由 sakulekingz 于 2009-9-22 00:54 编辑
is_user_connected
cs_get_user_money2
cs_set_user_money2只用
#include <amxmodx>
#include <unlimited_money>
就够了 本帖最后由 sakulekingz 于 2009-9-22 00:52 编辑
if ((iKiller != iVictim) && (gBonusCount < sizeof gBonusIndex) && (get_user_team(iKiller) != get_user_team(iVictim)))
改成
if ((iKiller != iVictim) && (gBonusCount < sizeof gBonusIndex) && (get_user_team(iKiller) != get_user_team(iVictim)) && is_user_connected(iKiller))cs_get_user_money 换成 cs_get_user_money2
set_user_money 换成 cs_set_user_money2 谢谢2位,2种都试试看。
页:
[1]