https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot
Use something like https://sampwiki.blast.hk/wiki/SetPlayerMarkerForPlayer and then set a timer and then rehide it when the timer gets called. |
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { for (new i = 0, j = GetPlayerPoolSize(); i != j; i++) { if (gTeam[playerid] != gTeam[i]) { // ... } } return 1; }
Do you want the market to show whenever the player shoots? Even if the no one gets hit?
If so, loop using for or foreach, and get every player that isn't on the shooter's team. Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { for (new i = 0, j = GetPlayerPoolSize(); i != j; i++) { if (gTeam[playerid] != gTeam[i]) { // ... } } return 1; } |
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) && gTeam[playerid] == Terroristas && gTeam[i] != Terroristas) { SetPlayerMarkerForPlayer(i, playerid, RojoMarcado); } if(IsPlayerConnected(i) && gTeam[playerid] == Policias && gTeam[i] != Policias) { SetPlayerMarkerForPlayer(i, playerid, AzulMarcado); } } return 1; }
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { if(hittype == 1) { if (GetPlayerTeam(playerid) != GetPlayerTeam(hitid)) { foreach(Player,i) { SetPlayerMarkerForPlayer(i, playerid, 0xFF0000FF ); } } } return 1; }
#define RojoMarcado 0xFF0000FF #define AzulMarcado 0x0000FFFF
#define ChangeAlpha(%0,%1) (%0 & 0xFFFFFF00) | %1 forward Timer_HideMarker(playerid, i); public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { for(new i = 0; i < MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { if(gTeam[playerid] == Terroristas && gTeam[i] != Terroristas) SetPlayerMarkerForPlayer(playerid, i, RojoMarcado); else if(gTeam[playerid] == Policias && gTeam[i] != Policias) SetPlayerMarkerForPlayer(playerid, i, AzulMarcado); else continue; SetTimerEx("Timer_HideMarker", 2000, false, "ii", playerid, i); } } return 1; } public Timer_HideMarker(playerid, i) { if (gTeam[playerid] == Terroristas) SetPlayerMarkerForPlayer(playerid, i, ChangeAlpha(RojoMarcado, 0x00)); else if (gTeam[playerid] == Policias) SetPlayerMarkerForPlayer(playerid, i, ChangeAlpha(AzulMarcado, 0x00)); return 1; }