public OnPlayerDeath(playerid, killerid, reason) { deatht[playerid] = SetTimerEx("DeathTimer", 1500, 0, "i", playerid);
public DeathTimer(playerid) { new Float:healtht; GetPlayerHealthEx(playerid, healtht); if(healtht <= 0) { GivePlayerCash(playerid, -5); SendClientMessage(playerid, COLOR_ORANGE, "Paramedics saved you for 5 dollars."); KillTimer(deatht[playerid]); } return 1; }
Help.
Problem: When player is spawning then he is connecting on the server,the player give the message "Paramedics saved you for 5 dollars." Код:
public OnPlayerDeath(playerid, killerid, reason) { deatht[playerid] = SetTimerEx("DeathTimer", 1500, 0, "i", playerid); Код:
public DeathTimer(playerid) { new Float:healtht; GetPlayerHealthEx(playerid, healtht); if(healtht <= 0) { GivePlayerCash(playerid, -5); SendClientMessage(playerid, COLOR_ORANGE, "Paramedics saved you for 5 dollars."); KillTimer(deatht[playerid]); } return 1; } |
public OnPlayerSpawn(playerid) { SetPlayerHealthEx(playerid, 100); SetPlayerArmourEx(playerid, 0); TextDrawShowForPlayer(playerid, Time); TextDrawShowForPlayer(playerid, Date); SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pWantedLevel]); DestroyDynamic3DTextLabel(WantedScris[playerid]); if(PlayerInfo[playerid][pWantedLevel] >= 1) { Tigaanel[playerid] = 1; DestroyDynamic3DTextLabel(WantedScris[playerid]); new str2[256]; format(str2,sizeof(str2),"{FF00FF}Nivel de urmarire: %d", PlayerInfo[playerid][pWantedLevel]); WantedScris[playerid] = CreateDynamic3DTextLabel(str2, COLOR_WHITE, 0, 0, -20, 20, playerid); Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, WantedScris[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.48); } DestroyDynamic3DTextLabel(DeadScris[playerid]); if(PlayerInfo[playerid][pWantedLevel] >= 1) { new str1[256]; PlayerTextDrawShow(playerid, WantedText[playerid]); format(str1,sizeof(str1),"Urmarirea scade in: ~r~%d minute",wantedlost[playerid]/60+1); PlayerTextDrawSetString(playerid, WantedText[playerid], str1); } SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]); if(OnDuty[playerid] > 0) { if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1) { GivePlayerWeaponEx(playerid, 24, 500); GivePlayerWeaponEx(playerid, 3, 1); GivePlayerWeaponEx(playerid, 41, 500); GivePlayerWeaponEx(playerid, 29, 1000); GivePlayerWeaponEx(playerid, 31, 1000); SetPlayerArmourEx(playerid, 100); SetPlayerHealthEx(playerid, 100); } if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) { GivePlayerWeaponEx(playerid, 24, 500); GivePlayerWeaponEx(playerid, 3, 1); GivePlayerWeaponEx(playerid, 41, 500); GivePlayerWeaponEx(playerid, 29, 1000); GivePlayerWeaponEx(playerid, 31, 1000); SetPlayerArmourEx(playerid, 100); SetPlayerHealthEx(playerid, 100); } if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) { GivePlayerWeaponEx(playerid, 24, 500); GivePlayerWeaponEx(playerid, 41, 500); GivePlayerWeaponEx(playerid, 29, 1000); GivePlayerWeaponEx(playerid, 31, 1000); SetPlayerArmourEx(playerid, 100); SetPlayerHealthEx(playerid, 100); } if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) { GivePlayerWeaponEx(playerid, 24, 500); GivePlayerWeaponEx(playerid, 3, 1); GivePlayerWeaponEx(playerid, 41, 500); GivePlayerWeaponEx(playerid, 29, 1000); GivePlayerWeaponEx(playerid, 31, 1000); SetPlayerArmourEx(playerid, 100); SetPlayerHealthEx(playerid, 100); } } if(!gPlayerAnimLibsPreloaded[playerid]) { PreloadAnimLib(playerid,"BOMBER"); PreloadAnimLib(playerid,"RAPPING"); PreloadAnimLib(playerid,"SHOP"); PreloadAnimLib(playerid,"BEACH"); PreloadAnimLib(playerid,"SMOKING"); PreloadAnimLib(playerid,"FOOD"); PreloadAnimLib(playerid,"ON_LOOKERS"); PreloadAnimLib(playerid,"DEALER"); PreloadAnimLib(playerid,"MISC"); PreloadAnimLib(playerid,"SWEET"); PreloadAnimLib(playerid,"RIOT"); PreloadAnimLib(playerid,"PED"); PreloadAnimLib(playerid,"POLICE"); PreloadAnimLib(playerid,"CRACK"); PreloadAnimLib(playerid,"CARRY"); PreloadAnimLib(playerid,"COP_AMBIENT"); PreloadAnimLib(playerid,"PARK"); PreloadAnimLib(playerid,"INT_HOUSE"); PreloadAnimLib(playerid,"FOOD"); gPlayerAnimLibsPreloaded[playerid] = 1; } gTeam[playerid] = PlayerInfo[playerid][pTeam]; if(gTeam[playerid] == 4) { gTeam[playerid] = 4; } if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) { gTeam[playerid] = 2; PlayerInfo[playerid][pTeam] = 2; } if(gPlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_LIGHTRED, "** Trebuie sa te loghezi inainte de a te spawna (KICK) **"); Kick(playerid); return 1; } ChosenSkin[playerid] = 1; SetPlayerSpawn(playerid); SetPlayerToTeamColor(playerid); playerdeath[playerid] = 0; Undercover[playerid] = 0; SetPlayerTeam(playerid,4); StopAudioStreamForPlayer(playerid); return 1; }
Just add a check to see if player is alive or dead. If is dead, execute your code.
|
public DeathTimer(playerid) { new Float:healtht; GetPlayerHealthEx(playerid, healtht); if(healtht <= 0) { GivePlayerCash(playerid, -5); SendClientMessage(playerid, COLOR_ORANGE, "Paramedics saved you for 5 dollars."); KillTimer(deatht[playerid]); } return 1; }
new IsPlayerDead[MAX_PLAYERS];
IsPlayerDead[playerid] = 1;
if(IsPlayerDead[playerid] == 1)
(
new Float:healtht;
GetPlayerHealthEx(playerid, healtht);
if(healtht <= 0)
{
GivePlayerCash(playerid, -5);
SendClientMessage(playerid, COLOR_ORANGE, "Paramedics saved you for 5 dollars.");
KillTimer(deatht[playerid]);
}
)
What i mean is this:
pawn Код:
pawn Код:
pawn Код:
|
What i mean is this:
pawn Код:
pawn Код:
pawn Код:
|
Pawn compiler 3.10.8 Copyright © 1997-2006, ITB CompuPhase |
You should get at least this message:
Go to your Pawno folder, open pawn.cfg (Or if doesn't exist, create it),add -d3 inside, save and close it. Then try to recompile. |