Fiterscript : Samp stürtz ab.

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 ich hab ein Auswahl Menü Script geschrieben. Leider hab ich das problem. Das der Samp Server abstürtz, wenn sich jemand ins Spiel einloggt.



    #include <a_samp>


    new Menu:haupt;
    new Menu:teleport;
    new Menu:areas;
    new Menu:tune;
    new Menu:spende;
    #define COLOR_RED 0xAA3333AA
    #define COLOR_GREEN 0x33AA33AA



    public OnFilterScriptInit() {
    //
    }


    public OnFilterScriptExit() {
    //
    }


    public OnGameModeInit()
    {
    haupt=Menu:CreateMenu("~w~Haupt Menue",1,130,150,300);
    SetMenuColumnHeader(haupt,0,"Auswahl Treffen!");
    AddMenuItem(haupt,0," Teleport");
    AddMenuItem(haupt,0," Area´s");
    AddMenuItem(haupt,0," Tuning");
    AddMenuItem(haupt,0," Spende");


    teleport=Menu:CreateMenu("~w~Teleport Menue",1,130,150,300);
    SetMenuColumnHeader(teleport,0,"Wohin willst du ?");
    AddMenuItem(teleport,0," Los Santos");
    AddMenuItem(teleport,0," San Fierro");
    AddMenuItem(teleport,0," Las Venturas");


    areas=Menu:CreateMenu("~w~Area Menue",1,130,150,300);
    SetMenuColumnHeader(areas,0,"Auswahl der Area");
    AddMenuItem(areas,0," Admin Area");
    AddMenuItem(areas,0," VIP Area");


    tune=Menu:CreateMenu("~w~Tuning Menue",1,130,150,300);
    SetMenuColumnHeader(tune,0,"Auswahl Treffen ?");
    AddMenuItem(tune,0," Hayssens Komplett Pack V.1");
    AddMenuItem(tune,0," Hayssens Komplett Pack V.2");
    AddMenuItem(tune,0," Hayssens Komplett Pack V.3");


    spende=Menu:CreateMenu("~w~Spenden Menue",1,130,150,300);
    SetMenuColumnHeader(spende,0,"Wieviel soll es sein ?");
    AddMenuItem(spende,0," 100$");
    AddMenuItem(spende,0," 200$");




    return 1;
    }


    public OnGameModeExit()
    {
    DestroyMenu(haupt);
    DestroyMenu(teleport);
    DestroyMenu(areas);
    DestroyMenu(tune);
    DestroyMenu(spende);
    return 1;
    }


    public OnPlayerSelectedMenuRow(playerid, row)
    {
    new Menu:Now;
    Now=Menu:GetPlayerMenu(playerid);


    if(Now==haupt) {
    TogglePlayerControllable(playerid,false);
    switch(row) {
    case 0: {
    ShowMenuForPlayer(teleport,playerid);
    }
    case 1: {
    ShowMenuForPlayer(areas,playerid);
    }
    case 2: {
    ShowMenuForPlayer(tune,playerid);
    }
    case 3: {
    ShowMenuForPlayer(spende,playerid);
    }
    }
    }
    if(Now==teleport) {
    TogglePlayerControllable(playerid,false);
    switch(row) {
    case 0: {
    SetPlayerPos(playerid,1642.0,-2332.0,13.0);
    }
    case 1: {
    SetPlayerPos(playerid,-1397.0,-317.0,14.0);
    }
    case 2: {
    SetPlayerPos(playerid,1704.0,1365.0,10.0);
    }
    }
    }
    if(Now==areas) {
    TogglePlayerControllable(playerid,true);
    switch(row) {
    case 0: {
    SetPlayerPos(playerid,2537.5649,2758.7773,10.8203);
    }
    case 1: {
    SetPlayerPos(playerid,1175.1715,-2042.6002,69.0078);
    }
    }
    }
    if(Now==tune) {
    TogglePlayerControllable(playerid,true);
    switch(row) {
    case 0: {
    ChangeVehicleColor(GetPlayerVehicleID(playerid), 0, 0);
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1080);
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
    SendClientMessage(playerid,COLOR_GREEN,"Das paket kostet dich 2500$");
    GivePlayerMoney(playerid, -2500);
    }
    case 1: {
    ChangeVehicleColor(GetPlayerVehicleID(playerid), 3, 3);
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1082);
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
    SendClientMessage(playerid,COLOR_GREEN,"Das paket kostet dich 2500$");
    GivePlayerMoney(playerid, -2500);
    }
    case 2: {
    ChangeVehicleColor(GetPlayerVehicleID(playerid), 44, 44);
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1081);
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
    SendClientMessage(playerid,COLOR_GREEN,"Das paket kostet dich 2500$");
    GivePlayerMoney(playerid, -2500);
    }
    }
    }
    if(Now==spende) {
    TogglePlayerControllable(playerid,true);
    switch(row) {
    case 0: {
    SendClientMessage(playerid,COLOR_GREEN,"100$ erhalten!");
    GivePlayerMoney(playerid, 100);
    }
    case 1: {
    SendClientMessage(playerid,COLOR_GREEN,"200$ erhalten!");
    GivePlayerMoney(playerid, 200);
    }
    }
    }
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {


    new cmd[256];


    if(strcmp(cmd, "/auswahl", true) == 0) {
    ShowMenuForPlayer(haupt,playerid);
    return 1;
    }


    return 0;
    }

    3 Mal editiert, zuletzt von Hayssen ()

  • Da es ein Filterscript ist,kannst du "OnGameModeInit()" und "OnGameModeExit()" nicht verwenden.
    Versuch es mal neu,in dem du alles was unter "OnGameModeInit()" hast unter "OnFilterScriptInit()" einfügst.
    Das Gleiche machst du auch mit "OnGameModeExit()".


    Nebenbei,dein Command solltest du ändern.Du hast nämlich "cmd" neu definiert und vergleichst es mit "/auswahl"."cmd" ist aber ein leerer String.

    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(strcmp(cmdtext, "/auswahl", true) == 0) {
    ShowMenuForPlayer(haupt,playerid);
    return 1;
    }


    return 0;
    }