PlayToPoint funktioniert nicht richtig

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
  • Hi, hab mir mal dieses Filterscript zusammengeschrieben und es funktioniert nicht ganz so, wie gewünscht.


    #include <a_samp>


    #pragma tabsize 0
    #define COLOR_YELLOW 0xFFFF00AA
    #define FILTERSCRIPT
    #define PlayerToPoint
    #if defined FILTERSCRIPT
    new pdls_gate;
    new pdsf_gate;
    new pdlv_gate;



    public OnFilterScriptInit()
    {
    pdls_gate = CreateObject(7657, 1547.188843, -1642.849487, 14.099655, 0.0000, 0.0000, 269.7591);
    pdsf_gate = CreateObject(976, -1571.564331, 658.912109, 6.349410, 0.0000, 0.0000, 269.7591);
    pdlv_gate = CreateObject(976, 2237.098145, 2457.347168, 9.940882, 0.0000, 0.0000, 89.3814);


    print("\n-------------------");
    print("-Filterscript-Test-");
    print("-------------------\n");
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }


    #else


    #endif


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp(cmdtext, "/pdlsclose", true) == 0){
    if (PlayerToPoint(10.0, playerid, 1547.213867, -1627.848999, 14.099655))
    MoveObject(pdls_gate,1547.213867, -1627.848999, 14.099655,5);
    return 1;
    }
    if (strcmp(cmdtext, "/pdlsopen", true) == 0){
    if (PlayerToPoint(10.0, playerid, 1547.213867, -1627.848999, 14.099655))
    MoveObject(pdls_gate,1547.188843, -1642.849487, 14.099655,5);
    return 1;
    }
    if (strcmp(cmdtext, "/pdsfclose", true) == 0){
    if (PlayerToPoint(10.0, playerid, -1571.564331, 665.585815, 6.349410))
    MoveObject(pdsf_gate,-1571.564331, 665.585815, 6.349410,5);
    return 1;
    }
    if (strcmp(cmdtext, "/pdsfopen", true) == 0){
    if (PlayerToPoint(10.0, playerid, -1571.564331, 665.585815, 6.349410))
    MoveObject(pdsf_gate, -1571.564331, 665.585815, 6.349410,5);
    return 1;
    }
    if (strcmp(cmdtext, "/pdlvclose", true) == 0){
    if (PlayerToPoint(10.0, playerid, 2237.098145, 2449.073242, 9.940882))
    MoveObject(pdlv_gate, 2237.098145, 2449.073242, 9.940882,5);
    return 1;
    }
    if (strcmp(cmdtext, "/pdlvopen", true) == 0){
    if (PlayerToPoint(10.0, playerid, 2237.098145, 2449.073242, 9.940882))
    MoveObject(pdlv_gate, 2237.098145, 2449.073242, 9.940882,5);
    return 1;
    }
    return 0;
    }


    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(37) : warning 206: redundant test: constant expression is non-zero
    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(42) : warning 206: redundant test: constant expression is non-zero
    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(47) : warning 206: redundant test: constant expression is non-zero
    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(52) : warning 206: redundant test: constant expression is non-zero
    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(57) : warning 206: redundant test: constant expression is non-zero
    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(62) : warning 206: redundant test: constant expression is non-zero
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    6 Warnings.


    *Hilfe brauch :thumbup: *

  • public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp(cmdtext, "/pdlsclose", true) == 0){
    if (PlayerToPoint(10.0, playerid, 1547.213867, -1627.848999, 14.099655)){
    MoveObject(pdls_gate,1547.213867, -1627.848999, 14.099655,5);}
    return 1;
    }
    if (strcmp(cmdtext, "/pdlsopen", true) == 0){
    if (PlayerToPoint(10.0, playerid, 1547.213867, -1627.848999, 14.099655)){
    MoveObject(pdls_gate,1547.188843, -1642.849487, 14.099655,5);}
    return 1;
    }
    if (strcmp(cmdtext, "/pdsfclose", true) == 0){
    if (PlayerToPoint(10.0, playerid, -1571.564331, 665.585815, 6.349410)){
    MoveObject(pdsf_gate,-1571.564331, 665.585815, 6.349410,5);}
    return 1;
    }
    if (strcmp(cmdtext, "/pdsfopen", true) == 0){
    if (PlayerToPoint(10.0, playerid, -1571.564331, 665.585815, 6.349410))
    MoveObject(pdsf_gate, -1571.564331, 665.585815, 6.349410,5);
    return 1;
    }
    if (strcmp(cmdtext, "/pdlvclose", true) == 0){
    if (PlayerToPoint(10.0, playerid, 2237.098145, 2449.073242, 9.940882)){
    MoveObject(pdlv_gate, 2237.098145, 2449.073242, 9.940882,5);}
    return 1;
    }
    if (strcmp(cmdtext, "/pdlvopen", true) == 0){
    if (PlayerToPoint(10.0, playerid, 2237.098145, 2449.073242, 9.940882)){
    MoveObject(pdlv_gate, 2237.098145, 2449.073242, 9.940882,5);}
    return 1;
    }
    return 0;
    }

    Mfg. BlackFoX_UD_ alias [BFX]Explosion


  • Hmm, danke schon mal, aber wenn ich es jetzt Compilen will, dann kommt das hier:


    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(37) : warning 206: redundant test: constant expression is non-zero
    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(42) : warning 206: redundant test: constant expression is non-zero
    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(47) : warning 206: redundant test: constant expression is non-zero
    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(52) : warning 206: redundant test: constant expression is non-zero
    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(57) : warning 206: redundant test: constant expression is non-zero
    C:\Dokumente und Einstellungen\Daniel\Desktop\Gates2.pwn(62) : warning 206: redundant test: constant expression is non-zero
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    6 Warnings.

  • hast du PlayerToPoint im script? wenn nein mach das weg#define PlayerToPoint und füge das oben ins script ein: forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
    {
    if(IsPlayerConnected(playerid))
    {
    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;
    }