#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
public plugin_init()
{
register_plugin("Teleportacja","1.0","Nike");
register_clcmd("amx_blink", "admin_blink", ADMIN_USER," - Blink to location");
}
new checkCount[33];
new blinkSpot[33][3];
new origBlinkSpot[33][3];
new g_lastPosition[33][3];
new player_b_blink[33];
public PreThink_Blink(id)
{
if (halflife_time()-czasmaga[id] <= 5)
return PLUGIN_HANDLED;
czasmaga[id] = floatround(halflife_time());
}
public admin_blink(id,level,cid)
{
if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
get_user_origin(id,blinkSpot[id],3)
origBlinkSpot[id][0] = blinkSpot[id][0]
origBlinkSpot[id][1] = blinkSpot[id][1]
origBlinkSpot[id][2] = blinkSpot[id][2]
blinkSpot[id][2] += 45
set_user_origin(id,blinkSpot[id])
checkCount[id] = 1
positionChangeTimer(id)
return PLUGIN_CONTINUE
}
public positionChangeTimer(id)
{
if (!is_user_alive(id)) return
new Float:velocity[3]
get_user_origin(id, g_lastPosition[id])
entity_get_vector(id, EV_VEC_velocity, velocity)
if ( velocity[0] == 0.0 && velocity[1] == 0.0 && velocity[2] ) {
velocity[0] = 50.0
velocity[1] = 50.0
entity_set_vector(id, EV_VEC_velocity, velocity)
}
set_task(0.1,"positionChangeCheck",id)
}
//----------------------------------------------------------------------------------------------
public positionChangeCheck(id)
{
if (!is_user_alive(id)) return
new origin[3]
get_user_origin(id, origin)
if ( g_lastPosition[id][0] == origin[0] && g_lastPosition[id][1] == origin[1] && g_lastPosition[id][2] == origin[2]) {
switch(checkCount[id]) {
case 0 : blink_movecheck(id, 0, 0, 0) // Original
case 1 : blink_movecheck(id, 0, 0, 80) // Up
case 2 : blink_movecheck(id, 0, 0, -110) // Down
case 3 : blink_movecheck(id, 0, 30, 0) // Forward
case 4 : blink_movecheck(id, 0, -30, 0) // Back
case 5 : blink_movecheck(id, -30, 0, 0) // Left
case 6 : blink_movecheck(id, 30, 0, 0) // Right
case 7 : blink_movecheck(id, -30, 30, 0) // Forward-Left
case 8 : blink_movecheck(id, 30, 30, 0) // Forward-Right
case 9 : blink_movecheck(id, -30, -30, 0) // Back-Left
case 10: blink_movecheck(id, 30, -30, 0) // Back-Right
case 11: blink_movecheck(id, 0, 30, 60) // Up-Forward
case 12: blink_movecheck(id, 0, 30, -110) // Down-Forward
case 13: blink_movecheck(id, 0, -30, 60) // Up-Back
case 14: blink_movecheck(id, 0, -30, -110) // Down-Back
case 15: blink_movecheck(id, -30, 0, 60) // Up-Left
case 16: blink_movecheck(id, 30, 0, 60) // Up-Right
case 17: blink_movecheck(id, -30, 0, -110) // Down-Left
case 18: blink_movecheck(id, 30, 0, -110) // Down-Right
default: user_kill(id)
}
return
}
}
//----------------------------------------------------------------------------------------------
public blink_movecheck(id, mX, mY, mZ)
{
blinkSpot[id][0] = origBlinkSpot[id][0] + mX
blinkSpot[id][1] = origBlinkSpot[id][1] + mY
blinkSpot[id][2] = origBlinkSpot[id][2] + mZ
set_user_origin(id,blinkSpot[id])
checkCount[id]++
positionChangeTimer(id)
}
//----------------------------------------------------------------------------------------------
Co jest złego w tym kodzie? Chcę ustawić by można było co 5 sekund tej teleportacji używać. Najlepiej jakby też pisało , że można co 5 sekund. Daje pluuusy.