[HELP] When player death, server crashes....
#1

Hi all....
I've a big problem.....First of all: I've read all topics about my problem, i've search on web all i need but nothing.....
when players death, the server crash......so i want help please.......

PS: in OnPlayerDeath м've set "debug >=1" but nothing...


simo89

Reply
#2

We're not a GODS and we don't see Your public OnPlayerDeath.
Reply
#3

Quote:
Originally Posted by Jefff
We're not a GODS and we don't see Your public OnPlayerDeath.
right
show us the code then we can help
we can't see it through telepathy n then tell u whats wrong.
Reply
#4

ok.....my onplayerdeath is this:


public OnPlayerDeath(playerid, killerid, reason)
{
if (gdebug >=1){printf("Un giocatore и morto. id giocatore:%d ucciso da:%d motivo:%d", playerid, killerid, reason);}
new name[MAX_PLAYER_NAME];
new string[256];
new dmessage[128];
new deathreason[20];
new playercash;
new victimteam;
new Floatx,Floaty,Floatz;
//new killerteam;
victimteam = (gTeam[playerid]);
//killerteam = (gTeam[killerid]);
gPlayerSpawned[playerid] = 0;
GetPlayerName(playerid, name, sizeof(name));
PlayerInfo[playerid][pLocal] = 255;
GetPlayerPos(playerid, px, py, pz);


if(killerid != 255)
{
if(GetPlayerState(killerid) == 2 && playerid != gPublicEnemy)
{
SendClientMessage(killerid, COLOR_YELLOW, "Uccisione dal mezzo, A piedi riceverai $$$");
return 1;
}
}
if(reason == 3
{
new kstring[128];
new kickname[MAX_PLAYER_NAME];
GetPlayerName(playerid, kickname, sizeof(kickname));
format(kstring, sizeof(kstring), "Pulizia Admin: Il giocatore [%d]%s E'stato bannato, riscontrato uso di cheat",playerid,kickname);
printf("%s", kstring);
SendClientMessageToAll(COLOR_RED, kstring);
Ban(killerid);
}
if(gPlayerFighter[playerid] == 1)
{
DmScore[playerid]--;
if(killerid != INVALID_PLAYER_ID)
{
DmScore[killerid]++;
if(DmScore[killerid] > DmHiScore)
{
new dmname[MAX_PLAYER_NAME];
GetPlayerName(killerid, dmname, sizeof(dmname));
DmHiPlayer = killerid;
DmHiScore = DmScore[killerid];
format(string, sizeof(string), "D.M.NOTIZIE: %s и nell'arena con %d ", dmname,DmHiScore);
BroadCast(COLOR_WHITE, string);
format(string, sizeof(string), " ~g~%d~w~|~g~%d",DmScore[killerid],DmHiScore);
}
else
{
format(string, sizeof(string), " ~r~%d~w~|~g~%d",DmScore[killerid],DmHiScore);
}
GameTextForPlayer(killerid, string, 5000, 6);
}
}
GetWeaponName(reason, deathreason, 20);
format(dmessage, sizeof(dmessage), "sei morto!");
if (strlen(deathreason) == 0)
{
format(deathreason, sizeof(deathreason), "Pugni");
}
if (reason == 41)
{
format(deathreason, sizeof(deathreason), "Spray irritante.");
}
if (gPlayerCheckpointStatus[playerid] == CHECKPOINT_DROPOFF)
{
if (gdebug){print("DEBUG testo6");}
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
new check;
check = gPlayerCheckpointStatus[playerid];
if (gdebug){printf("DEBUG controllo %d" ,check);}
OnPlayerDropCashBox(playerid);
}
if (gPlayerCheckpointStatus[playerid] > 4 && gPlayerCheckpointStatus[playerid] < 11)
{
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
LapCount[playerid] = 0;
}
/*
if((PlayerInfo[playerid][pPhousekey]+1 != gLastCar[playerid] && gLastCar[playerid] != 0) || HireCar[playerid] != gLastCar[playerid] && gLastCar[playerid] != 0)
{
printf("DEBUG PlayerInfo[playerid][pPhousekey](%d) gLastCar[playerid]-1(%d) HireCar[playerid](%d)", PlayerInfo[playerid][pPhousekey],gLastCar[playerid]-1,HireCar[playerid]);
UnLockCar(gLastCar[playerid]);
gCarLock[gLastCar[playerid]] = 0;
gLastDriver[gLastCar[playerid]] = 300;
gLastCar[playerid] = 0;
}
*/
new caller = Mobile[playerid];
if(caller != 255)
{
if(caller < 255)
{
SendClientMessage(caller, COLOR_GRAD2, " La linea и morta....");
CellTime[caller] = 0;
CellTime[playerid] = 0;
Mobile[caller] = 255;
}
Mobile[playerid] = 255;
CellTime[playerid] = 0;
}
ClearCrime(playerid);
if (killerid == INVALID_PLAYER_ID)
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i] != gTeam[playerid] && CrimInRange(20.0, playerid,i) && GetPlayerState(i) != 2)
{
killerid = i;
format(deathreason, sizeof(deathreason), "Intimidazione");
}
}
}
if (killerid == INVALID_PLAYER_ID)
{
if ((gTeam[playerid]) == 0){return 1;}
new slice = ((PlayerInfo[playerid][pLevel]*deathcost)+(basedcost)); //1k +your level
GivePlayerMoney(playerid, -slice);
format(string, sizeof(string), "AMBULATORIO: Il tuo medico di fiducia ti ha curato per $%d, Buona giornata.", slice);
SendClientMessage(playerid, TEAM_CYAN_COLOR, string);
switch (reason)
{
case WEAPON_DROWN:
{
format(string, sizeof(string), ".: %s и affogato :.", name);
BroadCast(COLOR_RED, string);
GameTextForPlayer(playerid, dmessage, 5000, 2);
}
case WEAPON_COLLISION:
{
format(string, sizeof(string), ".: %s si и spiaccicato :.", name);
BroadCast(COLOR_RED, string);
GameTextForPlayer(playerid, dmessage, 5000, 2);
}
default:
{
/*
if (strlen(deathreason) > 0)
{
format(string, sizeof(string), ".: %s died. (%s) :.", name, deathreason);
}*/
// else
// {
format(string, sizeof(string), ".: %s и morto :.", name);
// }
BroadCast(COLOR_RED, string);
GameTextForPlayer(playerid, dmessage, 5000, 2);
}
}
if (gTeam[playerid] == 4)
{
gTeam[playerid] = PlayerInfo[playerid][pTeam];
}
if (gPublicEnemy == playerid)
{
if(killerid == 255)
{
gPublicEnemy = INVALID_PLAYER_ID;
GivePlayerMoney(playerid, -preward);
format(string, sizeof(string), "SMS: %s, Hai pagato il paramedico per $%d, Informatore: Niko Bellic (555)",name,preward);
RingTone[playerid] = 20;
SendClientMessage(playerid, COLOR_YELLOW, string);
KillTimer(offhook);
new tmpmed;
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1 && gTeam[i] == TEAM_CYAN)
{
tmpmed++;
}
}
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1 && gTeam[i] == TEAM_CYAN)
{
GivePlayerMoney(i, preward/tmpmed);
}
}
}
}
return 1;
}
if (Contract[playerid] > 0)
{
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
GivePlayerMoney(killerid, Contract[playerid]);
format(string,128,"<< %s ha rispettato il contratto per %s e ricevuto $%d >>",killer,name,Contract[playerid]);
BroadCast(COLOR_YELLOW, string);
PayLog(string);
Contract[playerid] = 0;
}
if (victimteam >= 4)
{
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
new slice = ((PlayerInfo[playerid][pLevel]*deathcost)+(basedcost)); //1k +your level
playercash = GetPlayerMoney(playerid);
if(SafeTime[playerid] <= 0 || gPlayerFighter[playerid] == 1)
{
if(gTeam[killerid] != gTeam[playerid])
{
if(GetPlayerState(killerid) == 1)
{
PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills]+2;
}
else
{
PlayerInfo[killerid][pKills]++;
}
PlayerInfo[playerid][pKills]--;
if(PlayerInfo[killerid][pKills] >= 30)
{
PlayerInfo[killerid][pExp]++;
PlayerInfo[killerid][pKills] = 0;
SendClientMessage(killerid, COLOR_YELLOW, "Hai aquisito piщ esperienza Exp +1");
}
}
}
if (strlen(deathreason) > 0)// patch
{
if (((gTeam[killerid]) == 1) || ((gTeam[killerid]) == 3 && civnokill) || gTeam[killerid] == gTeam[playerid])//med kill criminal
{
format(string, sizeof(string), ".: %s ha ucciso %s. (%s) :.", killer, name, deathreason);
}
else
{
format(string, sizeof(string), ".: %s ha ucciso %s. (%s) per $%d :.", killer, name, deathreason, slice);
}
if (gdebug){print("DEBUG Deathtest3");}

}
else
{
if (gdebug){print("DEBUG Deathtest4");}
if (((gTeam[killerid]) == 1) || ((gTeam[killerid]) == 3 && civnokill || gTeam[killerid] == gTeam[playerid]))
{
format(string, sizeof(string), ".: %s ha ucciso %s :.", killer, name);
}
else
{
format(string, sizeof(string), ".: %s ha ucciso %s per $%d :.", killer, name, slice);
}
}
if ((gTeam[killerid]) == 2)//cops kill criminal
{
format(string, sizeof(string), ".: %s и stato arrestato da %s (%s) e multato per $%d :.", name, killer, deathreason, slice);
format(dmessage, sizeof(dmessage), "Rovinato");
if(IsACopCar(gLastCar[killerid]))
{
GivePlayerMoney(killerid, 2000);
SendClientMessage(killerid, TEAM_BLUE_COLOR, "Veicolo bonus $2000");
}
}
if (((gTeam[killerid]) == 1) || ((gTeam[killerid]) == 3 && civnokill) || (gTeam[killerid] == gTeam[playerid] && gTeam[playerid] != 4))
{
slice = 0;
}
if (((gTeam[killerid]) != 4) && ((gTeam[killerid]) == gTeam[playerid]))//no team kill
{
slice = 0;
}
if (playercash > 0)
{
if (gdebug){print("DEBUG Deathtest1");}
GivePlayerMoney(playerid, -slice);
}
else
{
if (gdebug){print("DEBUG Deathtest2");}
slice = slice+500;
}
GivePlayerMoney(killerid, slice);
GameTextForPlayer(playerid, dmessage, 5000, 2);
PlayerPlaySound(killerid, 1083, 0.0, 0.0, 0.0);
if (((gTeam[killerid]) == 3) && reason != 49)
{
SetPlayerCriminal(killerid,255, "Prima licenza di uccidere.",0,0);
if(FlashTime[killerid] == 0){FlashTime[killerid] = 10;}
}
else if (((gTeam[killerid]) == 3) && reason == 49)
{
SetPlayerCriminal(killerid,255, "Colpisci e corri!",0,0);
if(FlashTime[killerid] == 0){FlashTime[killerid] = 10;}
}
if (gPublicEnemy == playerid)
{
//SendClientMessage(killerid, TEAM_BLUE_COLOR, "HQ: You Have Arrested Public Enemy No.1, $5000 Bonus PayCheck");
GivePlayerMoney(killerid, preward);
GivePlayerMoney(playerid, -preward);
KillTimer(offhook);
format(string, sizeof(string), "SMS: %s, %s Ha ricevuto come ultimo pagamento $%d, Informatore: Niko Bellic (555)", name, killer,preward);
SendClientMessage(playerid, COLOR_YELLOW, string);
RingTone[playerid] = 20;
format(string, sizeof(string), ".:Il nemico pubblico No.1 %s и stato ucciso da %s (%s) a ha perso $%d :.", name, killer, deathreason, slice);
PlayerInfo[killerid][pPEN]++;
if(PlayerInfo[killerid][pPEN] >= 4)
{
PlayerInfo[killerid][pExp]++;
PlayerInfo[killerid][pPEN] = 0;
SendClientMessage(killerid, COLOR_YELLOW, "Hai acquisito esperienza. Exp +1");
}
PlayerPlayMusic(killerid);
}
BroadCast(COLOR_RED, string);
if (gPublicEnemy != playerid)
{
if(gPlayerFighter[killerid] != 1)
{
format(string, sizeof(string), "~g~$%d", slice);
GameTextForPlayer(killerid, string, 5000, 1);
}
}
else
{
format(string, sizeof(string), "~p~P.E.No.1 ~w~Killed~n~You Take The ~g~$%d", preward);
GameTextForPlayer(killerid, string, 5000, 1);
gPublicEnemy = INVALID_PLAYER_ID;
}
}
else if (victimteam == 2)
{
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
// Cop kill
if (gdebug){print("DEBUG test5");}
PlayerInfo[playerid][pKills]--;
if (gTeam[killerid] == 2)//cops kill cop
{
format(string,128,".: L'ufficiale %s ha ucciso l'ufficiale %s (%s) ed и stato denunciato per $%d :.",killer,name,deathreason,suecost);
PlayerPlaySound(killerid, 1084, 0.0, 0.0, 0.0);
GivePlayerMoney(killerid, -suecost);
GivePlayerMoney(playerid, suecost+100);//+100pays hospital bill
}
else
{
format(string,128,".: %s ha ucciso l'ufficiale %s (%s) :.",killer,name,deathreason);
}
if (gTeam[killerid] == 3)
{
if(reason != 49)
{
SetPlayerCriminal(killerid,255, "Prima licenza di uccidere.",0,0);
}
else if (reason == 49)
{
SetPlayerCriminal(killerid,255, "Colpisci e fuggi.",0,0);
}
if(FlashTime[killerid] == 0){FlashTime[killerid] = 10;}
}
if(gTeam[killerid] >= 5 && SafeTime[playerid] <= 0)
{
if(GetPlayerState(killerid) == 1)
{
PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills]+2;
}
else
{
PlayerInfo[killerid][pKills]++;
}
if(PlayerInfo[killerid][pKills] >= 30)
{
PlayerInfo[killerid][pExp]++;
PlayerInfo[killerid][pKills] = 0;
SendClientMessage(killerid, COLOR_YELLOW, "Hai acquisito piщ esperienza Exp +1");
}
}
BroadCast(COLOR_RED, string);
}
else if (victimteam == 3)
{
if (gdebug){print("DEBUG test6");}
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
// Civ kill
if ((gTeam[killerid]) == 2)//cops kill civ
{
format(string,128,".: L'ufficiale %s ha ucciso %s (%s) ed и stato denunciato per $%d :.",killer,name,deathreason,suecost);
PlayerPlaySound(killerid, 1084, 0.0, 0.0, 0.0);
GivePlayerMoney(killerid, -suecost);
GivePlayerMoney(playerid, suecost+100);//+100pays hospital bill
}
else
{
format(string,128,".: %s ha ucciso %s (%s) :.",killer,name,deathreason);
}
if (((gTeam[killerid]) == 3 || (gTeam[killerid]) == 1) && reason != 49)
{
SetPlayerCriminal(killerid,255, "Prima licenza di uccidere.",0,0);
if(FlashTime[killerid] == 0){FlashTime[killerid] = 10;}
}
else if (((gTeam[killerid]) == 3 || (gTeam[killerid]) == 1) && reason == 49)
{
SetPlayerCriminal(killerid,255, "Colpisci e fuggi.",0,0);
if(FlashTime[killerid] == 0){FlashTime[killerid] = 10;}
}
BroadCast(COLOR_RED, string);
}
else if (victimteam == 1)
{
if (gdebug){print("DEBUG test6");}
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
// Civ kill
if ((gTeam[killerid]) == 2)//cops kill civ
{
format(string,128,".: L'ufficiale %s ha ucciso il paramedico %s (%s) ed и stato denunciato per $%d :.",killer,name,deathreason,suecost);
PlayerPlaySound(killerid, 1084, 0.0, 0.0, 0.0);
GivePlayerMoney(killerid, -suecost);
GivePlayerMoney(playerid, suecost+100);//+100pays hospital bill
}
else if ((gTeam[killerid]) == 1)//med kill civ
{
format(string,128,".: Il paramedico %s ha ucciso %s (%s) ed и stato denunciato per $%d :.",killer,name,deathreason,suecost);
PlayerPlaySound(killerid, 1084, 0.0, 0.0, 0.0);
GivePlayerMoney(killerid, -suecost);
GivePlayerMoney(playerid, suecost+100);//+100pays hospital bill
}
else
{
format(string,128,".: %s ha ucciso %s (%s) :.",killer,name,deathreason);
}
if (((gTeam[killerid]) == 4) && reason != 49)
{
SetPlayerCriminal(killerid,255, "Prima licenza di uccidere.",0,0);
if(FlashTime[killerid] == 0){FlashTime[killerid] = 10;}
}
else if (((gTeam[killerid]) == 3) && reason == 49)
{
SetPlayerCriminal(killerid,255, "Colpisci e fuggi.",0,0);
if(FlashTime[killerid] == 0){FlashTime[killerid] = 10;}
}
BroadCast(COLOR_RED, string);
}
if (gSuperCop == playerid)
{
gSuperCop = INVALID_PLAYER_ID;
}
if(GetPlayerState(killerid) == 1)
{
lastkiller = killerid;
}
killerid = INVALID_PLAYER_ID;
SetPlayerColor(playerid,COLOR_GRAD2);
return 1;
}

Reply
#5

how i hate those RP scripts

well when exactly does it crash
only for a special faction or anything else
or on any faction,... blah anything else.like everytime u die not just in one special moment.
Reply
#6

It crash when i explode with my car or when i kill someone.....
Reply
#7

hmmm sry got no time to watch through the whoile code
i hope some1 else got more time :]
but here it is like 1am and i need ta goto bed.

~Saiberfun
Reply
#8

ok goodnight
Reply
#9

Quote:
Originally Posted by Simo89
ok goodnight
thank you tho i gotta get up in 6hours again^^
well nighty^^

~Saiberfun
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)