Death without reason
#1


Hello how are you? , I have a problem with the script of a hunger and thirst system. The problem I have is that I am playing normally on the server and suddenly I die, when I appear in the same hospital, I spend a while and I die again. Any help that can be? Thank you
Reply
#2

Are you using a timer to - the players health?
Reply
#3


I really do not know because I'm using this gamemode recently, it's from a friend and we're working it between the two, where can I see if I'm using a timer?
Reply
#4

Quote:
Originally Posted by Ezequielito
Посмотреть сообщение

I really do not know because I'm using this gamemode recently, it's from a friend and we're working it between the two, where can I see if I'm using a timer?
find in your gamemode SetTimer or SetTimerEx
Reply
#5

SetTimerEx("Spawned", 10000, false, "i", playerid);
Could that be? is placed in OnPlayerLogin
Reply
#6

Search for 'SetPlayerHealth', "Spawned" just looks like a variable to tell the script to load stuff in.
Reply
#7


The only one that I have SetPlayerHealth (i, 100); It is one and I placed it that I put it so that when the player appears for the first time registered this with 100 of life
Reply
#8

Does anything happen before or during the death? Any message show or anything?
Reply
#9


Not before dying does not give me any message of death (when you kill a user usually gives you a message of "you're dying" but when this happens only kills me)
OnPlayerSpawn
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
RequestNPCLoad(playerid,npcname);
return 1;
}
SetPlayerStats(playerid);
for(new i = 0; i < 8; i++) { TextDrawHideForPlayer(playerid, LoginMenu); }
if(PlayerInfo[playerid][pTut] == 1)
{
TextDrawShowForPlayer(playerid, IntelexRP);
}
if(PlayerInfo[playerid][pPcarkey] != 9999)
{
SetVehicleVirtualWorld(PlayerInfo[playerid][pPcarkey], 0);
}
if(PlayerInfo[playerid][pPcarkey2] != 9999)
{
SetVehicleVirtualWorld(PlayerInfo[playerid][pPcarkey2], 0);
}
if(PlayerInfo[playerid][pCarPremium] != 9999)
{
SetVehicleVirtualWorld(PlayerInfo[playerid][pCarPremium], 0);
}
if(PlayerInfo[playerid][pAdminLC] > 6 && PlayerInfo[playerid][pAdminLC] < 2012 || PlayerInfo[playerid][pAdminLC] > 2014)
{
new string[80];
new year, month,day; getdate(year, month, day);
format(string, sizeof(string), "%s has been banned by AntiHack, reason: AdminHack (%d/%d/%d)",PlayerName(playerid),day,month,year);
Message(playerid, COLOR_RED2, string);
A_Info(string);
BanLog(string);
PlayerInfo[playerid][pLocked] = 8;
Ban(playerid);
return 1;
}
if(gPlayerLogged[playerid] == 0)
{
Message(playerid, COLOR_LIGHTRED, "** This server requires a connection before entering (Kick) **");
Kick(playerid);
return 1;
}
SetPlayerSpawn(playerid);
SetPlayerToTeamColor(playerid);
return 1;
}

OnPlayerDeath
public OnPlayerDeath(playerid, killerid, reason)
{
new string[128];
new Floatx,Floaty,Floatz;
InAmbu[playerid] = 0;
DeathPlayer[playerid] = 1;
UsingDrugs[playerid] = 0;
UsingEctasy[playerid] = 0;
EctasyEffect[playerid] = 0;
UsingRitalin[playerid] = 0;
RitalinEffect[playerid] = 0;
UsingHeroina[playerid] = 0;
HeroinaEffect[playerid] = 0;
HeroinaBeat[playerid] = 0;
UsingMarihuana[playerid] = 0;
MarihuanaEffect[playerid] = 0;
MarihuanaBeat[playerid] = 0;
Left4Life[playerid] = 0;
PlayerInfo[playerid][pArmour] = 0;
gPlayerSpawned[playerid] = 0;
GetPlayerPos(playerid, px, py, pz);
PlayerDrunk[playerid] = 0;
PlayerDrunkTime[playerid] = 0;
new drunk = GetPlayerDrunkLevel(playerid);
if(drunk > 0) SetPlayerDrunkLevel(playerid, 0);
PlayerInfo[killerid][pKills] += 1;
PlayerInfo[playerid][pDeaths] += 1;

if(SmokeTimer[playerid]) KillTimer(SmokeTimer[playerid]);
if(DrugTimer[playerid]) KillTimer(DrugTimer[playerid]);
if(IsPlayerConnected(killerid))
{
if(GetPlayerWeapon(killerid) == 24) { PlayerInfo[killerid][pDEagle] += 10; }
if(GetPlayerWeapon(killerid) == 25) { PlayerInfo[killerid][pShotgun] += 15; }
if(GetPlayerWeapon(killerid) == 29) { PlayerInfo[killerid][pMP5] += 15; }
if(GetPlayerWeapon(killerid) == 31) { PlayerInfo[killerid][pM4] += 15; }
if(GetPlayerWeapon(killerid) == 30) { PlayerInfo[killerid][pAK47] += 15; }
if(GetPlayerWeapon(killerid) == 34) { PlayerInfo[killerid][pSniper] += 30; }
}
if(Pandilleros(killerid) && Pandilleros(playerid))
{
if(PlayerToPoint(30.0, playerid, 2491.8098,-1664.8685,13.343 || PlayerToPoint(30.0, playerid, 1882.5814,-2027.3207,13.3906) || PlayerToPoint(30.0, playerid, 2819.5747,-1182.8378,25.2364))
{
if(PlayerInfo[killerid][pMember] == PlayerInfo[playerid][pMember]) { Message(playerid, COLOR_GRAD2, "No mates a los de tu banda!"); }
if(PlayerInfo[killerid][pMember] != PlayerInfo[playerid][pMember])
{
if(GetPlayerMoney(playerid) > 14)
{
Message(playerid, COLOR_WHITE, "Te ha matado el de la banda enemiga, pierdes 15$ que van hacia el.");
if(PlayerInfo[killerid][pMember] == 9) { GText(playerid, "own~g~3~w~d", 5000, 1); }
if(PlayerInfo[killerid][pMember] == 10) { GText(playerid, "own~b~3~w~d", 5000, 1); }
if(PlayerInfo[killerid][pMember] == 11) { GText(playerid, "own~y~3~w~d", 5000, 1); }

GText(killerid, "Muerte ~r~enemiga~n~~w~+15~g~$", 5000, 1);
format(string, sizeof(string), "~w~Te ha ~r~matado~n~~r~%s", PlayerName(killerid));
GText(playerid, string, 5000, 1);

GivePlayerMoney(playerid, -15); GivePlayerMoney(killerid, 15);
}
else
{
Message(playerid, COLOR_WHITE, "Te ha matado el de la banda enemiga, pierdes 15$ que van hacia el.");
Message(killerid, COLOR_WHITE, "No recibes dinero ya que el enemigo no tiene 15$, pero el si los perdiу!");
if(PlayerInfo[killerid][pMember] == 9) { GText(playerid, "own~g~3~w~d", 5000, 1); }
if(PlayerInfo[killerid][pMember] == 10) { GText(playerid, "own~b~3~w~d", 5000, 1); }
if(PlayerInfo[killerid][pMember] == 11) { GText(playerid, "own~y~3~w~d", 5000, 1); }

GivePlayerMoney(playerid, -15);
}
}
}
}
new caller = Mobile[playerid];
if(caller != 255)
{
if(caller < 255)
{
Message(caller, COLOR_GRAD2, "La llamada se perdiу.");
CellTime[caller] = 0;
CellTime[playerid] = 0;
Mobile[caller] = 255;
}
Mobile[playerid] = 255;
CellTime[playerid] = 0;
}
if(PaintballType[playerid] > 0)
{
if(PaintballType[playerid] == 1)
{
PaintballDMKills[killerid] += 1;
format(string, sizeof(string), "* [DM] %s[%d] hizo polvo a %s[%d]", PlayerName(killerid), PaintballDMKills[killerid], PlayerName(playerid), PaintballDMKills[playerid]);
SendPBMessage(1, 0xFFB18CFF, string);
}
if(PaintballType[playerid] == 2)
{
TvTVerdeKills += 1;
format(string, sizeof(string), "{3CB9FF}* [TVT] Muerte naranja. El equipo verde aumenta su puntaje a %d", TvTVerdeKills);
SendPBMessage(2, -1, string);
SendPBMessage(3, -1, string);
}
if(PaintballType[playerid] == 3)
{
TvTNaranjaKills += 1;
format(string, sizeof(string), "{3CB9FF}* [TVT] Muerte verde. El equipo naranja aumenta su puntaje a %d", TvTNaranjaKills);
SendPBMessage(2, -1, string);
SendPBMessage(3, -1, string);
}
if(PaintballType[playerid] == 4)
{
PaintPvPKills[killerid] += 1;
format(string, sizeof(string), "* [PVP] %s[%d] ha masacrado a %s[%d]", PlayerName(killerid), PaintPvPKills[killerid], PlayerName(playerid), PaintPvPKills[playerid]);
SendPBMessage(4, 0xEBBDA3FF, string);
}
}
if(PlayerInfo[playerid][pHead] > 0)
{
if(IsPlayerConnected(killerid))
{
if(Hitman(killerid) && PlayerInfo[killerid][pRank] > 0)
{
GivePlayerMoney(killerid, PlayerInfo[playerid][pHead]);
format(string, sizeof(string), "** Central: %s matу a %s, y consiguiу %d$", PlayerName(killerid), PlayerName(playerid), PlayerInfo[playerid][pHead]);
SendRadioMessage(23, TEAM_RADIO_COLOR, string);
format(string, sizeof(string), "** Te matу un hitman. Tu cabeza tenнa un valor de: %d$", PlayerInfo[playerid][pHead]);
Message(playerid, COLOR_WHITE, string);
PlayerInfo[playerid][pHead] = 0;
}
}
}
killerid = INVALID_PLAYER_ID;
SetPlayerColor(playerid,COLOR_GRAD2);
return 1;
}
Reply
#10

Holy.

Please use [pawn] tags to post code.

Also, what's the need of having 2012 as admin level? (As i can understand).

I don't see anything wrong in your code (except repeating code, bad identation, waste of variables).

Post your SetPlayerSpawn.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)