19.05.2011, 00:16
https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/SetTimerEx
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new os;
new pTimer[MAX_PLAYERS];
new pWeapon[MAX_PLAYERS];
if (killerid == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_YELLOW,"Vocк morreu de causas naturais no jogo.");
new Float:posX[MAX_PLAYERS], Float:posY[MAX_PLAYERS], Float:posZ[MAX_PLAYERS];
GetPlayerPos(playerid,posX[playerid],posY[playerid],posZ[playerid]);
SendClientMessage(playerid,COLOR_PURPLE,"Vocк morreu!!!");
os = GetPlayerScore(killerid);
SetPlayerScore(killerid,os++);
SendClientMessage(killerid,COLOR_PURPLE,"Vocк matou!!!");
pTimer[playerid] = SetTimer("RenasceNoMesmoLugar",4000,0);
pWeapon[playerid] = GetPlayerWeapon(playerid);
SetTimer("Renascer", 4000, 0);
return 1;
}
pawn Код:
forward Renascer(playerid);
public Renascer(playerid)
{
new Float:posX[MAX_PLAYERS], Float:posY[MAX_PLAYERS], Float:posZ[MAX_PLAYERS];
SetPlayerInterior(playerid,0);
GivePlayerWeapon(playerid,pWeapon[playerid],50);
SetPlayerPos(playerid,posX[playerid],posY[playerid],posZ[playerid]);
KillTimer(pTimer[playerid]);
SendClientMessage(playerid,COLOR_YELLOW,"Vocк voltou ao local aonde morreu.");
return 1;
}