Member
|
![Old](images/statusicon/post_old.svg)
01-30-2010
, 14:32
Re: help, Count of hits in players and output to the panel
|
#17
|
rHi!
Has faced a problem, it is necessary to consider quantity of murders of the player as other players, a variable g_HitsTaken [client] [attacker] and players it играком, the variable g_HitsDown [attacker] [client] to store it before event player_death and to output in the panel unsetting contents of these cells for collection of the new information. When on a server 2 players all works normally but as soon as on a server it is more играков all works incorrectly.
PHP Code:
public PlayerHurtEvent_dods(Handle:event, const String:name[], bool:dontBroadcast) { if(!c_showhitsEnable) //plugin diabled return; new client = GetClientOfUserId(GetEventInt(event, "userid")); new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); if(client==0 || attacker==0) return; if (IsClientInGame(client) && IsClientInGame(attacker)) { new String:clientName[64]; new String:attackerName[64]; //new String:TitleName[64] GetClientName(client, clientName, 64) GetClientName(attacker, attackerName, 64) new hitgroup = GetEventInt(event, "hitgroup") if((hitgroup >= 0) && (hitgroup <=7)) { new damage = GetEventInt(event, "damage") // Hitgroups // 0 = body (generic part for css) // 1 = Head // 2 = Upper Chest // 3 = Lower Chest // 4 = Left arm // 5 = Right arm // 6 = Left leg // 7 = Right Leg new Float:client_pos[3]; new Float:attacker_pos[3]; GetClientAbsOrigin(client,client_pos); GetClientAbsOrigin(attacker,attacker_pos); new Float:distance = GetVectorDistance(client_pos,attacker_pos,false); distance*=0.025; new String:g_HitboxName[MAXHITGROUPS+1][128]; new String:g_Target[128]; new String:g_Attacker[128]; new String:temp[128]; Format(temp, sizeof(temp), "%T", "hbBody", client); g_HitboxName[0]=temp; Format(temp, sizeof(temp), "%T", "hbHead", client); g_HitboxName[1]=temp; Format(temp, sizeof(temp), "%T", "hbUpChest", client); g_HitboxName[2]=temp; Format(temp, sizeof(temp), "%T", "hbLowChest", client); g_HitboxName[3]=temp; Format(temp, sizeof(temp), "%T", "hbLeftarm", client); g_HitboxName[4]=temp; Format(temp, sizeof(temp), "%T", "hbRightarm", client); g_HitboxName[5]=temp; Format(temp, sizeof(temp), "%T", "hbLeftleg", client); g_HitboxName[6]=temp; Format(temp, sizeof(temp), "%T", "hbRightleg", client); g_HitboxName[7]=temp; Format(temp, sizeof(temp), "%T", "hbAttacker", client); g_Attacker = temp; Format(temp, sizeof(temp), "%T", "hbTadget", client); g_Target = temp; //PrintToChat(client,"\x01\x05Attacker: %s\x01, %s %i dmg, %.2fm", attackerName, hitgroups[hitgroup], damage,distance); PrintToChat(client,"\x01\x05%s : %s\x01, %s %i dmg, %.2fm",g_Attacker, attackerName, g_HitboxName[hitgroup], damage,distance); PrintToChat(attacker,"\x04%s : %s\x01, %s %i dmg, %.2fm",g_Target, clientName,g_HitboxName[hitgroup],damage,distance); if(hitgroup == 1) { g_headshot[attacker] ++; } g_HitsDown[client][attacker] ++; g_DamageDown[attacker] += damage; g_HitsTaken[attacker][client] ++; g_DamageTaken[client] += damage; } } }
next script
PHP Code:
public PlayerDeathEvent_dods(Handle:event, const String:name[], bool:dontBroadcast) { new client = GetClientOfUserId(GetEventInt(event, "userid")); new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); if (IsClientInGame(client) && IsClientInGame(attacker)) { new String:clientName[64]; new String:attackerName[64]; GetClientName(client, clientName, 64); GetClientName(attacker, attackerName, 64); decl String:killer[256]; decl String:dmgkillerD[256]; decl String:dmgkillerT[256]; decl String:ShotAttac[256]; decl String:ShotVictim[256]; if(attacker == client) { g_suicide[client]++; Format(killer, sizeof(killer), "%T", "tegsuicide", client); } else { g_killer[client]++; g_death[attacker]++; Format(killer, sizeof(killer), "%T", "You Kill", client, attackerName); Format(dmgkillerT, sizeof(dmgkillerT), "%T", "tegDowndmg", client, g_DamageDown[client]); if(g_DamageTaken[client] != 0) { Format(dmgkillerD, sizeof(dmgkillerD), "%T", "tegTakendmg", client, g_DamageTaken[client]); } } if((g_Panelend[client] == 0) && (c_showhitsAttacker)) { new Handle:killReportPanal=CreatePanel(); if((attacker != client) && (g_DamageDown[client] != 0)) { DrawPanelItem(killReportPanal, dmgkillerT); //addiding for(new i=1; i<=MaxClients; i++) { if(IsClientInGame(i) && IsClientConnected(i) && (client != i) && (g_HitsTaken[client][i] != 0)) { Format(ShotVictim, sizeof(ShotVictim), "%T", "tegYouShot", client , attackerName, g_HitsTaken[client][i]); DrawPanelText(killReportPanal, ShotVictim); } } } if(attacker != client) { DrawPanelItem(killReportPanal, dmgkillerD); //addiding for(new i=1; i<=MaxClients; i++) { if(IsClientInGame(i) && IsClientConnected(i) && (client != i) && (g_HitsDown[client][i] != 0)) { Format(ShotAttac, sizeof(ShotAttac), "%T", "tegShotsToYou", client, attackerName, g_HitsDown[client][i]); DrawPanelText(killReportPanal, ShotAttac); } } } DrawPanelText(killReportPanal, killer); SendPanelToClient(killReportPanal, client, Handler_MyPanel, 5); CloseHandle(killReportPanal); } clearDamageClientreport(client); } } public Handler_MyPanel(Handle:menu, MenuAction:action, param1, param2) { }
If it is necessary I can lay out all text of a plugin
Solution is found!!!
__________________
In Game Shacal_rus
Last edited by georgy; 01-31-2010 at 15:33.
|
|