Raised This Month: $ Target: $400
 0% 

I need help!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Maladca
Junior Member
Join Date: Mar 2014
Old 03-30-2014 , 09:23   Re: I need help!
Reply With Quote #6

Quote:
#include <amxmodx>
#include <csstats>

#define ignore_flag admin_level_a /* flag "m" */

new pranks, pflags

public plugin_init() {
register_plugin( "awards", "1.0", "nevermore" )
register_dictionary( "topawards.txt" )
pflags = register_cvar( "top_flags", "t" )
}

public client_putinserver(id) {
set_task( 0.3, "checkstats", id ) // we need to use delay otherwise we will get rank = 0
}

public checkstats(id) {
new iflags = get_user_flags(id)
new szaddflags[16]
get_pcvar_string( pflags, szaddflags, 15 )
new iaddflags = read_flags(szaddflags)

if ( iflags & ignore_flag || iflags & iaddflags == iaddflags )
// ignore player with ignore_flag or having all additional flags
return

new iranks = get_pcvar_num(pranks)
if ( !iranks )
return

new szstats[8], szbodyhits[8]
if ( irank && irank <= iranks || szstats[0] > 1000 ) {

if ( irank && irank <= iranks ) {
// 1st check for safety. May be player not ranked at all yet
set_user_flags( id, iflags | iaddflags )
new data[2]
data[0] = id
data[1] = iranks
set_task( 5.0, "printmessage", _, data, 2 )
}
}

public printmessage( data[2] ) {
if ( !is_user_connected(data[0]) )
return

colorprint( data[0], "%l", data[0], "top_awards", data[1] )
}

colorprint( ireceiver, const szrawmessage[ ], any:... ) {
static imsgsaytext = 0
if( !imsgsaytext )
imsgsaytext = get_user_msgid( "saytext" )

new szmessage[192]
vformat( szmessage, charsmax(szmessage) - 1, szrawmessage, 3 )
replace_all( szmessage, charsmax(szmessage) - 1, "!n", "^1" )
replace_all( szmessage, charsmax(szmessage) - 1, "!t", "^3" )
replace_all( szmessage, charsmax(szmessage) - 1, "!g", "^4" )
if ( szmessage[0] != '^1' || szmessage[0] != '^3' || szmessage[0] != '^4' )
format( szmessage, charsmax(szmessage) - 1, "^1%s", szmessage ) // we must set initial default color if it is not provided explicitly

message_begin( msg_one_unreliable, imsgsaytext, _, ireceiver )
write_byte(ireceiver) // use target player as sender to see colors at all (and his own team color for ^3)
write_string(szmessage)
message_end()
}

// add this in plugin_init()
register_event("hltv", "eventnewround", "a", "1=0", "2=0");
// add this in global.
Public eventnewround()
set_task(2.0, "delayedmessage");

public delayedmessage() {
new players[32], playersnum;
get_players(players, playersnum, "ch");
new szstats[8], szbodyhits[8], irank;

for ( new i ; i < playersnum ; i++ ) {
irank = get_user_stats( id, szstats, szbodyhits )
if ( szstats[0] < 1000 )
colorprint(players[i], "your frags %d - %d, after 1000 frags you get admin", szstats[0], szstats[1]);
}
}
}
Gives out a mistake

Last edited by Maladca; 03-30-2014 at 09:23.
Maladca 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 06:03.


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