←  Multilingual

AMXX.pl: Support AMX Mod X i SourceMod

»

Hunter crossbow

  • +
  • -
supertaranta - zdjęcie supertaranta 27.04.2009

How can i make the right click of the crossbow to be zoom in, like the fov i understand but where would i place this and what would be the code for this?, and how can i add a message that displays when reloading "You are reloading", untill its finished reloading


Any help, i appreciate it =).
Odpowiedz

  • +
  • -
mgr inż. Pavulon - zdjęcie mgr inż. Pavulon 27.04.2009

Maybe this could help:
First you must declare a new global variable, for example new bool:player_zoom[32]
Next somewhere in Forward_FM_PlayerPreThink(id) {?} add something like this:

if (pev(id, pev_oldbuttons)&IN_ATTACK2 && !(pev(id, pev_button) & IN_ATTACK2))
{
    if (player_zoom[id])
    {
        set_pev(id, pev_fov, 90.0)
        player_zoom[id] = false
    }
    else
    {
        set_pev(id, pev_fov, 10.0) //float value
        player_zoom[id] = true
    }
}


And you want to set a HUD message { http://amxx.pl/viewtopic.php?t=6738 } ?
Odpowiedz

  • +
  • -
supertaranta - zdjęcie supertaranta 07.05.2009

Alright well i did this and the action is still reloading =/.
Odpowiedz

  • +
  • -
Miczu - zdjęcie Miczu 07.05.2009

What do you mean by that?
Odpowiedz

  • +
  • -
supertaranta - zdjęcie supertaranta 07.05.2009

Well on right click the crossbow is reloading instead of using a scope.
Odpowiedz

  • +
  • -
Miczu - zdjęcie Miczu 07.05.2009

And where did you put the code (give whole function with it).
Odpowiedz

  • +
  • -
supertaranta - zdjęcie supertaranta 07.05.2009

this is what i have.

public Forward_FM_PlayerPreThink(id)
{
    static Float:fPunchAngle[3]
    pev(id, pev_punchangle, fPunchAngle)
    if( fPunchAngle[0] == -5)
    {
    	if(fm_get_user_longjump(id) && JumpsLeft[id]>0)JumpsLeft[id]--
	
	write_hud(id)
	
	if(JumpsLeft[id]<1) fm_set_user_longjump(id,false,true)

	if (pev(id, pev_oldbuttons)&IN_ATTACK2 && !(pev(id, pev_button) & 	IN_ATTACK2)) 
	{ 
    if (player_zoom[id]) 
    { 
        set_pev(id, pev_fov, 90.0) 
        player_zoom[id] = false 
    } 
    else 
    { 
        set_pev(id, pev_fov, 10.0) //float value 
        player_zoom[id] = true 
    } 
}
        return FMRES_HANDLED

    }
    return FMRES_IGNORED

}
Odpowiedz

  • +
  • -
Miczu - zdjęcie Miczu 07.05.2009

Forward_FM_PlayerPreThink(id)

did you registed this in plugin_init?
Odpowiedz

  • +
  • -
supertaranta - zdjęcie supertaranta 07.05.2009

No i did not. wow, what would it be registered as? like register"blank" forward_pm_playerfrethink
Odpowiedz

  • +
  • -
Miczu - zdjęcie Miczu 07.05.2009

register_forward(FM_PlayerPreThink,"Forward_FM_PlayerPreThink")
Odpowiedz

  • +
  • -
supertaranta - zdjęcie supertaranta 07.05.2009

Alright yea, still doesnt work =/.
Odpowiedz

  • +
  • -
Miczu - zdjęcie Miczu 07.05.2009

supertaranta, you added Pavulon code in worn way, it will work only if
if( fPunchAngle[0] == -5)

So you have to be palladyn for it :D and if you are pallandyn you don't have a xbow and so on ;>
Odpowiedz

  • +
  • -
supertaranta - zdjęcie supertaranta 08.05.2009

So how do i define it for a hunter then? do i place it somewhere else or do i have to do an if function for a hunter? If the if function what would that be?
Odpowiedz

  • +
  • -
Miczu - zdjęcie Miczu 08.05.2009

public Forward_FM_PlayerPreThink(id)

{ 

	static Float:fPunchAngle[3] 

	pev(id, pev_punchangle, fPunchAngle) 

	if( fPunchAngle[0] == -5) 

	{ 

		if(fm_get_user_longjump(id) && JumpsLeft[id]>0) JumpsLeft[id]-- 

		

		write_hud(id) 

		return FMRES_HANDLED 

		

	}

	if(bow[id])

	{		

		if (pev(id, pev_oldbuttons)&IN_ATTACK2 && !(pev(id, pev_button) & IN_ATTACK2)) 

		{ 

			if (player_zoom[id]) 

			{ 

				set_pev(id, pev_fov, 90.0) 

				player_zoom[id] = false 

			} 

			else 

			{ 

				set_pev(id, pev_fov, 10.0) //float value 

				player_zoom[id] = true 

			} 

			return FMRES_HANDLED 

		} 

	}

	return FMRES_IGNORED 

}
Odpowiedz

  • +
  • -
supertaranta - zdjęcie supertaranta 08.05.2009

just tested it a few times and still doesnt work =/. Could it be a model problem?
Odpowiedz

  • +
  • -
Miczu - zdjęcie Miczu 08.05.2009

Hmm... in the worst case is it possible (whe paladyn code could be a hint here) that register_forward(FM_PlayerPreThink,"Forward_FM_PlayerPreThink") is arledy declareted (twise)?

IF so, it could be called twice and the 1 time is in zoom and the secound it is back to normal (zoom never work). Try use the paladin Long Jump if it's counted twise for jump, then that's the problem.
Odpowiedz

  • +
  • -
supertaranta - zdjęcie supertaranta 08.05.2009

Yes the long jump does not work =/ just tested it.

Just found it, yes its declaired twice, should i delete one?
Odpowiedz

  • +
  • -
Miczu - zdjęcie Miczu 08.05.2009

Yes delate one, and say how it work now...
Odpowiedz

  • +
  • -
supertaranta - zdjęcie supertaranta 08.05.2009

k, the paladin jumps work, but the hunter still reloads the crossbow on right click.
Odpowiedz

  • +
  • -
Miczu - zdjęcie Miczu 08.05.2009

{ 
    static Float:fPunchAngle[3] 
    pev(id, pev_punchangle, fPunchAngle) 
    if( fPunchAngle[0] == -5) 
    { 
        if(fm_get_user_longjump(id) && JumpsLeft[id]>0) JumpsLeft[id]-- 
        
        write_hud(id) 
        return FMRES_HANDLED 
        
    } 
    if(bow[id]) 
    {        
        if (pev(id, pev_oldbuttons)&IN_ATTACK2 && !(pev(id, pev_button) & IN_ATTACK2)) 
        { 
            if (player_zoom[id]) 
            { 
                message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id)
                write_byte(90)
                message_end()
                player_zoom[id] = false 
            } 
            else 
            { 
                message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id)
                write_byte(10)
                message_end()
                player_zoom[id] = true 
            } 
            return FMRES_HANDLED 
        } 
    } 
    return FMRES_IGNORED 
}

The code provided by Pavulon wasn't as good as I thought ;-)
Odpowiedz