AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Give Item Plugin [HELP] (https://forums.alliedmods.net/showthread.php?t=17368)

Mr. Satan 08-30-2005 14:41

Give Item Plugin [HELP]
 
Why wont this work?!

It compiles fine, no errors. However, it is like the command isn't registered at all.

Code:
// GIVING CLIENT ITEMS PVK v1.2b by Dewd In The Newd //========================================================= #include <amxmod> #include <amxmisc> public give_item_pvk(admin_index,victim_index,weapon_give[]) {    new arg1[32]    read_argv(1,arg1,32)    new name[32]    get_user_name(victim_index,name,32)   // Remove The slashes before the follow 2 lines of code to enable info messages    // set_hudmessage(200, 50, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)    // show_hudmessage(0,"%s Has Been Given An Attack",name)     // Items        if (equal(weapon_give,"all")){       give_item(victim_index,"item_chainmail")       give_item(victim_index,"item_food")       give_item(victim_index,"item_leather")       give_item(victim_index,"item_platemail")       give_item(victim_index,"item_treasurechest")    } else if (equal(weapon_give,"chainmail")){       give_item(victim_index,"item_chainmail")    } else if (equal(weapon_give,"food")){       give_item(victim_index,"item_food")    } else if (equal(weapon_give,"leather")) {       give_item(victim_index,"item_leather")    } else if (equal(weapon_give,"platemail")){       give_item(victim_index,"item_platemail")    } else if (equal(weapon_give,"tchest")){       give_item(victim_index,"item_treasurechest")    } else {       client_print(admin_index,print_console,"[AMXX] There is no such item")       return PLUGIN_CONTINUE    }        // client_print(admin_index,print_console,"[AMXX] Client ^"%s^" has been given an item",name)    return PLUGIN_CONTINUE } public admin_item_pvk(id) {    if (!(get_user_flags(id)&ADMIN_LEVEL_A)) {       client_print(id,print_console,"[AMXX] You have no access to that command")       return PLUGIN_HANDLED    }    new argc = read_argc()    if (argc < 3) {       client_print(id,print_console,"[AMXX] Usage: amx_item_pvk < part of nick > or < # index > < item to give >")       return PLUGIN_HANDLED    }    new arg1[32]    new arg2[32]    new arg3[32]    read_argv(1,arg1,32)    read_argv(2,arg2,32)    read_argv(3,arg3,32) //Index    if (equal(arg1,"#")) {       if (is_user_connected(str_to_num(arg2))) {          give_item_pvk(id,str_to_num(arg2),arg3)       } else {          client_print(id,print_console,"[AMXX] Client not found")       }    } else {       new player = find_player("lb",arg1)       if (player) {          give_item_pvk(id,player,arg2)       } else {          client_print(id,print_console,"[AMXX] Client with that part of nick not found")       }    }        return PLUGIN_HANDLED } public plugin_init() {    register_plugin("PVK Give Items","1.2b","Dewd In The Newd")    register_concmd("amx_item_pvk","admin_item_pvk",ADMIN_LEVEL_A,"<part of nick> or <# index> <item to give>")    return PLUGIN_CONTINUE }

Zenith77 08-30-2005 16:45

Quote:

public plugin_init()
{
register_plugin("PVK Give Items","1.2b","Dewd In The Newd")
register_concmd("amx_item_pvk","admin_item_pv k",ADMIN_LEVEL_A,"<part of nick> or <# index> <item to give>")
return PLUGIN_CONTINUE
}

take that out...its forwarding it :/

Hawk552 08-30-2005 16:54

Quote:

Originally Posted by Zenith77
Quote:

public plugin_init()
{
register_plugin("PVK Give Items","1.2b","Dewd In The Newd")
register_concmd("amx_item_pvk","admin_item_pv k",ADMIN_LEVEL_A,"<part of nick> or <# index> <item to give>")
return PLUGIN_CONTINUE
}

take that out...its forwarding it :/

What are you talking about? plugin_init needs no return. He could put PLUGIN_HANDLED, CONTINUE, or nothing, and it would do the same thing

XxAvalanchexX 08-30-2005 17:02

Hmm, let's try re-writing this a bit.

Code:
// GIVING CLIENT ITEMS PVK v1.2b by Dewd In The Newd //========================================================= #include <amxmodx> #include <amxmisc> #include <fun> public give_item_pvk(admin_index,victim_index,weapon_give[]) {    new name[32]    get_user_name(victim_index,name,31)      // Remove The slashes before the follow 2 lines of code to enable info messages    // set_hudmessage(200, 50, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)    // show_hudmessage(0,"%s Has Been Given An Attack",name)      if (equali(weapon_give,"all")){       give_item(victim_index,"item_chainmail")       give_item(victim_index,"item_food")       give_item(victim_index,"item_leather")       give_item(victim_index,"item_platemail")       give_item(victim_index,"item_treasurechest")    } else {       new item[32]       format(item,31,"item_%s",weapon_give)       give_item(victim_index,item)    }        // client_print(admin_index,print_console,"[AMXX] Client ^"%s^" has been given an item",name) } public admin_item_pvk(id,level,cid) {    if(!cmd_access(id,level,cid,3)) {       return PLUGIN_HANDLED    }    new arg1[32]    new arg2[32]    read_argv(1,arg1,31)    read_argv(2,arg2,31)    new target = cmd_target(id,arg1,6)    if(!target) {       return PLUGIN_HANDLED    }    give_item_pvk(id,target,arg2)    return PLUGIN_HANDLED } public plugin_init() {    register_plugin("PVK Give Items","1.2b","Dewd In The Newd")    register_concmd("amx_item_pvk","admin_item_pvk",ADMIN_LEVEL_A,"<player> <item>") }

Mr. Satan 08-30-2005 19:11

Still doesn't work.

Unknown Command: amx_item_pvk

XxAvalanchexX 08-30-2005 19:27

Are there any load errors in the server's console?

Mr. Satan 08-30-2005 19:29

Nope

XxAvalanchexX 08-30-2005 19:33

Just tested it on my server and it works fine besides that fact that it isn't Pirates, Vikings, and Knights so I can't receive the items. If I give it invalid arguments it shows me the correct usage and if I use the correct usage the command goes through and doesn't say unknown command. It must be something on your part.

Mr. Satan 08-30-2005 19:50

I'm running AMXX 1.55.

No compiling errors or anything. I copied it straight from the forums.

I made the plugin from another plugin I made for ESF, the ESF one works, but on PVK it doesn't.


All times are GMT -4. The time now is 14:17.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.