Raised This Month: $32 Target: $400
 8% 

Sprays


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ktrain
Senior Member
Join Date: Jul 2004
Old 09-17-2005 , 11:49   Sprays
Reply With Quote #1

i use a plugin, sprayid for amxx, in my hl1 servers, and am looking for the same sort of functionality for my hl2 servers

basically, when an admin looks at a spray, it pops up the name and steamid

if anyone can write such a plugin for sourcemm, or can help me out with writing one, i'd appreciate it

heres the sprayid.sma, if it helps at all
Code:
/*	Changed include file name: Bad HAL 9000
	Arnt i leet?
   When a player looks at a spray the name of the person who made the spray will be displayed
   in the center of the screen.

   Commands:

   amx_spray <name or #userid>       Creates the players spray on the wall you are looking at.


   Cvars:

   sprayid_hud 1                     0 = Console style text for the spray id.
                                     1 = Center say style

   Author:	Cheesy Peteza
   Date:	6-Feb-04
   Email:	[email protected]
   irc:		#yo-clan (QuakeNet)

*/

#include <amxmodx>
#include <amxmisc>

// Number of sprays to keep a record of at any one time
#define MAX_SPRAYID 15

// How long to remember a spray id. How long does a spray last? Depends on mp_decals value
// and how many players there are making decals (blood, bullet holes etc.) on the wall. I
// find on average most sprays only last about 1 minute. So 120 seconds is usually enough.
#define SPRAY_TIME 120.0

// The distance from the center of a spray, to the point a player is aiming at, which is
// required to display the spray id.
#define MAX_DISTANCE 50

// Spray ID colour
#define RED 100
#define GREEN 100
#define BLUE 255


/* Don't edit below here unless you know what you are doing */


enum spray {
	admin[1],
	name[32],
	authid[32]
}
new spraydb[MAX_SPRAYID][spray]
new sprayorigins[MAX_SPRAYID][3]

new waslooking[33]
new spraynum = 0

public plugin_init() {
	register_plugin("Spray ID","1.12","Cheesy Peteza")
	register_cvar("sprayid_version", "1.12", FCVAR_SERVER)

	register_cvar("sprayid_hud", "1")
	register_clcmd("amx_spray","makespray",ADMIN_KICK,"<name or #userid>")
	register_event("23", "newspray", "a", "1=112")	// SVC_TEMPENTITY (TE_PLAYERDECAL)
	set_task(1.0,"checklookingat",0,"",0,"b")
}

public checklookingat() {
	for(new i = 1; i <= get_maxplayers(); i++) {
		new la = 0
		new laorigin[3]
		get_user_origin(i, laorigin, 3)

		for(new j = 0; j < MAX_SPRAYID; j++) {
			if (get_distance(laorigin, sprayorigins[j]) <= MAX_DISTANCE) {
				if (!(sprayorigins[j][0] == 0 &&
				      sprayorigins[j][1] == 0 &&
				      sprayorigins[j][2] == 0)) {
					new line[128]

					if (spraydb[j][admin]) {
						format(line, 127, "Admin created spray by ^n%s ^nAuth ID: %s", spraydb[j][name], spraydb[j][authid])
					} else
						format(line, 127, "Spray by ^n%s ^nAuth ID: %s", spraydb[j][name], spraydb[j][authid])

					if (get_cvar_num("sprayid_hud")) {
						set_hudmessage(RED, GREEN, BLUE, -1.0, 0.55, 0, 0.0, 9999.0, 0.0, 0.0, 4)
						show_hudmessage(i, line)
					} else
						client_print(i, print_center, line)

					la = 1
				}
			}
		}
		if (la) waslooking[i] = 2
		else if (waslooking[i]) {
			if (get_cvar_num("sprayid_hud"))
				show_hudmessage(i, " ")
			else
				client_print(i, print_center, " ")

			waslooking[i]--
		}
	}
	return PLUGIN_HANDLED
}

public newspray() {
	new sprayid = read_data(2)	// Spray Owner

	spraydb[spraynum][admin] = 0
	get_user_name(sprayid, spraydb[spraynum][name], 31)
	get_user_authid(sprayid, spraydb[spraynum][authid], 31)
	sprayorigins[spraynum][0] = read_data(3)	// Spray coord x
	sprayorigins[spraynum][1] = read_data(4)	// Spray coord y
	sprayorigins[spraynum][2] = read_data(5)	// Spray coord z

	new aspraynum[1]
	aspraynum[0] = spraynum
	set_task(SPRAY_TIME, "removesprayid", 0, aspraynum, 1)

	if (spraynum == MAX_SPRAYID-1) spraynum = 0
	else spraynum++

	return PLUGIN_HANDLED
}

public removesprayid(aspraynum[]) {
	sprayorigins[aspraynum[0]][0] = 0
	sprayorigins[aspraynum[0]][1] = 0
	sprayorigins[aspraynum[0]][2] = 0
}


/* Spray any players spray */

public makespray(id, level, cid) {
	if (!cmd_access(id, level, cid, 1))
		return PLUGIN_HANDLED

	new arg[32]
	new laorigin[3]

	read_argv(1,arg,31)
	new player = cmd_target(id,arg,10)
	if (!player) return PLUGIN_HANDLED

	get_user_origin(id, laorigin, 3)

	message_begin(MSG_ALL, SVC_TEMPENTITY)
	write_byte(112)		// TE_PLAYERDECAL
	write_byte(player)
	write_coord(laorigin[0])
	write_coord(laorigin[1])
	write_coord(laorigin[2])
	write_short(0)		// ???
	write_byte(1)
	message_end()

	newadminspray(player, laorigin)

	client_print(id, print_console, "[AMX] Spray successful")
	
	return PLUGIN_HANDLED
}

newadminspray(sprayid, sorigin[]) {

	sprayorigins[spraynum][0] = sorigin[0]
	sprayorigins[spraynum][1] = sorigin[1]
	sprayorigins[spraynum][2] = sorigin[2]

	spraydb[spraynum][admin] = 1
	get_user_name(sprayid, spraydb[spraynum][name], 31)
	get_user_authid(sprayid, spraydb[spraynum][authid], 31)

	new aspraynum[1]
	aspraynum[0] = spraynum
	set_task(SPRAY_TIME, "removesprayid", 0, aspraynum, 1)

	if (spraynum == MAX_SPRAYID-1) spraynum = 0
	else spraynum++
}
thanks
ktrain is offline
Send a message via MSN to ktrain
ichthys
Veteran Member
Join Date: Dec 2004
Location: []*[]
Old 09-17-2005 , 19:03  
Reply With Quote #2

Nemod has the command nm_sprayinfo. Will give the steamid and name of person's spray you are looking at (or near to, not quite sure)
__________________
ichthys 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 07:18.


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