In the plugin I sent, there are 2 say command: /model and /nomodel . When type /model, players take model and when type /nomodel, players reset its models.
What I want is the determination of 1 person from each team that takes the model for the longest time among the players who take the model.
When the player takes the model, his / her time will start and when he leaves the model, the time will be paused and when he takes the model again, the time will continue from where he left off. (Time will not be visible)
When I type say /showtimes, all times will stop and name of the player who takes the model for the longest time, will be written in the motd list as name, duration, team and map-name and will appear the motd.
Maximum 1 person from each team will be determined in 1 map. So it's the best of the T team and the best of the Ct team. When the type say /showtimes ,only 10 people will appear. Thank you.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>
#include <amxmisc>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
new bool:user_is_model[33]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /model","cmdmodel")
register_clcmd("say_team /model","cmdmodel")
register_clcmd("say /nomodel","cmdnomodel")
register_clcmd("say_team /nomodel","cmdnomodel")
}
public plugin_precache()
{
precache_model("models/player/model1/model1.mdl")
precache_model("models/player/model2/model2.mdl")
}
public cmdmodel(id)
{
if(is_user_alive(id))
{
new userteam = get_user_team(id)
if(!user_is_model[id])
{
if(userteam == 2)
{
user_is_model[id] = true
cs_set_user_model(id, "model1")
}
else if(userteam == 1)
{
user_is_model[id] = true
cs_set_user_model(id, "model2")
}
}
}
return PLUGIN_HANDLED
}
public cmdnomodel(id)
{
if(user_is_model[id])
{
new CsTeams:userteam = cs_get_user_team(id)
new name[33]
get_user_name(id, name,3)
if(userteam == CS_TEAM_CT)
{
user_is_model[id] = false
cs_reset_user_model(id)
}
else if(userteam == CS_TEAM_T)
{
user_is_model[id] = false
cs_reset_user_model(id)
}
}
}