Assuming that Ham_Use will be called both when the player started and stopped driving, I thought of something like this:
PHP Code:
new g_timesUsed[33]
new g_tempTime[33]
new g_secondsDriving[33]
public plugin_init()
{
RegisterHam(Ham_Use, "func_vehicle", "eventVehicleUsed", true)
}
public eventVehicleUsed(this, id, idactivator, use_type, Float:value)
{
g_timesUsed[id]++
// started driving
if(g_timesUsed[id] % 2)
{
g_tempTime[id] = get_systime()
}
// stopped driving
else
{
g_secondsDriving += get_systime() - g_tempTime[id]
}
}
Check this out:
https://forums.alliedmods.net/showpo...61&postcount=7