07/11/2020 12:07 
	
	
	
		Eu queria fazer alguns sistemas com as granadas do GTA, mas eu não sei como detectar exatamente onde a granada do player caiu...
Alguém sabe como faz?
Até agora eu consegui isso aqui (bem longe da realidade de onde cai a bomba)
OnPlayerUpdate
OnPlayerKeyStateChange
	
	
	
	
Alguém sabe como faz?
Até agora eu consegui isso aqui (bem longe da realidade de onde cai a bomba)
OnPlayerUpdate
Código:
if(TimerKFPressed[playerid] && GetPVarInt(playerid,"PressingSecs") >= 5) StopPressing(playerid);OnPlayerKeyStateChange
Código:
            if(newkeys & KEY_FIRE && IsAGrenade(GetPlayerWeapon(playerid)) )
            {
                if(TimerKFPressed[playerid]) StopPressing(playerid); //If it's already started we stop it here
                TimerKFPressed[playerid] = SetTimerEx("PressingKey",1000,true,"i",playerid); //And start it again
            }Código:
stock StopPressing(playerid)
{
    new str[128];
    KillTimer(TimerKFPressed[playerid]);
    // tempo pressionando
    new seconds = GetPVarInt(playerid,"PressingSecs");
    format(str,sizeof(str),"Key pressed for %d seconds",seconds);
    SendClientMessage(playerid,-1,str);
    // posição da bomba:
    new Float:Px, Float:Py, Float:Pz;
    GetPlayerPos(playerid, Px, Py, Pz);
    GetXYInFrontOfPlayer(playerid, Px, Py, (seconds*3 + 1));
    format(str,sizeof(str),"Bomb pos: %f %f %f",Px, Py, Pz);
    SendClientMessage(playerid,-1,str);
    // 
    SetPVarInt(playerid,"PressingSecs",0); //Here we reset the seconds so when he will press it again we can count the new seconds
    TimerKFPressed[playerid] = 0; //We reset this so it could pass the check if(TimerPressed[playerid])
}
	   
	
