AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Why this incorrect ? (https://forums.alliedmods.net/showthread.php?t=183383)

newcomer 04-21-2012 07:58

Why this incorrect ?
 
Why it write server name (I want write user name) and can't write teamscore. What did I do wrong :(

Quote:

#include <amxmodx>
#include <amxmisc>

new kills[33]
new tcount , ctcount

public plugin_init()
{
register_plugin("Ace Log", "1.0", "Newcomer")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("DeathMsg", "event_DeathMsg", "a")
register_event("SendAudio", "t_win", "a", "2&%!MRAD_terwin")
register_event("SendAudio", "ct_win", "a", "2&%!MRAD_ctwin")

}

public event_round_start()
{
new reset_value[33]
kills = reset_value
}

public event_DeathMsg()
{
static killer, victim
killer = read_data(1)
victim = read_data(2)
if (!is_user_connected(killer) || !is_user_connected(victim) || killer==victim || get_user_team(killer)==get_user_team(victim)) return;
kills[killer] += 1
if (kills[killer] == 5)
{
ace_log(killer)
}
}
ace_log(killer)
{
new szFile[128];
get_configsdir(szFile,127);
formatex(szFile,127,"%s/ace_log.txt",szFile);

if(!file_exists(szFile))
{
write_file(szFile," ",-1)
}
new name[32],sztime[54],szLog[256],map[33]
get_user_name(killer,name,31);
get_time("%d.%m.%Y -- %H:%M:%S",sztime,53);
get_mapname(map,32);

formatex(szLog,255,"Player: %s | Date: %s | Map: %s | Wins: CT:%s TS:%s",name, sztime, map,ctcount,tcount);
write_file(szFile,szLog,-1);
}

public t_win(id)
{
tcount+=1

}

public ct_win(id)
{
ctcount+=1
}


fysiks 04-21-2012 13:24

Re: Why this incorrect ?
 
Because "id" is 0 (aka the server). You can't use any arguments coming from the DeathMsg forward. You need to use "killer" or "victim" which ever name you were trying to get.

newcomer 04-21-2012 15:24

Re: Why this incorrect ?
 
Yes thanks !!!
And how about with Team Wins ? I tried event "TeamScore" but it not work too. :(

newcomer 04-21-2012 16:41

Re: Why this incorrect ?
 
sorry, I can't understand your mean

newcomer 04-23-2012 01:22

Re: Why this incorrect ?
 
Someone please help me, it's nearly complete. Only need write team wins now

fysiks 04-23-2012 03:10

Re: Why this incorrect ?
 
Quote:

Originally Posted by newcomer (Post 1694937)
Someone please help me, it's nearly complete. Only need write team wins now

I just searched for "hook win" in the scripting help forum and the first hit was an answer to your question. Please search.

newcomer 04-23-2012 22:51

Re: Why this incorrect ?
 
not found needed :(
more info please

fysiks 04-23-2012 23:38

Re: Why this incorrect ?
 
Quote:

Originally Posted by newcomer (Post 1695385)
not found needed :(
more info please

Are you saying you don't know how to search a forum? Also, note that after my last post that the first result is this thread and the second result is the answer to your question.

When you want to search for something in a particular forum you go to that forum and look to the upper right:

http://www.beougher.com/nathan/games...orumSearch.png

If you are observant, you will see that I've done you a favor and did the search for you :).

newcomer 04-24-2012 00:18

Re: Why this incorrect ?
 
omg I know how to search, but I told I'm not found anything need for this problem (used your keyword)

http://i.imgur.com/RzEFH.jpg

fysiks 04-24-2012 01:05

Re: Why this incorrect ?
 
If hooking the sounds isn't working then you can use the method you have been given in the search results instead. Same general concept of what you already have with a different method of detecting when a team wins.


All times are GMT -4. The time now is 07:41.

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