Filterscript mit Script verbinden

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,


    mein Problem ist folgendes:


    Ich habe ein Krankenhaussystem Filterscript eingefügt, mitdem man nachdem man unter 5 Healpointskommt auf der Erde liegt. Es gibt auch einen /revive-Befehl mitdem jeder Spieler die Person wiederbeleben kann. Jedoch will ich das das nur die Ärzte anwenden können.


    Also: Bei mir ist es die Fraktionsid 4. Ich muss ja dann irgendwie eine if-Schleieß einbauen...


    if(SpielerInfo[playerid][sMember] == 4 || SpielerInfo[playerid][sLeader] == 4)


    Hier mal das Filterscript:
    //Please dont remove these credits (For me,DArren Reeder (AKA Mowgli on forums)


    //THis is v0.2 where i added a medic pack system, pretty simple just because people sort of requested it...


    #include <a_samp>
    #include <utils>


    #define FILTERSCRIPT


    #define COLOR_LIGHTBLUE 0x33CCFFAA
    #define COLOR_RED 0xAA3333AA
    #define COLOR_LIGHTRED 0xFF6347AA
    #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1


    forward CheckHealth(playerid);
    forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
    forward beingrevived(giveplayerid,playerid);
    forward reviveddone(giveplayerid,playerid);


    new FirstTime[MAX_PLAYERS];
    new OnFloor[MAX_PLAYERS];
    new revid[MAX_PLAYERS];
    new medicpack[MAX_PLAYERS];


    #if defined FILTERSCRIPT


    public OnFilterScriptInit()
    {
    print("Krankenhaussystem wurde erfolgreich geladen!");
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }



    #endif


    public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
    {
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
    return 1;
    }
    return 0;
    }


    public CheckHealth(playerid)
    {
    new Float:health;
    GetPlayerHealth(playerid,health);


    if(health >= 1 && health <= 10)
    {
    if(FirstTime[playerid] == 0)
    {
    SendClientMessage(playerid,COLOR_RED,"Du liegst im sterben! Warte auf einen Arzt...");
    }
    TogglePlayerControllable(playerid,0);
    FirstTime[playerid] = 1;
    OnFloor[playerid] = 1;
    ApplyAnimation(playerid,"CRACK","crckdeth2",4.0,0,0,0,1,1);
    }


    return 1;
    }


    public OnPlayerConnect(playerid)
    {
    SetTimerEx("CheckHealth",100,1,"d",playerid);
    FirstTime[playerid] = 0; OnFloor[playerid] = 0; revid[playerid] = 0; medicpack[playerid] = 1;
    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    FirstTime[playerid] = 0; OnFloor[playerid] = 0; revid[playerid] = 0;
    return 1;
    }


    public OnPlayerSpawn(playerid)
    {
    return 1;
    }


    public OnPlayerDeath(playerid, killerid, reason)
    {
    if(OnFloor[playerid] == 1)
    {
    OnFloor[playerid] = 0;
    TogglePlayerControllable(playerid,1);
    }


    return 1;
    }


    public OnVehicleSpawn(vehicleid)
    {
    return 1;
    }


    public OnVehicleDeath(vehicleid, killerid)
    {
    return 1;
    }


    public OnPlayerText(playerid, text[])
    {
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    dcmd(revive,6,cmdtext);
    if (strcmp("/revivehelp55354", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"/buymedicpack to buy a medic pack for 5,000 dollars");
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"When someones Health bar has reached to 10 they then have 5 minutes");
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"to either /suicide or be /revive'd by somone. If you are revived, your");
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"health is set back to 50.");
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"**Revive System v0.2 created by Mowgli**");
    return 1;
    }
    if (strcmp("/buymedicpack2432423", cmdtext, true, 10) == 0) //die befehle habe ich unbrauchbar gemacht weil ich die nicht wollte
    {
    if(GetPlayerMoney(playerid) <= 4999) return SendClientMessage(playerid,COLOR_LIGHTRED,"You cannot afford a Medic Pack (5,000)");
    else if(medicpack[playerid] == 1) return SendClientMessage(playerid,COLOR_LIGHTRED,"You already have a medic pack!! stupid...");
    else { medicpack[playerid] = 1; SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have bought a medic pack for 5000Dollars.."); GivePlayerMoney(playerid,-5000); }
    return 1;
    }
    if (strcmp("/suicide5335", cmdtext, true, 10) == 0)
    {
    if(OnFloor[playerid] == 1)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"You close your eyes and slowly Grab your knife and Stab your heart.");
    SetPlayerHealth(playerid,0);
    FirstTime[playerid] = 0;
    OnFloor[playerid] = 0;
    return 1;
    }
    else if(OnFloor[playerid] == 0)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"You are not Dieing.");
    }
    return 1;
    }
    return 0;
    }


    dcmd_revive(playerid,params[])
    {
    new string[128];
    new giveplayerid;
    new idx,tmpit[256];
    tmpit = strtok(params,idx);
    giveplayerid = ReturnUser(tmpit);
    if(!strlen(tmpit))
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Benutze: /revive [playerid]");
    return true;
    }
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));


    new onfloorname[MAX_PLAYER_NAME];
    GetPlayerName(giveplayerid, onfloorname, sizeof(onfloorname));


    new Float:px, Float:py, Float:pz;
    GetPlayerPos(giveplayerid,px,py,pz);


    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_RED, "Dieser Spieler ist nicht online!");
    //else if(medicpack[playerid] == 0) return SendClientMessage(playerid,COLOR_RED,"Sorry you do not have any medic packs..(/buymedicpack)");
    else if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_RED, "Du kannst dich nicht selber wiederbeleben!");
    else if(!PlayerToPoint(3.0,playerid,px,py,pz)) return SendClientMessage(playerid, COLOR_RED, "Dieser Spieler ist nicht in deiner nähe!");
    else if(OnFloor[giveplayerid] == 0) return SendClientMessage(playerid,COLOR_RED,"Dieser Spieler muss nicht wiederbelebt werden.");



    if(PlayerToPoint(3.0,playerid,px,py,pz))
    {
    if(IsPlayerConnected(giveplayerid))
    {
    format(string, sizeof(string), "Wiederbeleben: %s", onfloorname);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);


    format(string, sizeof(string), "Wiederbelebung durch: %s", playername);
    SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);


    revid[playerid] = giveplayerid;
    SetTimerEx("beingrevived", 10000, 0, "i", playerid);
    return 1;
    }
    SendClientMessage(playerid,COLOR_RED,"Spieler nicht gefunden!");
    return 1;
    }
    SendClientMessage(playerid,COLOR_RED,"Dieser Spieler ist nicht in deiner nähe!");
    return 1;
    }


    strtok(const string[], &index)
    {
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
    index++;
    }


    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
    result[index - offset] = string[index];
    index++;
    }
    result[index - offset] = EOS;
    return result;
    }


    public beingrevived(giveplayerid,playerid)
    {
    new giveplayer = revid[playerid];
    /*new string[128];
    new onfloorguy[MAX_PLAYER_NAME];
    GetPlayerName(giveplayer, onfloorguy, sizeof(onfloorguy));


    new reviver[MAX_PLAYER_NAME];
    GetPlayerName(playerid, reviver, sizeof(reviver));


    format(string, sizeof(string), "you have been revived by %s", reviver);
    SendClientMessage(giveplayer, COLOR_LIGHTBLUE, string);


    format(string, sizeof(string), "you have revived %s", onfloorguy);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);*/


    SetPlayerHealth(giveplayer, 50);
    SetTimerEx("reviveddone", 1000, 0, "i", playerid);
    return 1;
    }


    public reviveddone(giveplayerid,playerid)
    {
    new giveplayer = revid[playerid];
    TogglePlayerControllable(giveplayer,1);
    FirstTime[giveplayer] = 0;
    OnFloor[giveplayer] = 0;
    ClearAnimations(giveplayer);
    revid[playerid] = 0;
    medicpack[playerid] = 0;
    return 1;
    }


    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    return 1;
    }


    public OnPlayerExitVehicle(playerid, vehicleid)
    {
    return 1;
    }


    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    return 1;
    }


    public OnPlayerEnterCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerLeaveCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerEnterRaceCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerLeaveRaceCheckpoint(playerid)
    {
    return 1;
    }


    public OnRconCommand(cmd[])
    {
    return 1;
    }


    public OnObjectMoved(objectid)
    {
    return 1;
    }


    public OnPlayerObjectMoved(playerid, objectid)
    {
    return 1;
    }


    public OnPlayerPickUpPickup(playerid, pickupid)
    {
    return 1;
    }


    public OnPlayerSelectedMenuRow(playerid, row)
    {
    return 1;
    }


    public OnPlayerExitedMenu(playerid)
    {
    return 1;
    }


    Danke & Mit freundlichen Grüßen
    SyKo

  • Das Pronzip mit Callremotefunction habe ich verstanden, jedoch weiß ich ehrlich gesagt nicht wie man es anwenden sollte. Gibt es auch eine Möglichkeit das Filterscript in mein Reallifescript einzubauen oder hat jemande zu diesem Krankenhausfilterscript eine alternative?


    //EDIT


    Habe eine Fehlermeldung: Habe das Filterscript in das Reallifescript eigefügt und es kommt nur ein Error:


    C:\Users\Moderator\Desktop\Server\Nestra-eGaming Reallife\gamemodes\vw - eingebaut mit Krankenhaussystem.pwn(17705) : error 017: undefined symbol "dcmd"
    C:\Users\Moderator\Desktop\Server\Nestra-eGaming Reallife\gamemodes\vw - eingebaut mit Krankenhaussystem.pwn(50610) : warning 203: symbol is never used: "dcmd_revive"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

    Einmal editiert, zuletzt von Syko ()

  • klar, das geht.


    Achte nur bei OnFilterScriptInit() darauf das du, dass was drin ist bei OnGameModeInit hinmachst!