IsPlayerRangeOfPoint Fail?

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
  • Guten Morgen,


    Ich habe das /buygun System ein wenig überarbeitet und in ein Dialog gepackt.
    Nun wenn ich in die Ammunation gehe und /buygun eingebe bekomme ich dauerhaft die Meldung, das ich in keinem Waffenladen bin.
    Aber wo liegt der Fehler?
    Die Position ist definitiv richtig gesetzt.


    Code:
    if(strcmp(cmdtext,"/buygun",true) == 0)
    {
    if(IsPlayerInRangeOfPoint(playerid,30.0,235.6019,168.0306,1003.0300))
    {
    if(PlayerInfo[playerid][pGunLic] == 1)
    {
    ShowPlayerDialog(playerid,DIALOG_GUNMENUE,DIALOG_STYLE_LIST,"Gun Menü","Waffen Kaufen\nLaser Menü","Auswählen","Abbrechen");
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED,"Sie haben keinen Waffenschein.");
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED,"Sie sind nicht im Waffenladen.");
    }
    return 1;
    }


    MfG,
    AroX

  • Versuch mal das :)



    if(strcmp(cmdtext,"/buygun",true) == 0)
    {
    if(!IsPlayerInRangeOfPoint(playerid,30.0,235.6019,168.0306,1003.0300))return SendClientMessage(playerid,COLOR_RED,"Sie sind nicht im Waffenladen.");
    if(!PlayerInfo[playerid][pGunLic] == 1)return SendClientMessage(playerid,COLOR_RED,"Sie haben keinen Waffenschein.");
    ShowPlayerDialog(playerid,DIALOG_GUNMENUE,DIALOG_STYLE_LIST,"Gun Menü","Waffen Kaufen\nLaser Menü","Auswählen","Abbrechen");
    }
    return 1;
    }



  • "Pawn Compiler libary funktioniert nicht mehr"

  • Klammerfehler



    if(strcmp(cmdtext,"/buygun",true) == 0)
    {
    if(!IsPlayerInRangeOfPoint(playerid,30.0,235.6019,168.0306,1003.0300))return SendClientMessage(playerid,COLOR_RED,"Sie sind nicht im Waffenladen.");
    if(!PlayerInfo[playerid][pGunLic] == 1)return SendClientMessage(playerid,COLOR_RED,"Sie haben keinen Waffenschein.");
    ShowPlayerDialog(playerid,DIALOG_GUNMENUE,DIALOG_STYLE_LIST,"Gun Menü","Waffen Kaufen\nLaser Menü","Auswählen","Abbrechen");
    return 1;
    }

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • if(strcmp(cmdtext,"/buygun",true) == 0)
    {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    printf("Pos: %f / %f / %f | Range: %d", x, y, z, IsPlayerInRangeOfPoint(playerid,30.0,235.6019,168.0306,1003.0300));
    if(IsPlayerInRangeOfPoint(playerid,30.0,235.6019,168.0306,1003.0300))
    {
    if(PlayerInfo[playerid][pGunLic] == 1)
    {
    ShowPlayerDialog(playerid,DIALOG_GUNMENUE,DIALOG_STYLE_LIST,"Gun Menü","Waffen Kaufen\nLaser Menü","Auswählen","Abbrechen");
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED,"Sie haben keinen Waffenschein.");
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED,"Sie sind nicht im Waffenladen.");
    }
    return 1;
    }


    Debugge es mal so. Gebe den Befehl ein und poste dann was im Server Log steht, als Position.

  • Jeffry die server.log


    ----------
    Loaded log file: "server_log.txt".
    ----------


    SA-MP Dedicated Server
    ----------------------
    v0.3.7, (C)2005-2015 SA-MP Team


    [17:53:56] hostname = "SA-MP Server" (string)
    [17:53:56] filterscripts = "" (string)
    [17:53:56]
    [17:53:56] Server Plugins
    [17:53:56] --------------
    [17:53:56] Loading plugin: streamer.so
    [17:53:56]


    *** Streamer Plugin v2.7.8 by Incognito loaded ***


    [17:53:56] Loaded.
    [17:53:56] Loading plugin: sscanf.so
    [17:53:56]


    [17:53:56] ===============================


    [17:53:56] sscanf plugin loaded.


    [17:53:56] (c) 2009 Alex "Y_Less" Cole


    [17:53:56] 0.3d-R2 500 Players "dnee"


    [17:53:56] ===============================


    [17:53:56] Loaded.
    [17:53:56] Loading plugin: audio.so
    [17:53:56]
    *** Audio Plugin v0.4 by Incognito loaded ***


    [17:53:56] Loaded.
    [17:53:56] Loaded 3 plugins.


    [17:53:57]
    [17:53:57] Ban list
    [17:53:57] --------
    [17:53:57] Loaded: samp.ban
    [17:53:57]
    [17:53:57]
    [17:53:57] Filterscripts
    [17:53:57] ---------------
    [17:53:57] Loaded 0 filterscripts.


    [17:53:57] BizzInfo:0 Owner:[GER]Richter Message:GhostGunshop Entfee:150 Till:73550 Products:10007425/500 Interior:6.


    [17:53:57] BizzInfo:1 Owner:Der Staat Message:Mr_Ghost Gunshop Entfee:2 Till:2908 Products:409/500 Interior:7.


    [17:53:57] BizzInfo:2 Owner:[PrB]smokY Message:Restaurant zum Mönchen Entfee:500 Till:3350 Products:320/500 Interior:1.


    [17:53:57] BizzInfo:3 Owner:Der Staat Message:Yakuza Gunshop Entfee:50 Till:1450 Products:487/500 Interior:6.


    [17:53:57] BizzInfo:4 Owner:Unknown_User Message:Obi Baumarkt Entfee:500 Till:0 Products:99654/100000 Interior:4.


    [17:53:57] SBizzInfo:0 Owner:Zu Verkaufen Message:Jack´s Carren Entfee:500 Till:4312000 Products:100/100 Interior:0.


    [17:53:57] SBizzInfo:1 Owner:Zu Verkaufen Message:WANG CARS Entfee:500 Till:370 Products:100/100 Interior:0.


    [17:53:57] SBizzInfo:2 Owner:Enduron Message:Endurons Biz Entfee:5 Till:3645 Products:100/100 Interior:0.


    [17:53:57] SBizzInfo:3 Owner:Zu Verkaufen Message:~w~Gas Company Entfee:1 Till:90802 Products:100/100 Interior:0.


    [17:53:57] SBizzInfo:4 Owner:Zu Verkaufen Message:Olli's Strom - Company Entfee:300 Till:118500 Products:100/100 Interior:0.


    [17:53:57] SBizzInfo:5 Owner:Zu Verkaufen Message:~w~Car Delivery Entfee:0 Till:91000 Products:81/100 Interior:0.


    [17:53:57] SBizzInfo:6 Owner:Zu Verkaufen Message:Papas House Upgrade Biz Entfee:0 Till:25809 Products:95/100 Interior:0.


    [17:53:57] SBizzInfo:7 Owner:Icon Message:]]]San Andreas News]]] Entfee:2 Till:0 Products:100/100 Interior:0.


    [17:53:57] SBizzInfo:8 Owner:Zu Verkaufen Message:~w~Tow Car Service Entfee:0 Till:250 Products:97/100 Interior:0.


    [17:53:57] GangZone 0 loadad: 1677.387939,-2164.481933,1870.788208,-2007.005126,1858.253662,-2096.573974,13.546899,5
    [17:53:57] GangZone 1 loadad: 630.636413,-1587.785766,779.336669,-1401.087890,723.152221,-1482.819702,1.968799,6
    [17:53:57] GangZone 2 loadad: 2524.522460,2196.688720,2664.685791,2450.328613,2587.406982,2309.241699,17.822200,13
    [17:53:57] GangZone 3 loadad: 0.000000,2196.688720,2664.685791,2450.328613,2587.406982,2309.241699,17.822200,13
    [17:53:57] GangZone 4 loadad: 0.000000,2196.688720,2664.685791,2450.328613,2587.406982,2309.241699,17.822200,13
    [17:53:57] GangZone 5 loadad: 0.000000,2196.688720,2664.685791,2450.328613,2587.406982,2309.241699,17.822200,13
    [17:53:57] GangZone 6 loadad: 0.000000,2196.688720,2664.685791,2450.328613,2587.406982,2309.241699,17.822200,13
    [17:53:57] AllowAdminTeleport() : function is deprecated. Please see OnPlayerClickMap()
    [17:53:57] Pickups Max = 2048, Current Pickups = 436
    [17:53:57] _______________________________________
    [17:53:57] Das Script wurde Vollständig geladen!
    [17:53:57] _______________________________________
    [17:53:57]
    [17:53:57] Number of vehicle models: 72
    [17:55:34] [connection] 91.50.243.31:56668 requests connection cookie.
    [17:55:35] Incoming connection: 91.50.243.31:56668 id: 0
    [17:55:36] [join] [PrB]AroX has joined the server (0:91.50.243.31)
    [17:55:43] [PrB]AroX has logged in.
    [17:57:09] Pos: 294.354431 / -80.423316 / 1001.515625 | Range: 0
    [17:57:23] Pos: 294.661590 / -80.419509 / 1001.515625 | Range: 0

  • ----------
    Loaded log file: "server_log.txt".
    ----------


    SA-MP Dedicated Server
    ----------------------
    v0.3.7, (C)2005-2015 SA-MP Team


    [18:02:38] hostname = "SA-MP Server" (string)
    [18:02:38] filterscripts = "" (string)
    [18:02:38]
    [18:02:38] Server Plugins
    [18:02:38] --------------
    [18:02:38] Loading plugin: streamer.so
    [18:02:38]


    *** Streamer Plugin v2.7.8 by Incognito loaded ***


    [18:02:38] Loaded.
    [18:02:38] Loading plugin: sscanf.so
    [18:02:38]


    [18:02:38] ===============================


    [18:02:38] sscanf plugin loaded.


    [18:02:38] (c) 2009 Alex "Y_Less" Cole


    [18:02:38] 0.3d-R2 500 Players "dnee"


    [18:02:38] ===============================


    [18:02:38] Loaded.
    [18:02:38] Loading plugin: audio.so
    [18:02:38]
    *** Audio Plugin v0.4 by Incognito loaded ***


    [18:02:38] Loaded.
    [18:02:38] Loaded 3 plugins.


    [18:02:38]
    [18:02:38] Ban list
    [18:02:38] --------
    [18:02:38] Loaded: samp.ban
    [18:02:38]
    [18:02:38]
    [18:02:38] Filterscripts
    [18:02:38] ---------------
    [18:02:38] Loaded 0 filterscripts.


    [18:02:38] BizzInfo:0 Owner:[GER]Richter Message:GhostGunshop Entfee:150 Till:73550 Products:10007425/500 Interior:6.


    [18:02:38] BizzInfo:1 Owner:Der Staat Message:Mr_Ghost Gunshop Entfee:2 Till:2908 Products:409/500 Interior:7.


    [18:02:38] BizzInfo:2 Owner:[PrB]smokY Message:Restaurant zum Mönchen Entfee:500 Till:3350 Products:320/500 Interior:1.


    [18:02:38] BizzInfo:3 Owner:Der Staat Message:Yakuza Gunshop Entfee:50 Till:1450 Products:487/500 Interior:6.


    [18:02:38] BizzInfo:4 Owner:Unknown_User Message:Obi Baumarkt Entfee:500 Till:0 Products:99654/100000 Interior:4.


    [18:02:38] SBizzInfo:0 Owner:Zu Verkaufen Message:Jack´s Carren Entfee:500 Till:4312000 Products:100/100 Interior:0.


    [18:02:38] SBizzInfo:1 Owner:Zu Verkaufen Message:WANG CARS Entfee:500 Till:370 Products:100/100 Interior:0.


    [18:02:38] SBizzInfo:2 Owner:Enduron Message:Endurons Biz Entfee:5 Till:3645 Products:100/100 Interior:0.


    [18:02:38] SBizzInfo:3 Owner:Zu Verkaufen Message:~w~Gas Company Entfee:1 Till:90802 Products:100/100 Interior:0.


    [18:02:38] SBizzInfo:4 Owner:Zu Verkaufen Message:Olli's Strom - Company Entfee:300 Till:118500 Products:100/100 Interior:0.


    [18:02:38] SBizzInfo:5 Owner:Zu Verkaufen Message:~w~Car Delivery Entfee:0 Till:91000 Products:81/100 Interior:0.


    [18:02:38] SBizzInfo:6 Owner:Zu Verkaufen Message:Papas House Upgrade Biz Entfee:0 Till:25809 Products:95/100 Interior:0.


    [18:02:38] SBizzInfo:7 Owner:Icon Message:]]]San Andreas News]]] Entfee:2 Till:0 Products:100/100 Interior:0.


    [18:02:38] SBizzInfo:8 Owner:Zu Verkaufen Message:~w~Tow Car Service Entfee:0 Till:250 Products:97/100 Interior:0.


    [18:02:38] GangZone 0 loadad: 1677.387939,-2164.481933,1870.788208,-2007.005126,1858.253662,-2096.573974,13.546899,5
    [18:02:38] GangZone 1 loadad: 630.636413,-1587.785766,779.336669,-1401.087890,723.152221,-1482.819702,1.968799,6
    [18:02:38] GangZone 2 loadad: 2524.522460,2196.688720,2664.685791,2450.328613,2587.406982,2309.241699,17.822200,13
    [18:02:38] GangZone 3 loadad: 0.000000,2196.688720,2664.685791,2450.328613,2587.406982,2309.241699,17.822200,13
    [18:02:38] GangZone 4 loadad: 0.000000,2196.688720,2664.685791,2450.328613,2587.406982,2309.241699,17.822200,13
    [18:02:38] GangZone 5 loadad: 0.000000,2196.688720,2664.685791,2450.328613,2587.406982,2309.241699,17.822200,13
    [18:02:38] GangZone 6 loadad: 0.000000,2196.688720,2664.685791,2450.328613,2587.406982,2309.241699,17.822200,13
    [18:02:38] AllowAdminTeleport() : function is deprecated. Please see OnPlayerClickMap()
    [18:02:38] Pickups Max = 2048, Current Pickups = 436
    [18:02:38] _______________________________________
    [18:02:38] Das Script wurde Vollständig geladen!
    [18:02:38] Script Edit by ThePrayer
    [18:02:38] _______________________________________
    [18:02:38]
    [18:02:38] Number of vehicle models: 72
    [18:02:56] [connection] 91.50.243.31:60590 requests connection cookie.
    [18:02:57] Incoming connection: 91.50.243.31:60590 id: 0
    [18:02:57] [join] [PrB]AroX has joined the server (0:91.50.243.31)
    [18:03:03] [PrB]AroX has logged in.
    [18:04:17] Pos: 294.701568 / -80.321105 / 1001.515625 | Range: 0


    if(strcmp(cmdtext,"/buygun",true) == 0)
    {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    printf("Pos: %f / %f / %f | Range: %d", x, y, z, IsPlayerInRangeOfPoint(playerid,30.0,294.661590,-80.419509,1001.515625));
    if(IsPlayerInRangeOfPoint(playerid,30.0,294.661590,-80.419509,1001.515625))
    {
    if(PlayerInfo[playerid][pGunLic] == 1)
    {
    ShowPlayerDialog(playerid,DIALOG_GUNMENUE,DIALOG_STYLE_LIST,"Gun Menü","Waffen Kaufen\nLaser Menü","Auswählen","Abbrechen");
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED,"Sie haben keinen Waffenschein.");
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED,"Sie sind nicht im Waffenladen.");
    }
    return 1;
    }



    //EDIT


    Jeffry bitte um Hilfe, ich kann mir diesen Fehler nicht wirklich erklären.

    Einmal editiert, zuletzt von AroX ()

  • Habe dich nicht vergessen, ich hatte nur gestern Abend keine Zeit mehr.
    Erklären kann ich mir das Problem so auch nicht. Nutzt der Code eine gehookte oder selbstdefinierte Version von IsPlayerInRangeOfPoint?
    Hast du vielleicht einen anderen Code, bei dem IsPlayerInRangeOfPoint funktioniert, wenn ja, kannst du den posten?


    Alternativ, versuche mal das hier:
    if(IsPlayerInRangeOfPoint(playerid,30.0,294.661590,-80.419509,1001.515625))
    zu:
    if(GetPlayerDistanceFromPoint(playerid,294.661590,-80.419509,1001.515625) < 30.0)
    oder:
    if(x > 280.0 && x < 310.0 && y > -95.0 && y < -65.0 && z > 990.0 && z < 1100.0)


    Klappt eine der beiden Varianten?

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