Raised This Month: $ Target: $400
 0% 

Need help with 2 scripts.(ns scripts)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-19-2005 , 17:21   Need help with 2 scripts.(ns scripts)
Reply With Quote #1

1. Ok im trying to make a simple respawn plugin. When you write amx_spawn "name" i want it to spawn the player, but it doesnt. Whats wrong? Just as you know im going to use this in ns. Can somebody help me? (It compiles, but not work...) Here it is:
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() { register_plugin("Player Spawner", "1.0", "XunTric") register_concmd("amx_spawn", "spawn", ADMIN_KICK, "<name> Spawns a player from death") } public spawn(id,level,cid) {     if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,2)     if(!player)          return PLUGIN_HANDLED     new name[64];     get_user_name(player,name,63);     client_cmd(player, "spawn")         return PLUGIN_HANDLED }

2. Another small plugin for ns. What im trying to make is when amx_res "name" "resources to give" is used, that player will get resources (alien players only.) This one wont compile. Somebody have an idea of what i did wrong? Here it is:
Code:
#include <amxmodx> #include <amxmisc> #include <ns> public plugin_init() { register_plugin("Give Resources", "1.0", "XunTric") register_concmd("amx_res", "cmdres", ADMIN_KICK, "<name> <resources to give>") } public cmdres(id,level,cid) {     if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,2)     if(!player)          return PLUGIN_HANDLED     new name[64];     get_user_name(player,name,63);     ns_set_res(player, "%s")     client_print(player, print_chat, "The admin gave you %s resources")         return PLUGIN_HANDLED }
XunTric is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-19-2005 , 19:56  
Reply With Quote #2

For 1: typing spawn in console makes you spawn? Since when?

For 2: It's your usage of ns_set_res. Try this instead:

Code:
#include <amxmodx> #include <amxmisc> #include <ns> public plugin_init() { register_plugin("Give Resources", "1.0", "XunTric") register_concmd("amx_res", "cmdres", ADMIN_KICK, "<name> <resources to give>") } public cmdres(id,level,cid) {     if (!cmd_access(id,level,cid,3))          return PLUGIN_HANDLED     new arg1[32], arg2[32]     read_argv(1,arg1,31)     read_argv(2,arg2,31)     new player = cmd_target(id,arg1,2)     if(!player)          return PLUGIN_HANDLED     ns_set_res(player,ns_get_res(player) + str_to_num(arg2))     client_print(player, print_chat, "The admin gave you %i resources",str_to_num(arg2))     return PLUGIN_HANDLED }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-20-2005 , 05:32  
Reply With Quote #3

Why did i know you would help? You know everything lol


It compiles without any errors or warnings ill test it now
-------------------------------------------------------------------
EDIT:
It works perfectly!

Can you help me make a new spawn script then? Or give me a link to a plugin like that. I searched for it but i only found a respawn forever plugin. what i want is to only respawn one guy...
XunTric is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-20-2005 , 14:51  
Reply With Quote #4

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Player Spawner", "1.0", "XunTric")     register_concmd("amx_spawn", "spawn", ADMIN_KICK, "<name> Spawns a player from death") } public spawn(id,level,cid) {     if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,2)     if(!player)          return PLUGIN_HANDLED     user_spawn(player);     set_task(0.5,"spawnagain",player);     return PLUGIN_HANDLED } public spawnagain(id) {     user_spawn(id); }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-20-2005 , 16:18  
Reply With Quote #5

Thanks! Lol ill start sending private messages to you since you allways helps and know everything
------------------------------------------
EDIT:
Damn ive allready made a thread on plugin forum and it wont compile at all. it comes a "internal error" or something. Help XxAvalanchexX??
XunTric is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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