[HELP]OnPlayerDeath spinnt ...

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hallo kA was da los ist aber OnPlayerDeaht spinnt bei mir schon seit langer Zeit , ich habs immer wieder durch Tricks geschafft es zu biegen aber jz fällt mir nichts ein
    Problem : Die Abfrage InDuel[playerid] wird einfach ignoriert
    public OnPlayerDeath(playerid, killerid, reason)
    {
    //---
    if(killerid==INVALID_PLAYER_ID){
    GameTextForPlayer(playerid,"---WASTED---",2000,3);
    }
    //----
    else if(killerid != INVALID_PLAYER_ID)
    {
    if(Gang[killerid] == Gang[playerid] && IsDm[killerid] == 0)
    {
    teamkills[killerid]++;
    if (teamkills[killerid] > 2){Kick(killerid);}
    SendClientMessage(killerid,hellrot,"You have been punished for teamkillng (3 Teamkills and u get a kick)");
    GivePlayerMoney(killerid,-1000);
    ResetPlayerWeapons(killerid);
    GivePlayerWeapon(killerid,23,100);
    }
    //------------------------------------------------------------------------------
    if(killerid != INVALID_PLAYER_ID && isAtRob[playerid])
    {
    GivePlayerMoney(killerid,6000);
    GivePlayerMoney(playerid,-6000);
    SendClientMessage(playerid, gruen, "The Robber is killed. You get 6.000$");
    isAtRob[playerid] = 0;
    }
    //------------------------------------------------------------------------------
    if(killerid !=INVALID_PLAYER_ID && drugjob[playerid] == 1)
    {
    new StealName[MAX_PLAYER_NAME],LoserName[MAX_PLAYER_NAME];
    new dakigay[128];
    GetPlayerName(playerid,LoserName,sizeof(LoserName));
    GetPlayerName(killerid,StealName,sizeof(StealName));


    SendClientMessageToAll(COLOR_DARKRED, "|______San Francisco-News______|");
    SendClientMessageToAll(hellrot, " ");
    format(dakigay,sizeof(dakigay),"%s has stolen the drugs of %s ",StealName,LoserName);
    SendClientMessageToAll(weiss,dakigay);
    SendClientMessageToAll(weiss, "Stop him! And you get his Drugs !");
    SendClientMessageToAll(weiss, " You find him on the Mini-map(the Red Point)");
    SendClientMessageToAll(hellrot, " ");
    SendClientMessageToAll(COLOR_DARKRED, "|______San Francisco-News______|");


    SetPlayerCheckpoint(killerid,DeliverCheck,3.0);//checkpoint-/-/-/-|
    SendClientMessage(playerid,COLOR_RED,"You have lost your Drugs");
    drugjob[playerid] = 0;
    drugjob[killerid] = 1;
    SendClientMessage(killerid,COLOR_GREEN,"You have stolen the drugs bring them to the red point on the map");
    SetPlayerColor(killerid,COLOR_RED);
    }
    new kname[MAX_PLAYER_NAME],str3[128];
    GetPlayerName(killerid,kname,sizeof(kname));


    if(KillSpree[killerid] == 4){
    format(str3, sizeof(str3),"~r~ %s ~g~ IS DOMINATING",kname);
    GameTextForAll(str3,5000,4);
    SendClientMessage(killerid,COLOR_RED,"You have a KillingSpree of 5 You get 700$");
    GivePlayerMoney(killerid,700);
    }
    if(KillSpree[killerid] == 11){
    format(str3, sizeof(str3),"~r~ %s ~g~ IS ON KILLING SPREE",kname);
    GameTextForAll(str3,5000,4);
    SendClientMessage(killerid,COLOR_RED,"You have a KillingSpree of 12 You get 1400$ and Aromour for free");
    GivePlayerMoney(killerid,1400);
    SetPlayerArmour(killerid,100);
    }
    if(KillSpree[killerid] == 17){
    format(str3, sizeof(str3),"~r~ %s ~g~ HAS A MONSTER KILL",kname);
    GameTextForAll(str3,5000,4);
    SendClientMessage(killerid,COLOR_RED,"You have a KillingSpree of 18 You get 2000$ and Armour+Health for free");
    SetPlayerArmour(killerid,100);
    SetPlayerHealth(killerid,100);
    GivePlayerMoney(killerid,2000);
    }
    if(KillSpree[killerid] == 24){
    format(str3, sizeof(str3),"~r~ %s ~g~ GODLIKE",kname);
    GameTextForAll(str3,5000,4);
    SendClientMessage(killerid,COLOR_RED,"You have a KillingSpree of 25 You get 2500$ and M4,MP5,Sniper,Deagle for free");
    GivePlayerWeapon(killerid,34,1000);
    GivePlayerWeapon(killerid,29,1000);
    GivePlayerWeapon(killerid,24,1000);
    GivePlayerWeapon(killerid,31,1000);
    GivePlayerMoney(killerid,2500);
    }
    if(KillSpree[killerid] == 34){
    format(str3, sizeof(str3),"~r~ %s ~g~ WICKED SICK",kname);
    GameTextForAll(str3,5000,4);
    SendClientMessage(killerid,COLOR_RED,"You have a KillingSpree of 35 You get 3500$ and M4,MP5,Sniper,Deagle,Health,Armour for free");
    GivePlayerWeapon(killerid,34,1000);
    GivePlayerWeapon(killerid,29,1000);
    GivePlayerWeapon(killerid,24,1000);
    GivePlayerWeapon(killerid,31,1000);
    GivePlayerMoney(killerid,3500);
    SetPlayerArmour(killerid,100);
    SetPlayerHealth(killerid,100);
    }
    if(KillSpree[killerid] >= 39){
    format(str3, sizeof(str3),"~g~ HOLY SHIT ~r~ %s with %d KILLS",kname,KillSpree[playerid]);
    GameTextForAll(str3,5000,4);
    SendClientMessage(killerid,COLOR_RED,"You have a ENOURMOUS KILLING SPREE for evry kill while the Spree you will get 1000$");
    GivePlayerMoney(killerid,100);
    }
    //------------------------------------------------------------------------------
    SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    new name[MAX_PLAYER_NAME],deathstring[128];
    GetPlayerName(killerid,name,sizeof(name));
    format(deathstring,sizeof(deathstring),"~r~Owned by %s",name);
    GameTextForPlayer(playerid,deathstring,2000,3);
    KillSpree[killerid]++;
    }
    //----
    else if(Induel[playerid] == 1) // DAS HIER WIRD VOM SCRIPT IGNORIERT kA wieso
    {
    new string[256];
    new killername[MAX_PLAYER_NAME];
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(killerid, killername, sizeof(killername));
    GetPlayerName(playerid, playername, sizeof(playername));
    if(duelRoom1 == playerid || duelRoom1 == killerid)
    {
    Inventation[playerid] = -1;
    InventationSent[playerid] = -1;
    Inventation[killerid] = -1;
    InventationSent[killerid] = -1;
    Induel[playerid] = 0;
    Induel[killerid] = 0;
    format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, duelRoom1price);
    SendClientMessageToAll(GREEN, string);
    GivePlayerMoney(killerid, (duelRoom1price*2));
    SpawnPlayer(killerid);
    duelRoom1 = -1;
    return 1;
    }
    if(duelRoom2 == playerid || duelRoom2 == killerid)
    {
    Inventation[playerid] = -1;
    InventationSent[playerid] = -1;
    Inventation[killerid] = -1;
    InventationSent[killerid] = -1;
    Induel[playerid] = 0;
    Induel[killerid] = 0;
    format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, duelRoom2price);
    SendClientMessageToAll(GREEN, string);
    GivePlayerMoney(killerid, (duelRoom2price*2));
    SpawnPlayer(killerid);
    duelRoom2 = -1;
    return 1;
    }
    if(duelRoom3 == playerid || duelRoom3 == killerid)
    {
    Inventation[playerid] = -1;
    InventationSent[playerid] = -1;
    Inventation[killerid] = -1;
    InventationSent[killerid] = -1;
    Induel[playerid] = 0;
    Induel[killerid] = 0;
    format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, duelRoom3price);
    SendClientMessageToAll(GREEN, string);
    GivePlayerMoney(killerid, (duelRoom3price*2));
    SpawnPlayer(killerid);
    duelRoom3 = -1;
    return 1;
    }
    if(duelRoom4 == playerid || duelRoom4 == killerid)
    {
    Inventation[playerid] = -1;
    InventationSent[playerid] = -1;
    Inventation[killerid] = -1;
    InventationSent[killerid] = -1;
    Induel[playerid] = 0;
    Induel[killerid] = 0;
    format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, duelRoom4price);
    SendClientMessageToAll(GREEN, string);
    GivePlayerMoney(killerid, (duelRoom4price*2));
    SpawnPlayer(killerid);
    duelRoom4 = -1;
    return 1;
    }
    return 1;
    }
    SendDeathMessage(killerid,playerid,reason);
    SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
    KillSpree[playerid] = 0;
    drugjob[playerid] = 0;
    DisablePlayerCheckpoint(playerid);
    Spieler[playerid][Deaths]++;
    Spieler[killerid][Kills]++;
    return 1;
    }

  • Versuch damit:


    else if(Induel[playerid] == 1) // DAS HIER WIRD VOM SCRIPT IGNORIERT kA wieso
    {
    new string[256];
    new killername[MAX_PLAYER_NAME];
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(killerid, killername, sizeof(killername));
    GetPlayerName(playerid, playername, sizeof(playername));
    if(duelRoom1 == playerid || duelRoom1 == killerid)
    {
    Inventation[playerid] = -1;
    InventationSent[playerid] = -1;
    Induel[playerid] = 0;
    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID) { //Das habe ich hinzugefügt, hier wird geprüft, ob überhaupt eine killerid existiert, den selben Fehler habe ich so gelöst.
    Inventation[killerid] = -1; //Ab hier sind die ganzen killerid Dingah.
    InventationSent[killerid] = -1;
    Induel[killerid] = 0;
    GivePlayerMoney(killerid, (duelRoom1price*2));
    SpawnPlayer(killerid);
    } //Bis hier!
    format(string, sizeof(string), "%s defeated %s in a duel and wins $%d", killername, playername, duelRoom1price);
    SendClientMessageToAll(GREEN, string);
    duelRoom1 = -1;
    return 1;
    }
    }


    Mach das mit allen so und teste mal.

  • Hast du auch alles bei killerid mit diesem 'if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)' abgefragt?
    Eine ganze OnPlayerDeath funktion kann streiken, weil das Script nicht weiß, was er mit killerid machen muss.


    Ich hatte den selben Fehler, bei meinem eigenen Script funktioniert das einwandfrei...


    EDIT: Mach das gesammte OnPlayerDeath nach meinem Beispiel und poste mal nochmal...

  • Ne damit wird das ganze noch mehr verbuggt , also alles hat sich vermischt :S ,naja bin müde , hoffe mir wird nocht was einfallen (oder dir) xD oder ich mach einfach ein DUel filterscript gute nacht und danke für die Hilfe :)