Problem mit public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)

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
  • Habe folgendes Problem


    C:\Users\sepei_000\Desktop\SAMP 0.3x [SERVER NORMALE VERSION]\gamemodes\GetALife.pwn(16258) : error 025: function heading differs from prototype



    public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
    {
    if(GetPlayerWeapon(Shooter)==34 || GetPlayerWeapon(Shooter)==33)
    {
    }
    if(TazzerObjState[Shooter]==1)
    {
    if(GetPlayerWeapon(Shooter)==0)
    {
    new string[128],name[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME];
    if(pTazzerstate[Shooter]!=1)
    {
    if(SpielerInfo[Target][Fraktion]!=1 && SpielerInfo[Target][Fraktion]!=2 && SpielerInfo[Target][Fraktion]!=3 && SpielerInfo[Target][Fraktion]!=6)
    {
    TogglePlayerControllable(Target,0);
    GetPlayerName(Shooter,name,sizeof(name));
    GetPlayerName(Target,pname,sizeof(pname));
    SetTimerEx("tazzertimer",5000,0,"u",Target);
    SetTimerEx("tazzerrefresh",8000,0,"u",Shooter);
    pTazzerstate[Shooter]=1;
    pTazzer[Target]=1;
    format(string,sizeof(string),"%s hat %s getazzert.",name,pname);
    RadiusText(Shooter,string,ROSA,20);
    }
    else return SendClientMessage(Shooter,ROT,"Diesen Spieler dürfen sie nicht tazzern!");
    }
    else return SendClientMessage(Shooter,ROT,"Sie dürfen den Tazzer nur alle 7 Sekunden verwenden!");
    }
    else return SendClientMessage(Shooter,ROT,"Sie dürfen keine Waffe tragen, wenn sie einen Tazzer in der Hand haben!");
    }
    return 1;
    }

  • Wusste garnich das so ein public existiert x))
    SChonmal mit OnPlayerTakeDamage versucht?

    Erst wenn
    der letzte Baum gerodet,
    der letzte Fisch vergiftet
    und der letzte Fisch gefangen ist,
    werdet ihr feststellen,
    dass man Gold nicht essen kann.

  • public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
    {
    //issuerid = Der der schießt/schlägt/anfährt ...
    return 1;
    }

    Erst wenn
    der letzte Baum gerodet,
    der letzte Fisch vergiftet
    und der letzte Fisch gefangen ist,
    werdet ihr feststellen,
    dass man Gold nicht essen kann.

  • Zitat

    error 025: function heading differs from prototype


     forward Test();
    public Test(playerid)
    {
    return 1;
    }
    Da kommt dann diese Error Meldung
    forward Test(playerid);
    public Test(playerid)
    {
    return 1;
    }
    Dann ist die Error Meldung weg

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • ach opsp


    vll ist mein plugin zu alt ich nehme mal ein neueres


    C:\Users\sepei_000\Desktop\SAMP 0.3x [SERVER NORMALE VERSION]\pawno\include\OPSP.inc(120) : warning 201: redefinition of constant/macro (symbol "SetPlayerHealth")
    C:\Users\sepei_000\Desktop\SAMP 0.3x [SERVER NORMALE VERSION]\pawno\include\OPSP.inc(130) : warning 201: redefinition of constant/macro (symbol "SetPlayerArmour")

  • ach opsp


    vll ist mein plugin zu alt ich nehme mal ein neueres


    C:\Users\sepei_000\Desktop\SAMP 0.3x [SERVER NORMALE VERSION]\pawno\include\OPSP.inc(120) : warning 201: redefinition of constant/macro (symbol "SetPlayerHealth")
    C:\Users\sepei_000\Desktop\SAMP 0.3x [SERVER NORMALE VERSION]\pawno\include\OPSP.inc(130) : warning 201: redefinition of constant/macro (symbol "SetPlayerArmour")

    Schau mal im Include ob diese oben in irgendeiner weise definiert wurden ;)

  • ne


    /********************************************
    * OnPlayerShootPlayer! V6.0 *
    * Credits: wups, *
    * Double-O-Seven for his HS functions *
    ********************************************/


    // include
    #include <a_samp>
    #tryinclude <foreach>


    // defines
    #if defined OPSP
    #endinput
    #endif
    #define OPSP


    #if !defined foreach
    #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
    #define __SSCANF_FOREACH__
    #endif
    #if defined FILTERSCRIPT
    #error "OnPlayerShootPlayer ERROR: You must include it in your game mode, not in your filterscript!"
    #endif
    #if !defined PRESSED
    #define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
    #endif
    #if !defined RELEASED
    #define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
    #endif
    // variables
    static
    Float:RL_phealth[MAX_PLAYERS],
    Float:RL_parmour[MAX_PLAYERS],
    bool:RL_Shooting[MAX_PLAYERS],
    bool:RL_UpdatedHealth[MAX_PLAYERS],
    bool:RL_OPUP,
    bool:RL_OPSC,
    bool:RL_OPKSC,
    bool:RL_OPC,
    RL_Released[MAX_PLAYERS];
    // forwards
    forward OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost);


    public OnPlayerUpdate(playerid)
    {
    static Float:RL_HP,
    Float:RL_Armour;
    GetPlayerHealth(playerid,RL_HP);
    GetPlayerArmour(playerid,RL_Armour);
    if(RL_HP != RL_phealth[playerid] || RL_Armour != RL_parmour[playerid])
    {
    if(RL_UpdatedHealth[playerid])
    RL_UpdatedHealth[playerid]=false;
    else
    {
    new
    Float:RL_PlayerPos[3],
    Float:RL_Distance,
    Float:RL_CameraPos[3],
    Float:RL_CameraVectors[3],
    RL_Tick
    ;
    RL_Tick = (GetTickCount()-1000);
    GetPlayerPos(playerid, RL_PlayerPos[0], RL_PlayerPos[1], RL_PlayerPos[2]);
    foreach(Player,i)
    {
    if(RL_Shooting[i] || RL_Tick < RL_Released[i])
    {
    if(i != playerid)
    {
    if(IsPlayerInRangeOfPoint(i,200.0,RL_PlayerPos[0], RL_PlayerPos[1], RL_PlayerPos[2]))
    {
    GetPlayerCameraFrontVector(i, RL_CameraVectors[0], RL_CameraVectors[1], RL_CameraVectors[2]);
    GetPlayerCameraPos(i, RL_CameraPos[0], RL_CameraPos[1], RL_CameraPos[2]);
    GetDistanceFromPointToLine(RL_Distance, RL_CameraVectors[0], RL_CameraVectors[1], RL_CameraVectors[2], RL_CameraPos[0], RL_CameraPos[1], RL_CameraPos[2], RL_PlayerPos[0], RL_PlayerPos[1], RL_PlayerPos[2]);
    if(RL_Distance < 2.5)
    {
    CallLocalFunction("OnPlayerShootPlayer","iiff",i,playerid,(RL_phealth[playerid]-RL_HP),(RL_parmour[playerid]-RL_Armour));
    break;
    }
    }
    }
    }
    }
    }
    }
    RL_phealth[playerid]=RL_HP;
    RL_parmour[playerid]=RL_Armour;
    return (RL_OPUP)?CallLocalFunction("RL_OnPlayerUpdate","i",playerid):1;
    }
    // Functions
    stock crossp(Float:v1x, Float:v1y, Float:v1z, Float:v2x, Float:v2y, Float:v2z, &Float:output)
    {
    new
    Float:c1 = (v1y * v2z) - (v1z * v2y),
    Float:c2 = (v1z * v2x) - (v1x * v2z),
    Float:c3 = (v1x * v2y) - (v1y * v2x);
    output = floatsqroot ((c1 * c1) + (c2 * c2) + (c3 * c3));
    return 0;
    }


    stock GetDistanceFromPointToLine(&Float:distance, Float:line_vector_x, Float:line_vector_y, Float:line_vector_z, Float:line_x, Float:line_y, Float:line_z, Float:point_x, Float:point_y, Float:point_z)
    {
    //A line is defined by a point (which is on the line (line_x/y/z)) and a vector which defines the direction (line_vector_x/y/z).
    static Float:output;
    crossp(line_vector_x, line_vector_y, line_vector_z, point_x - line_x, point_y - line_y, point_z - line_z, output);//Cross product of 2 vectors.
    distance = output / floatsqroot ((line_vector_x * line_vector_x) + (line_vector_y * line_vector_y) + (line_vector_z * line_vector_z));
    return 0;
    }
    // SetPlayerHealth
    stock SetPlayerHealthEx(playerid, Float:health)
    {
    // RL_phealth[playerid]=health;
    RL_UpdatedHealth[playerid]=true;
    return SetPlayerHealth(playerid, health);
    }


    #define SetPlayerHealth SetPlayerHealthEx


    // SetPlayerArmour
    stock SetPlayerArmourEx(playerid, Float:armour)
    {
    // RL_parmour[playerid]=armour;
    RL_UpdatedHealth[playerid]=true;
    return SetPlayerArmour(playerid, armour);
    }


    #define SetPlayerArmour SetPlayerArmourEx


    #if defined _ALS_OnPlayerUpdate
    #undef OnPlayerUpdate
    #else
    #define _ALS_OnPlayerUpdate
    #endif


    #define OnPlayerUpdate RL_OnPlayerUpdate
    forward RL_OnPlayerUpdate(playerid);


    // OnPlayerKeyStateChange
    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    if(PRESSED(KEY_FIRE)) RL_Shooting[playerid]=true;
    else if(RELEASED(KEY_FIRE))
    {
    RL_Shooting[playerid]=false;
    RL_Released[playerid]=GetTickCount();
    }
    return (RL_OPKSC)?CallLocalFunction("RL_OnPlayerKeyStateChange","iii",playerid,newkeys,oldkeys):1;
    }
    #if defined _ALS_OnPlayerKeyStateChange
    #undef OnPlayerKeyStateChange
    #else
    #define _ALS_OnPlayerKeyStateChange
    #endif
    #define OnPlayerKeyStateChange RL_OnPlayerKeyStateChange
    forward RL_OnPlayerKeyStateChange(playerid,newkeys,oldkeys);


    // OnPlayerStateChange
    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if(newstate == PLAYER_STATE_WASTED)
    {
    if(RL_UpdatedHealth[playerid])
    RL_UpdatedHealth[playerid]=false;
    else
    {
    new
    Float:RL_PlayerPos[3],
    Float:RL_Distance,
    Float:RL_CameraPos[3],
    Float:RL_CameraVectors[3],
    RL_Tick,
    Float:RL_HP,
    Float:RL_Armour
    ;
    RL_Tick = (GetTickCount()-1000);
    GetPlayerPos(playerid, RL_PlayerPos[0], RL_PlayerPos[1], RL_PlayerPos[2]);
    foreach(Player,i)
    {
    if(RL_Shooting[i] || RL_Tick < RL_Released[i])
    {
    if(i != playerid)
    {
    GetPlayerCameraFrontVector(i, RL_CameraVectors[0], RL_CameraVectors[1], RL_CameraVectors[2]);
    GetPlayerCameraPos(i, RL_CameraPos[0], RL_CameraPos[1], RL_CameraPos[2]);
    if(IsPlayerInRangeOfPoint(i,200.0,RL_PlayerPos[0], RL_PlayerPos[1], RL_PlayerPos[2]))
    {
    GetDistanceFromPointToLine(RL_Distance, RL_CameraVectors[0], RL_CameraVectors[1], RL_CameraVectors[2], RL_CameraPos[0], RL_CameraPos[1], RL_CameraPos[2], RL_PlayerPos[0], RL_PlayerPos[1], RL_PlayerPos[2]);
    if(RL_Distance < 2.5)
    {
    CallLocalFunction("OnPlayerShootPlayer","iiff",i,playerid,(RL_phealth[playerid]-RL_HP),(RL_parmour[playerid]-RL_Armour));
    break;
    }
    }
    }
    }
    }
    }

    }
    RL_Shooting[playerid]=false;
    RL_Released[playerid]=GetTickCount();
    return (RL_OPSC)?CallLocalFunction("RL_OnPlayerStateChange","iii",playerid,newstate,oldstate):1;
    }
    #if defined _ALS_OnPlayerStateChange
    #undef OnPlayerStateChange
    #else
    #define _ALS_OnPlayerStateChange
    #endif
    #define OnPlayerStateChange RL_OnPlayerStateChange


    forward RL_OnPlayerStateChange(playerid,newstate, oldstate);


    // OnPlayerConnect
    public OnPlayerConnect(playerid)
    {
    RL_Shooting[playerid]=false;
    RL_Released[playerid]=0;
    return (RL_OPC)?CallLocalFunction("RL_OnPlayerConnect","i",playerid):1;
    }


    #if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
    #else
    #define _ALS_OnPlayerConnect
    #endif
    #define OnPlayerConnect RL_OnPlayerConnect


    forward RL_OnPlayerConnect(playerid);


    // OnGameModeInit
    public OnGameModeInit()
    {
    RL_OPUP = (funcidx("RL_OnPlayerUpdate") != -1);
    RL_OPSC = (funcidx("RL_OnPlayerStateChange") != -1);
    RL_OPKSC = (funcidx("RL_OnPlayerKeyStateChange") != -1);
    RL_OPC = (funcidx("RL_OnPlayerConnect") != -1);
    return (funcidx("RL_OnGameModeInit") != -1)?CallLocalFunction("RL_OnGameModeInit",""):1;
    }
    #if defined _ALS_OnGameModeInit
    #undef OnGameModeInit
    #else
    #define _ALS_OnGameModeInit
    #endif
    #define OnGameModeInit RL_OnGameModeInit
    forward RL_OnGameModeInit();
    // The end.