SA-MP Forums Archive
Help, please. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help, please. (/showthread.php?tid=278279)



Help, please. - Setkus - 21.08.2011

Hey, guys
I want to ask for you about one thing. Well, for example player shoot other player and in the shot player's screen show the shooter for few seconds. Something like in shooting games. Is it possible? I hope you understand me. Thanks for all help.



Re: Help, please. - [MWR]Blood - 21.08.2011

If I understood you correctly, then yeah, it is possible.


Re: Help, please. - Setkus - 21.08.2011

Well, is it hard to do that?


Re: Help, please. - [MWR]Blood - 21.08.2011

With this include it's not hard at all!


Re: Help, please. - Setkus - 21.08.2011

Nice, thanks! Oh, and maybe you can give me some example, how can i do this?


Re: Help, please. - [MWR]Blood - 21.08.2011

Sure, here you go!
pawn Code:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    new string[128], ShooterName[24];
    GetPlayerName(Shooter,ShooterName,24);
    format(string,sizeof(string),"~r~~h~%s~g~~h~has just shot you!",ShooterName);
    GameTextForPlayer(playerid,string,4000,4);
    return 1;
}



Re: Help, please. - Setkus - 21.08.2011

Thanks! But how can i do that the shooter shows in shot player screen? Are you playing counter strike?


Re: Help, please. - [MWR]Blood - 21.08.2011

Here you go
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerSpectatePlayer(playerid,killerid);
    if(IsPlayerInAnyVehicle(killerid))
    {
        PlayerSpectateVehicle(playerid,GetPlayerVehicleID(killerid));
    }
else
{
    TogglePlayerSpectating(playerid,1);
}
  SetTimerEx("StopSpectating",5000,false,"i",Target);
    return 1;
}

forward StopSpectating(playerid);
public StopSpectating(playerid)
{
    TogglePlayerSpectating(playerid,0);
    SpawnPlayer(playerid);
}



Re: Help, please. - Setkus - 21.08.2011

Thanks, man! You really helped me!