[SAMMELTHREAD] Kleine Scripting Fragen

Dein Problem konnte durch einen User gelöst werden? Bedank dich bei ihm indem du seinen Beitrag als Hilfreich markierst sowie einen Daumen oben dalässt
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
  • Ich habe ein Problem bei meinem Supmobil system
    Ich erstelle mein Fahrzeug mit Leute aber wenn ich es Lösche bleibt die Leuchte manchmal da aber wieso ?


    new supmobil[MAX_PLAYERS];
    new supsirene[MAX_VEHICLES];


    ocmd:supmobil(playerid)
    {
    if(!isSupp(playerid,1) && !isAdmin(playerid,1)) return SendClientMessage(playerid,ROT,"Du bist dazu nicht befugt!");
    if(Adminduty[playerid] == false) return SendClientMessage(playerid,ROT,"Du bist nicht Aduty!");
    if(supmobil[playerid])
    {
    DestroyObject(supsirene[GetPlayerVehicleID(playerid)]);
    DestroyVehicle(supmobil[playerid]);
    supmobil[playerid]=0;
    SendClientMessage(playerid,ROT,"Dein Supmobil wurde erfolgreich gelöscht");
    printf("%s hat sein Supmobil Zerstört!)",getPlayerName(playerid));
    return 1;
    }
    if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid,ROT,"Du musst zu Fuß unterwegs sein!");
    return ShowPlayerDialog(playerid,DIALOG_SUPMOBIL,DIALOG_STYLE_LIST,"Supmobil","Sultan\nCheetah\nSandking","Wählen","Abbruch");
    }


    if(dialogid==DIALOG_SUPMOBIL)
    {
    if(!response)return 1;
    new Float:p[4];
    GetPlayerPos(playerid,p[0],p[1],p[2]),GetPlayerFacingAngle(playerid,p[3]);
    switch(listitem)
    {
    case 0:
    {
    supmobil[playerid] = CreateVehicle(560,p[0],p[1],p[2],p[3],79,79,-1);
    SetVehicleNumberPlate(supmobil[playerid],"Supmobil");
    tank[supmobil[playerid]] = 100;
    /*supsirene[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(supsirene[GetPlayerVehicleID(playerid)],supmobil[playerid],-0.54, 0.1, 0.88, 0.0, 0.0, 0.0);*/
    supsirene[GetPlayerVehicleID(playerid)] = CreateObject(19620,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(supsirene[GetPlayerVehicleID(playerid)],supmobil[playerid],-0.54, 0.1, 0.88, 0.0, 0.0, 0.0);
    PutPlayerInVehicle(playerid,supmobil[playerid],0);
    printf("%s %s hat sich den Sultan als Supmobil gespawnt!)",arang(playerid),getPlayerName(playerid));
    }
    case 1:
    {
    supmobil[playerid] = CreateVehicle(415,p[0],p[1],p[2],p[3],79,79,-1);
    SetVehicleNumberPlate(supmobil[playerid],"Supmobil");
    tank[supmobil[playerid]] = 100;
    supsirene[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(supsirene[GetPlayerVehicleID(playerid)],supmobil[playerid],-0.45, -0.2, 0.66, 0.0, 0.0, 0.0);
    PutPlayerInVehicle(playerid,supmobil[playerid],0);
    printf("%s %s hat sich den Cheetah als Supmobil gespawnt!)",arang(playerid),getPlayerName(playerid));
    }
    case 2:
    {
    supmobil[playerid] = CreateVehicle(495,p[0],p[1],p[2],p[3],79,79,-1);
    SetVehicleNumberPlate(supmobil[playerid],"Supmobil");
    tank[supmobil[playerid]] = 100;
    supsirene[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(supsirene[GetPlayerVehicleID(playerid)],supmobil[playerid],-0.5, -0.2, 1.04, 0.0, 0.0, 0.0);
    PutPlayerInVehicle(playerid,supmobil[playerid],0);
    printf("%s %s hat sich den Sandking als Supmobil gespawnt!)",arang(playerid),getPlayerName(playerid));
    }
    }
    }

  • Hast du es bei allen anderen auch geändert?
    Wenn nicht:
    if(dialogid==DIALOG_SUPMOBIL)
    {
    if(!response)return 1;
    new Float:p[4];
    GetPlayerPos(playerid,p[0],p[1],p[2]),GetPlayerFacingAngle(playerid,p[3]);
    switch(listitem)
    {
    case 0:
    {
    supmobil[playerid] = CreateVehicle(560,p[0],p[1],p[2],p[3],79,79,-1);
    SetVehicleNumberPlate(supmobil[playerid],"Supmobil");
    tank[supmobil[playerid]] = 100;
    /*supsirene[supmobil[playerid]] = CreateObject(18646,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(supsirene[supmobil[playerid]],supmobil[playerid],-0.54, 0.1, 0.88, 0.0, 0.0, 0.0);*/
    supsirene[supmobil[playerid]] = CreateObject(19620,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(supsirene[supmobil[playerid]],supmobil[playerid],-0.54, 0.1, 0.88, 0.0, 0.0, 0.0);
    PutPlayerInVehicle(playerid,supmobil[playerid],0);
    printf("%s %s hat sich den Sultan als Supmobil gespawnt!)",arang(playerid),getPlayerName(playerid));
    }
    case 1:
    {
    supmobil[playerid] = CreateVehicle(415,p[0],p[1],p[2],p[3],79,79,-1);
    SetVehicleNumberPlate(supmobil[playerid],"Supmobil");
    tank[supmobil[playerid]] = 100;
    supsirene[supmobil[playerid]] = CreateObject(18646,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(supsirene[supmobil[playerid]],supmobil[playerid],-0.45, -0.2, 0.66, 0.0, 0.0, 0.0);
    PutPlayerInVehicle(playerid,supmobil[playerid],0);
    printf("%s %s hat sich den Cheetah als Supmobil gespawnt!)",arang(playerid),getPlayerName(playerid));
    }
    case 2:
    {
    supmobil[playerid] = CreateVehicle(495,p[0],p[1],p[2],p[3],79,79,-1);
    SetVehicleNumberPlate(supmobil[playerid],"Supmobil");
    tank[supmobil[playerid]] = 100;
    supsirene[supmobil[playerid]] = CreateObject(18646,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(supsirene[supmobil[playerid]],supmobil[playerid],-0.5, -0.2, 1.04, 0.0, 0.0, 0.0);
    PutPlayerInVehicle(playerid,supmobil[playerid],0);
    printf("%s %s hat sich den Sandking als Supmobil gespawnt!)",arang(playerid),getPlayerName(playerid));
    }
    }
    }


    Vor allem, weil du den Spieler erst danach in das Fahrzeug setzt.

  • Mein Startwar Befehl buggt rum. Bzw manchmal steht da "unknwon command" dann wenn ich etwas mit // deaktiviere dann steht manchmal "Du bist in keinem Gebiet" ect.. kann einer sagen wo mein Fehler liegt ?


    Jeffry und Co :D


    COMMAND:startwar(playerid,params[])
    {
    #pragma unused params
    new string[128],GegnerOnline = 0,TempZone = GetPlayerFightzone(playerid);
    if(ImTutorial[playerid] != 0)return SendClientMessage(playerid,GRAU,"Du kannst keine Befehle nutzen,da du im Tutorial bist.");
    if(GetPVarInt(playerid,"Eingeloggt") == 0)return SendClientMessage(playerid,GRAU,"Du bist nicht eingeloggt!");
    if(Spieler[playerid][pAWAYFROMKEYBOARD] == 1)return SendClientMessage(playerid,WRONGCMD,"Du bist im AFK-Modus und kannst somit keine Befehle nutzen."),SendClientMessage(playerid,WRONGCMD,"BENUTZE: /back");
    if(Spieler[playerid][pInPrison] == 1)return SendClientMessage(playerid,GRAU,"Du bist im Prison.");
    if(Spieler[playerid][pFriedhof] == 1)return SendClientMessage(playerid,GRAU,"Du bist Tot.");
    if(Spieler[playerid][pDeath] == 1)return SendClientMessage(playerid,GRAU,"Du bist verletzt.");
    if(Spieler[playerid][pJailed] != 0)return SendClientMessage(playerid,GRAU,"Du bist im Gefängnis.");
    if(Spieler[playerid][pTazerd] == 1)return SendClientMessage(playerid,GRAU,"Du bist K.O/getazert.");
    if(Spieler[playerid][pCuffed] == 1)return SendClientMessage(playerid,GRAU,"Du bist gefesselt.");
    if(isPlayerInFrakt(playerid,4) || isPlayerInFrakt(playerid,5) || isPlayerInFrakt(playerid,7) || isPlayerInFrakt(playerid,9) || isPlayerInFrakt(playerid,12) || isPlayerInFrakt(playerid,13) || isPlayerInFrakt(playerid,17) || isPlayerInFrakt(playerid,18))
    {
    gettime(stunde,minute,sekunde);
    if(stunde<13||stunde>23)return SendClientMessage(playerid,GRAU,"Man kann ein Gangwar erst zwischen 13 - und 24 Uhr starten.");
    if(!isPlayerAMember(playerid,6))return SendClientMessage(playerid,GRAU,"Du besitzt nicht den jeweiligen Rang.");
    if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,GRAU,"Du bist in einem Fahrzeug!");
    if(IsAFightFaction(GetPlayerFaction(playerid)))
    {
    for(new fs;fs<sizeof(GangwarZones);fs++)
    {
    if((GangwarZones[fs][GW_OwnerFaction] == GetPlayerFaction(playerid) && GangwarZones[fs][GW_FightTime]) || GangwarZones[fs][GW_AttackFaction] == GetPlayerFaction(playerid))
    return SendClientMessage(playerid,GRAU,"Deine Gang / Mafia ist bereits in einem Fight.");
    }
    ForEachPlayer(i)
    {
    if(IsPlayerConnected(i))
    {
    if(isPlayerInFrakt(i,GangwarZones[TempZone][GW_OwnerFaction]))
    {
    GegnerOnline++;
    }
    }
    }
    if(GegnerOnline < 3)return SendClientMessage(playerid,GRAU,"Nicht genug Gegner Online. (mindestens 3 Gegner!)");
    if(TempZone != -255)
    {
    if(GangwarZones[TempZone][GW_FightTimeCool] != 0)
    {
    format(string, sizeof(string), "Das Gebiet kann erst wieder in ca. %d Minuten erobert werden.", GangwarZones[TempZone][GW_FightTimeCool]);
    return SendClientMessage(playerid, GRAU,string);
    }
    if(!IsAFightFaction(GangwarZones[TempZone][GW_OwnerFaction]))
    return SendClientMessage(playerid,GRAU,"Gebiet wurde ausgeschaltet.");
    if(GangwarZones[TempZone][GW_OwnerFaction] == GetPlayerFaction(playerid))
    return SendClientMessage(playerid,GRAU,"Man greift nicht seine eigenen Leute an.");
    if(GangwarZones[TempZone][GW_FightTime] || GangwarZones[TempZone][GW_AttackFaction] != -255)
    return SendClientMessage(playerid,GRAU,"In diesem Gebiet wird bereits geschossen.");
    if(GangwarZones[TempZone][GW_LastFight])
    {
    new fsText[178];
    format(fsText,sizeof(fsText),"Ganggebiet: Dieses Ganggebiet wurde bereits Angegriffen, wartet noch: '%d' Minuten.",GangwarZones[TempZone][GW_LastFight]);
    SendClientMessage(playerid,GRAU,fsText);
    return 1;
    }
    for(new fs;fs<sizeof(GangwarZones);fs++)
    {
    if(GangwarZones[fs][GW_OwnerFaction] == GangwarZones[TempZone][GW_OwnerFaction] && (GangwarZones[fs][GW_FightTime] || GangwarZones[fs][GW_AttackFaction] != -255))
    return SendClientMessage(playerid,GRAU,"Ganggebiet: Die gegnerische Fraktion hat bereits einen Kampf.");
    }
    new fsTextToOwner[255];
    format(fsTextToOwner,sizeof(fsTextToOwner),"Ihr werdet von der Fraktion %s angegriffen! GebietInfo: %s",GetFactionNameOfFaction(GetPlayerFaction(playerid)),GangwarZones[TempZone][GW_Zone_Name]);
    new fsName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,fsName,MAX_PLAYER_NAME);
    new fsTextToAttack[255];
    format(fsTextToAttack,sizeof(fsTextToAttack),"Gangfight: %s hat einen Kampf gegen die Fraktion %s gestartet.",GetFactionNameOfFaction(GetPlayerFaction(playerid)),GetFactionNameOfFaction(GangwarZones[TempZone][GW_OwnerFaction]));
    new fsText[64];
    format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(GangwarZones[TempZone][GW_OwnerFaction]));
    TextDrawSetString(GangwarZones[TempZone][GW_WinFaction],fsText);
    TextDrawSetString(GangwarZones[TempZone][GW_WinKills],"~y~0 Kills");
    format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(GetPlayerFaction(playerid)));
    TextDrawSetString(GangwarZones[TempZone][GW_LoseFaction],fsText);
    TextDrawSetString(GangwarZones[TempZone][GW_LoseKills],"~y~0 Kills");
    TextDrawSetString(GangwarZones[TempZone][GW_Time],"Verbl. Zeit: 60 Minuten");//ZEIT
    for(new i;i<MAX_PLAYERS;i++)
    {
    if(IsPlayerConnected(i))
    {
    GangZoneFlashForPlayer(i,GangwarZones[TempZone][GW_ZoneID],GetZoneColorOfFaction(GetPlayerFaction(playerid)));
    if(GetPlayerFaction(i) == GangwarZones[TempZone][GW_OwnerFaction])
    {
    PlayerPlaySound(i,1058,0.0,0.0,0.0);
    SendClientMessage(i,ROT,fsTextToOwner);
    TextDrawShowForPlayer(i,Fight);
    TextDrawShowForPlayer(i,FightUnderline);
    TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinFaction]);
    TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinKills]);
    TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseFaction]);
    TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseKills]);
    TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_Time]);
    }
    if(GetPlayerFaction(i) == GetPlayerFaction(playerid))
    {
    PlayerPlaySound(i,1058,0.0,0.0,0.0);
    SendClientMessageToAll(GW_COLOR_ORANGE,fsTextToAttack);
    TextDrawShowForPlayer(i,Fight);
    TextDrawShowForPlayer(i,FightUnderline);
    TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinFaction]);
    TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinKills]);
    TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseFaction]);
    TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseKills]);
    TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_Time]);
    }
    }
    }
    GangwarZones[TempZone][GW_AttackFaction] = GetPlayerFaction(playerid);
    GangwarZones[TempZone][GW_KillsOfOwner] = 0;
    GangwarZones[TempZone][GW_KillsOfAttack] = 0;
    GangwarZones[TempZone][GW_FightTime] = FIGHT_TIME;
    GangwarZones[TempZone][GW_CtfOfOwner][0] = -255;
    GangwarZones[TempZone][GW_CtfOfOwner][1] = 0;
    GangwarZones[TempZone][GW_CtfOfAttack][0] = -255;
    GangwarZones[TempZone][GW_CtfOfAttack][1] = 0;
    GangwarZones[TempZone][GW_Started] = 1;
    return 1;
    }return SendClientMessage(playerid,GRAU,"Du bist in keinem Gebiet!");
    }else SendClientMessage(playerid,GRAU,"Du bist in keiner Gang / Mafia."); return 1;
    }return SendClientMessage(playerid,GRAU,"Du bist nicht in der jeweiligen Fraktion.");
    }

    Einmal editiert, zuletzt von tayson87 ()

  • Eröffne doch dafür ein Topic, das ist keine kleine Frage mehr..


    Kann mir jemand sagen ob man in SAMP das Wetter ändern lassen kann wenn man ein bestimmtes Gebiet betretet?
    Habe vor verschiedene Wetter in den Städten LS, SF & LV zu haben.


    Mit freundlichen Grüßen
    JustMe.77 8)

  • Eröffne doch dafür ein Topic, das ist keine kleine Frage mehr..


    Kann mir jemand sagen ob man in SAMP das Wetter ändern lassen kann wenn man ein bestimmtes Gebiet betretet?
    Habe vor verschiedene Wetter in den Städten LS, SF & LV zu haben.


    hier ist ein COde für LS/SF/LV


    if((xx > -992.5172 && xx < 4000.0000) && (yy < 528.0000 && yy > -4000.0000)) SetPlayerWeather(i, Weather[0]), printf("Setze Wetter für %d zu %d in LS", i, Weather[0]);//LS
    if((xx > -4000.0000 && xx< -992.5172) && (yy < 4000.0000 && yy > -4000.0000)) SetPlayerWeather(i, Weather[1]), printf("Setze Wetter für %d zu %d in SF", i, Weather[1]);//SF
    if((xx > -992.5172 && xx< 4000.0000) && (yy < 4000.0000 && yy > 528.0000)) SetPlayerWeather(i, Weather[2]), printf("Setze Wetter für %d zu %d in LV", i, Weather[2]);//LV

  • tayson87:
    Das sieht mir stark danach aus, dass du ein Array sprengst.
    Lade dir das Crashdetect Plugin herunter und füge es in deinen Server ein: http://forum.sa-mp.com/showthread.php?t=262796
    Dann erstelle in dem /pawno/ Ordner neben der pawno.exe eine "pawn.cfg" Datei und schreibe dort "-d3" rein (ohne die Anführungszeichen). Anschließend öffne die pawno.exe und wähle deinen Code aus, dann kompiliere ihn neu. Wenn du dann den Server neu startest und den Befehl eingibst und Unknown Command kommt, dann bekommst du im Server Log die Fehlermeldung plus die Zeile in der der Fehler ist ausgegeben.
    Poste das dann gegebenenfalls in einem neuen Thread, sofern du mit der Meldung nicht klar kommst.

  • Ich hab da mal ne kleine frage....
    SQLite.pwn(6) : error 001: expected token: "-identifier-", but found "("


    aber ich habe in der zeile garkein "("

    new Bit1: g_PlayerLogged <MAX_PLAYERS>, // Erstellt ein 1 bit array Bit16: g_AdminLevel <MAX_PLAYERS>, // Erstellt ein 16 bit array nochmal. DB: Database;


    PS: Der pawn bb code ist echt blöd der haut das immer in eine Zeile rein X(


    Pastebin Hier ist es wenigstens alles richtig eingerückt

  • Warum funktionieren meine Health Textdraws nicht? 0 Errors, Ingame wird nur der Health Textdraw angezeigt aber auch ohne funktion sprich das bleibt bei 100 HP auch wenn ich 50 HP habe.


    Habe das jetzt selber erstellt als beim letzen mal..


    Spoiler anzeigen

    #include <a_samp>

    Spoiler anzeigen
    new Text:Health[MAX_PLAYERS];
    new Text:Armour[MAX_PLAYERS];

    Spoiler anzeigen
    public OnFilterScriptInit()
    {

    Spoiler anzeigen
    SetTimer("vitals",1000,1);

    Spoiler anzeigen
    public OnPlayerConnect(playerid)
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {

    Health[i] = TextDrawCreate(569.0, 44.0, "100");
    TextDrawBackgroundColor(Health[i], 255);
    TextDrawFont(Health[i],2);
    TextDrawLetterSize(Health[i], 0.220000, 0.899999);
    TextDrawColor(Health[i], -65281);
    TextDrawSetOutline(Health[i], 0);
    TextDrawSetProportional(Health[i], 1);
    TextDrawSetShadow(Health[i], 1);
    TextDrawSetSelectable(Health[i], 0);

    Spoiler anzeigen
    Armour[i] = TextDrawCreate(569.0, 66.0, "100");
    TextDrawBackgroundColor(Armour[i], 255);
    TextDrawFont(Armour[i], 2);
    TextDrawLetterSize(Armour[i], 0.220000, 0.899999);
    TextDrawColor(Armour[i], -65281);
    TextDrawSetOutline(Armour[i], 0);
    TextDrawSetProportional(Armour[i], 1);
    TextDrawSetShadow(Armour[i], 1);
    TextDrawSetSelectable(Armour[i], 0);
    }
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerDisconnect(playerid)
    {
    return 1;
    }

    Spoiler anzeigen
    public OnPlayerUpdate(playerid)
    {
    new Float:pArmour;
    GetPlayerArmour(playerid, pArmour);
    if(pArmour == 0){
    TextDrawHideForPlayer(playerid, Armour[playerid]);
    }else{
    TextDrawShowForPlayer(playerid, Armour[playerid]);
    }
    return 1;
    }


    Mit freundlichen Grüßen
    JustMe.77 8)

  • Ich hatte dir den Code doch gegeben, mit den PlayerTextDraws. Wenn du es mit normalen Textdraws machst, und diese auch noch bei OnPlayerConnect MAX_PLAYERS mal erstellst, dann sprengst du das Limit.
    Mache es mit den PlayerTextDraws, wie ich es dir gegeben habe (Textdraw Design musst du da eventuell anpassen, das habe ich nur von dir übernommen).


    http://forum.sa-mp.de/gta-mult…ng-fragen-858#post2073622