Raised This Month: $ Target: $400
 0% 

Giving a frag, ARGs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
t3hNox
Senior Member
Join Date: Oct 2009
Old 11-06-2009 , 16:35   Giving a frag, ARGs
Reply With Quote #1

It's my third attempt to try to script something. I was trying to make something that includes client command usage and arguments - simple frag giving.
Code:
#include <amxmodx>
#include <fun>
#include <amxmisc>

public plugin_init() {
	register_plugin("Give Frag", "0.1", "Nick");
	register_clcmd("say /give", "CmdGive");
}

public cmdGive(id, level, cid) {
	new arg[32], name2[32], name[32]
	read_argv(1, arg, 31)
	new player = cmd_target(id, arg)
	
	if (!player)
		return PLUGIN_HANDLED
	
	get_user_name(player, name2, 31)   
	get_user_name(id, name, 31)

	if (is_user_bot(player)){
		client_print( id, print_chat, "[Frag] Client ^"%s^" is a bot, no acton was taken.", name2)
		return PLUGIN_HANDLED
	}
	if(!is_user_alive(id)){
		client_print( id, print_chat, "[Frag] You cannot give frags while dead !")
		return PLUGIN_HANDLED
	}
	if(get_user_flags(id) > 1){
		set_user_frags(id, get_user_flags(id) - 1)
		set_user_frags(player, get_user_flags(player) + 1)
		client_print( id, print_chat, "[Frag] You gave 1 frag to %s.", name2)
		client_print( player, print_chat, "[Frag] %s gave you 1 frag.", name)
	}
	else
	{
		client_print( id, print_chat, "[Frag] You don't have any frags to give !")
	}	
	return PLUGIN_HANDLED
}
I've no doubt that this code may be badly written. I'm just trying things out. As it completed with no errors and server's console showed nothing I want to figure out what is wrong.
t3hNox is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-06-2009 , 16:38   Re: Giving a frag, ARGs
Reply With Quote #2

get_user_flags -> get_user_frags
__________________
Arkshine is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 11-07-2009 , 06:58   Re: Giving a frag, ARGs
Reply With Quote #3

Lol. Thanks
t3hNox 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 17:45.


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