Raised This Month: $ Target: $400
 0% 

Plugin not working properly


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
asdff
Junior Member
Join Date: Jun 2009
Old 05-03-2011 , 10:18   Plugin not working properly
Reply With Quote #1

Hello,
I wanted to modify a plugin that makes screenshots on players to log the ss action when an admin makes some ss.
The plugins successfully logs the action but I have one problem. I made it to log the admin that makes ss, his ip and steamid, the players that takes ss, his ip and steamid, and how many ss he made. But the thing is that he writes the correct information about the admin and the number of ss, but he writes wrong about the player name,ip,steamid. Instead of player name I get the server name, and instead of his ip I get the server ip.

Can someone tell me what I did wrong please?
Here is the code:
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

new player
new ip[32], ip2[32]
new finish;

new maxscreens
new screeninterval
new design
public plugin_init() 
{ 
	register_plugin("Ultimate SS", "1.1", "SS")
	
	register_concmd("amx_ss", "concmd_screen", ADMIN_LEVEL_A, "<authid, nick or #userid> <screens>")
	register_clcmd("say /ip", "show_ip")
	
	maxscreens = register_cvar("amx_ss_max", "5")
	screeninterval = register_cvar("amx_ss_interval", "2.0")
	design = register_cvar("amx_ss_design", "3")
}

public concmd_screen(id, level, cid)
{
	if(!cmd_access(id, level, cid, 3))
	{
		return PLUGIN_HANDLED
	}
	
	new arg1[24], arg2[2]
	read_argv(1, arg1, 23)
	read_argv(2, arg2, 1)
	
	new screens = str_to_num(arg2)
	new maxss = get_pcvar_num(maxscreens)
	get_user_ip(id, ip2, 31)
	get_user_ip(player, ip, 31)
	new authid[32], authid2[32], userid2, name[32], adminname[32]
	userid2 = get_user_userid(player)
	get_user_authid(id, authid, 31)
	get_user_authid(player, authid2, 31)
	get_user_name(player, name, 31)
	get_user_name(id, adminname, 31)
	
	if(screens > maxss)
	{
		console_print(id, "Prea multe poze! Maxim 5!")
		
		return PLUGIN_HANDLED
	}
	
	player = cmd_target(id, arg1, 1) 
	if (!player)
	{
		return PLUGIN_HANDLED
	}
	finish = screens
	
	new Float:interval = get_pcvar_float(screeninterval)
	new array[2]
	array[0] = id 
	array[1] = player
	set_task(interval, "ss_propriuzis", 0, array,2, "a", screens)
	log_amx("Screenshot: Admin ^"%s<%d><%s><%s>^" took %s ss on ^"%s<%d><%s><%s>^"", adminname, get_user_userid(id), authid, ip2, arg2, name, userid2, authid2, ip)
        
	return PLUGIN_HANDLED
}
 
public ss_propriuzis(array[2])
{
	new player = array[1]
	new id = array[0]
	
	new timestamp[32], timestampmsg[128], name[32], adminname[32]
	get_time("%m/%d/%Y - %H:%M:%S", timestamp, 31)
	get_user_name(player, name, 31)
	get_user_name(id, adminname, 31)

	//Clasic Design
	if(get_pcvar_num(design) == 0)
	{
		client_print(player, print_chat, "** Poza facuta jucatorului ^"%s^" de adminul ^"%s^" **", name, adminname)
		client_cmd(player, "snapshot") //ss
	}
	//Doar Playerului
	else if(get_pcvar_num(design) == 1)
	{
		client_print(player, print_chat, "** Screenshot taken on player ^"%s^" by admin ^"%s^" (%s) **", name, adminname, timestamp)
		client_cmd(player, "snapshot") //ss
	}
	//HUD Message doar Playerului
	else if(get_pcvar_num(design) == 2)
	{
		set_hudmessage(player, 255, 0, -1.0, 0.3, 0, 0.25, 1.0, 0.0, 0.0, 4)
		format(timestampmsg, 127, "** ORA: - %s **", timestamp)
		show_hudmessage(player, timestampmsg)
		
		client_cmd(player, "snapshot")  //ss
	}
	//Full
	else if(get_pcvar_num(design) == 3)
	{
		//HUD Timestamp Message
		set_hudmessage(player, 255, 0, -1.0, 0.3, 0, 0.25, 1.0, 0.0, 0.0, 4)
		format(timestampmsg, 127, "** PLAYER %s ORA: - %s **",name,timestamp)
		show_hudmessage(player, timestampmsg)
	    	client_print(0, print_chat, "** Screenshot taken on player ^"%s^" by admin ^"%s^" (%s) **", name, adminname, timestamp)
		client_print(0, print_chat, "Your IP: %s", ip)
		client_cmd(player, "wait;snapshot") //ss
	}
	console_print(id, "IP-ul lui %s este %s!",name,ip)
	finish = finish - 1;
	
	if(finish == 0)
	{
		client_cmd(player, "kill")
		cs_set_user_team(player,CS_TEAM_SPECTATOR);
		client_print(player, print_chat, "Posteaza Pozele pe: www.******** pentru unban!")
		client_print(player, print_chat, "Posteaza Pozele pe: www.******** pentru unban!")
	}
	return PLUGIN_CONTINUE;
}

public show_ip(id)
{
	console_print(id, "Last Stored IP: %s!",ip)
}
Here is the log:
Code:
[ss.amxx] Screenshot: Admin "Player<1><STEAM_0:1:********><127.0.0.1:27005>" took 2 ss on "Half-Life dedicated server<0><><172.24.4.128:27015>"
I executed amx_ss player 2

Thank you

Later edit: I kinda managed to fix the bug showing the wrong name,ip,steamid, but i have another problem.
I can't figure how to copy the value variable arg2 from read_argv(2, arg2, 1) from public concmd_screen function to public ss_propriuzis function because i moved log_amx to public ss_propriuzis function to fix the first problem, and now the remaining problem is to copy the value of variable arg2 from first function to 2nd function and assign it to log_amx to show in logs the numer of ss made.

I tried to add another array here:
Code:
new array[3]
array[0] = id 
array[1] = player
array[2] = nrpoze
and get it in the 2nd function with
Code:
new nrpoze = array[2]
where nrpoze = arg2 = number of screens

Last edited by asdff; 05-03-2011 at 15:04. Reason: 0743148640
asdff is offline
 



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 04:19.


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