AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   past master help me !!! (https://forums.alliedmods.net/showthread.php?t=85582)

manley.choi 02-13-2009 02:37

past master help me !!!
 
Who can help me to this plug-in *computing time* accurate to two decimal places ?
Example: 3.47 Seconds
Code:
/**********************************************************************  *              Consecutive Killer Reward(with voice)                 *  *  ect: kill 4 enemies in 5s > voice " three kill in five seconds "  *  **********************************************************************  * amxmodx 1.75 tested  * Consecutive kill 3+ enemies ( interval 5s last kill ) got reward  *  * reward = (headshot * 2000 + (kills - headshot) * 1000) * kills / time_total  *  * LINK: <a href="http://cs-friends.com.cn" target="_blank" rel="nofollow noopener">http://cs-friends.com.cn</a>  * AUTHOR:iG_os ,version 0.3.16 2006-6-12  * ideal from a server,but i cannt findout of it,so make it by myself.  */ #define PLUGIN  "Consecutive Killer Reward" #define VERSION "0.3.16" #define AUTHOR  "iG_os" #include <amxmodx> #include <cstrike> new g_KillSum[33]         //kills new g_HeatshotSum[33]     //headshots new Float:g_Time[33][2]   //killer time public plugin_init() {    register_plugin(PLUGIN,VERSION,AUTHOR)    register_event("DeathMsg","DeathEven","a") } public DeathEven() {    new victimId = read_data(2)    //stop victimId timer    if (task_exists(2006+victimId)){       remove_task(2006+victimId)       new param[1]       param[0] = victimId       TimeEnd(param)    }    new killerId = read_data(1)    if (!killerId || killerId==victimId)       return PLUGIN_CONTINUE    if (get_user_team(killerId)==get_user_team(victimId))       return PLUGIN_CONTINUE    g_HeatshotSum[killerId] += read_data(3)    if (task_exists(2006+killerId))       remove_task(2006+killerId)    Killer_Count(killerId)    return PLUGIN_CONTINUE } public Killer_Count(id) {    //record killer time    new Float:TimeNow = get_gametime()    if (g_KillSum[id]<=0){       g_Time[id][0] = TimeNow       g_Time[id][1] = TimeNow    }    else g_Time[id][1] = TimeNow    g_KillSum[id]++    new param[1]    param[0] = id    set_task(5.0, "TimeEnd", 2006+id, param, 1)  //max interval 5s } public TimeEnd(param[]) {    new id = param[0]    if (g_KillSum[id]>=3)    {       //count total time       new time_total = floatround(g_Time[id][1] - g_Time[id][0])       if (time_total<1)          time_total = 1       new headshot = g_HeatshotSum[id]       //count reward money       new Rewardmoney = ( headshot * 2000 + (g_KillSum[id]-headshot) * 1000 ) * g_KillSum[id] / time_total       //add money       cs_set_user_money(id,cs_get_user_money(id)+Rewardmoney,1)       //convert number to word       new temp_sec[3], H_sec[] = "00"       new w_killSUM[11],w_second1[11],w_second2[11]       num_to_str(time_total,temp_sec,2)       if (time_total>20){          H_sec[0] = temp_sec[0]          num_to_word(str_to_num(H_sec),w_second1,10)          if (temp_sec[1]!='0')             num_to_word(str_to_num(temp_sec[1]),w_second2,10)       }       else          num_to_word(time_total, w_second2, 10)       num_to_word(g_KillSum[id], w_killSUM, 10)       //play voice       client_cmd(0, "spk ^"vox/woop %s kill in %s %s seconds^"", w_killSUM, w_second1, w_second2)       new name[32]       get_user_name(id, name, 31)               set_hudmessage( 0, 80, 220, 0.20, 0.12, 0, 3.0, 10.0, 0.1, 0.2, 4 )       show_hudmessage(0,"%s was consecutive killed^n %d enemies ( %d hs ) in %d seconds. Reword $%d",name,g_KillSum[id],headshot,time_total,Rewardmoney)    }    client_connected(id)   } public client_connected(id) {    g_KillSum[id] = 0    g_HeatshotSum[id] = 0    g_Time[id][0] = 0.0    g_Time[id][1] = 0.0    return PLUGIN_CONTINUE } public client_disconnect(id) {    if (task_exists(2006+id))       remove_task(2006+id) }

Hawk552 02-13-2009 14:51

Re: past master help me !!!
 
Use [ pawn][/pawn] tags.


All times are GMT -4. The time now is 17:02.

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