Guest User

Untitled

a guest
Dec 24th, 2017
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.91 KB | None | 0 0
  1. public OnPlayerDeath(playerid, killerid, reason)
  2. {
  3.     printf("[debug] OnPlayerDeath(%d, %d, %d)", playerid, killerid, reason);
  4.  
  5.     new string[256];
  6.     foreachex(Admins,ds) {
  7.         if(Spectate[ds] != -1) {
  8.             if(GetDistanceBetweenPlayers(playerid,Spectate[ds]) <= 100.0) {
  9.                 if(Spectate[ds] != killerid && Spectate[ds] != playerid) {
  10.                     new namexs[30], wName[50];
  11.                     GetWeaponNameEx(reason, wName, sizeof(wName));
  12.  
  13.                     format(namexs, sizeof(namexs),"No One");
  14.                     if(killerid != INVALID_PLAYER_ID) { format(namexs, sizeof(namexs),"%s",GetName(killerid)); }
  15.  
  16.                     SCMF(ds, COLOR_LGREEN, "%s was killed by %s, reason: %s.",GetName(playerid),namexs,wName);
  17.                 }
  18.                 stop deathdeletetime[ds];
  19.                 SendDeathMessageToPlayer(ds, killerid, playerid, reason);
  20.                 deathdeletetime[ds] = defer DeleteDeathMessage(ds);
  21.             }
  22.         }
  23.     }
  24.  
  25.     Listening[playerid] = -1;
  26.     gPlayerUsingLoopingAnim[playerid] = 0;
  27.     gPlayerSpawned[playerid] = 0;
  28.     PlayerInfo[playerid][pLocal] = 255;
  29.  
  30.     if(killerid != INVALID_PLAYER_ID)
  31.     {
  32.         if(GetPlayerWar(PlayerInfo[playerid][pMember]) == GetPlayerWar(PlayerInfo[killerid][pMember]))
  33.         {
  34.             new turf = GetPlayerWar(PlayerInfo[playerid][killerid]);
  35.             if(IsPlayerInTurf(playerid, turf))
  36.             {
  37.                 format(string, sizeof(string), "You have been killed by %s.", GetName(killerid));
  38.                 SCM(playerid, -1, string);
  39.                 format(string, sizeof(string), "You killed %s.", GetName(playerid));
  40.                 SCM(killerid, -1, string);
  41.  
  42.                 Points[killerid] ++;
  43.                 Points[playerid] --;
  44.  
  45.                 mysql_format(SQL, string, sizeof string, "UPDATE `users` SET `Points` = '%d' WHERE `id` = '%d'", Points[killerid], PlayerInfo[killerid][pSQLID]);
  46.                 mysql_tquery(SQL, string, "", "");
  47.                 mysql_format(SQL, string, sizeof string, "UPDATE `users` SET `Points` = '%d' WHERE `id` = '%d'", Points[playerid], PlayerInfo[playerid][pSQLID]);
  48.                 mysql_tquery(SQL, string, "", "");
  49.             }
  50.         }
  51.         killerid = INVALID_PLAYER_ID;
  52.     }
  53.     return 1;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment