/flock geht nicht

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
  • hay
    ich habe ein problem der befehl flock geht nicht könnt ihr mir vllt helfen?
    wenn ich den befehl ein gebe passiert nichts nicht mal eine fehler meldung



    #if defined FACTION_CARS_LOCKABLE
    if(strcmp(cmdtext,"/flock",true)==0){
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
    for(new fc;fc<sizeof(FactionCars);fc++){
    if(FactionCars[fc][fVehid] >= 400 && FactionCars[fc][fVehid] <= 611){
    if(GetPlayerVehicleID(playerid) == FactionCars[fc][fCarid]){
    for(new f;f<5;f++){
    if(GetPlayerAdmin(playerid) >= NEEDED_ADMINLEVEL || GetPlayerFaction(playerid) == FactionCars[fc][fFaction][f]){
    PlayerPlaySound(playerid,1145,0.0,0.0,0.0);
    if(FactionCars[fc][fLock] == true){
    FactionCars[fc][fLock] = false;
    fUnlockCar(FactionCars[fc][fCarid]);
    GameTextForPlayer(playerid,"~w~Fahrzeug~n~~g~Aufgeschlossen",5000,3);
    }
    else if(FactionCars[fc][fLock] == false){
    fLockCar(FactionCars[fc][fCarid]);
    FactionCars[fc][fLock] = true;
    GameTextForPlayer(playerid,"~w~Fahrzeug~n~~r~Abgeschlossen",5000,3);
    }break;
    }
    }return true;
    }
    }
    }SendClientMessage(playerid,FACTION_COL_GREY,"Du sitzt in keinem Fraktionsfahrzeug!");
    }else{
    if(GetPlayerState(playerid)==PLAYER_STATE_PASSENGER)
    SendClientMessage(playerid,FACTION_COL_GREY,"Du musst der Fahrer dieses Fahrzeuges sein.");
    else
    SendClientMessage(playerid,FACTION_COL_GREY,"Du muss in einem Fahrzeug sitzen.");
    }return true;
    }
    #endif
    return 1;
    }
    dcmd_efa(playerid,params[]){
    if(GetPlayerAdmin(playerid) >= NEEDED_ADMINLEVEL){
    new vehid,col1,col2,faction[5];
    if(!sscanf(params,"dddd",vehid,col1,col2,faction[0])){
    sscanf(params,"dddddddd",vehid,col1,col2,faction[0],faction[1],faction[2],faction[3],faction[4]);
    if(vehid < 400 || vehid > 611) return SendClientMessage(playerid,FACTION_COL_GREY,"Vehicle-ID nur von 400 bis 611.");
    if(col1 < 0 || col1 > 255) return SendClientMessage(playerid,FACTION_COL_GREY,"Falsche Farbe(1)!");
    if(col2 < 0 || col2 > 255) return SendClientMessage(playerid,FACTION_COL_GREY,"Falsche Farbe(2)!");
    if(faction[0] && faction[0] <= MAX_FACTIONS){
    for(new f;f<5;f++){
    if(faction[f] <= 0 || faction[f] > MAX_FACTIONS){
    faction[f] = -255;
    }
    }
    for(new fc;fc<sizeof(FactionCars);fc++){
    if(FactionCars[fc][fVehid] < 400 || FactionCars[fc][fVehid] > 611){
    FactionCars[fc][fVehid] = vehid;
    new Float:fX,Float:fY,Float:fZ,Float:fA;
    GetPlayerPos(playerid,fX,fY,fZ),GetPlayerFacingAngle(playerid,fA);
    FactionCars[fc][fPos][0] = fX;
    FactionCars[fc][fPos][1] = fY;
    FactionCars[fc][fPos][2] = fZ;
    FactionCars[fc][fPos][3] = fA;
    FactionCars[fc][fCol][0] = col1;
    FactionCars[fc][fCol][1] = col2;
    for(new f;f<5;f++){
    FactionCars[fc][fFaction][f] = faction[f];
    }
    FactionCars[fc][fPrice] = 0;
    for(new mod;mod<14;mod++)
    FactionCars[fc][fTuning][mod] = 0;
    FactionCars[fc][fCarid] = CreateVehicle(FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],-255);
    #if defined FACTION_CARS_LOCKABLE
    FactionCars[fc][fLock] = true;
    #endif
    SendClientMessage(playerid,FACTION_COL_YELLOW,"Du hast das Fraktionsfahrzeug erfolgreich erstellt.");
    SendClientMessage(playerid,FACTION_COL_YELLOW,"Vergesse es nicht mit '/fpark' umzuparken.");
    PutPlayerInVehicle(playerid,FactionCars[fc][fCarid],0);
    return true;
    }
    }SendClientMessage(playerid,FACTION_COL_GREY,"Die Maximale Anzahl von Fraktionsfahrzeugen wurde bereits erreicht.");
    }else SendClientMessage(playerid,FACTION_COL_GREY,"Falsche Fraktion!");
    }else SendClientMessage(playerid,FACTION_COL_GREY,"Benutze: '/efa [Model] [Farbe(1)] [Farbe(2)] [Hauptfraktion]'.");
    }else SendClientMessage(playerid,FACTION_COL_GREY,"Du bist nicht berechtigt diesen Befehl anzuwenden.");
    return true;
    }

    Einmal editiert, zuletzt von BigBozZxX ()

  • ja wenn du das meins ja habe ich aber geht immer nocht nicht guck enum fCar{
    fCarid,
    fVehid,
    Float:fPos[4],
    fCol[2],
    fFaction[5],
    fTuning[14],
    fPrice,
    #if defined FACTION_CARS_LOCKABLE
    bool:fLock
    #endif
    };
    new FactionCars[MAX_FACTION_CARS][fCar];
    #if defined FACTION_CARS_LOCKABLE
    new FactionCarsTimer;
    #endif


    und das


    #if defined FACTION_CARS_LOCKABLE
    public LockFactionCarDoors(){
    ForAllPlayers(i){
    for(new fc;fc<sizeof(FactionCars);fc++){
    if(FactionCars[fc][fVehid] >= 400 && FactionCars[fc][fVehid] <= 611){
    if(FactionCars[fc][fLock] == true){
    if(GetPlayerFaction(i)==FactionCars[fc][fFaction][0]||GetPlayerFaction(i)==FactionCars[fc][fFaction][1]||GetPlayerFaction(i)==FactionCars[fc][fFaction][2]||GetPlayerFaction(i)==FactionCars[fc][fFaction][3]||GetPlayerFaction(i)==FactionCars[fc][fFaction][4]||GetPlayerAdmin(i) >= NEEDED_ADMINLEVEL)
    SetVehicleParamsForPlayer(FactionCars[fc][fCarid],i,false,false);
    else
    SetVehicleParamsForPlayer(FactionCars[fc][fCarid],i,false,true);
    }
    }
    }
    }return true;
    }
    stock fLockCar(vehicleid){
    ForAllPlayers(i)
    SetVehicleParamsForPlayer(vehicleid,i,false,true);
    return true;
    }
    stock fUnlockCar(vehicleid){
    ForAllPlayers(i)
    SetVehicleParamsForPlayer(vehicleid,i,false,false);
    return true;
    }
    #endif

  • forward FRAC_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
    public FRAC_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
    if(dialogid == DIALOG_FACTION_CAR_BUY){
    if(response){
    new Float:pPos[3];
    GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
    SetPlayerPos(playerid,pPos[0]+2.5,pPos[1]+2.5,pPos[2]);
    TogglePlayerControllable(playerid,true);
    }
    if(!response){
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
    if(IsAllowedFactionToBuy(GetPlayerLeader(playerid))){
    if(GetFactioncarsOfFaction(GetPlayerLeader(playerid)) < MAX_BUY){
    new Carid1 = GetPlayerVehicleID(playerid);
    for(new fbl;fbl<sizeof(FactionBuylist);fbl++){
    if(Carid1 == FactionBuylist[fbl][fbCarid]){
    if(CallRemoteFunction("Script_GetPlayerMoney","i",playerid) >= FactionBuylist[fbl][fbPrice]){
    for(new fc;fc<sizeof(FactionCars);fc++){
    if(FactionCars[fc][fVehid] < 400 || FactionCars[fc][fVehid] > 611){
    FactionCars[fc][fVehid] = FactionBuylist[fbl][fbVehid];
    FactionCars[fc][fPos][0] = FactionBuySpawn[0];
    FactionCars[fc][fPos][1] = FactionBuySpawn[1];
    FactionCars[fc][fPos][2] = FactionBuySpawn[2];
    FactionCars[fc][fPos][3] = FactionBuySpawn[3];
    new Color[2];
    GetDefaultCarColorOfFaction(GetPlayerLeader(playerid),Color[0],Color[1]);
    FactionCars[fc][fCol][0] = Color[0];
    FactionCars[fc][fCol][1] = Color[1];


    FactionCars[fc][fPrice] = FactionBuylist[fbl][fbPrice];
    for(new slot;slot<14;slot++)
    FactionCars[fc][fTuning][slot] = 0;
    FactionCars[fc][fCarid] = CreateVehicle(FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],-255);
    print(">>> Nach dem Autoerstellen!");
    fLockCar(FactionCars[fc][fCarid]);
    FactionCars[fc][fLocked] = true; //hier :( :(
    for(new f;f<5;f++)
    {
    FactionCars[fc][fFaction][f] = -255;
    }
    FactionCars[fc][fFaction][0] = GetPlayerLeader(playerid);
    PutPlayerInVehicle(playerid,FactionCars[fc][fCarid],0);
    CallRemoteFunction("Script_SetPlayerMoney","id",playerid,(CallRemoteFunction("Script_GetPlayerMoney","i",playerid)-FactionBuylist[fbl][fbPrice]));
    new Float:pPos[3];
    GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
    SetPlayerPos(playerid,pPos[0]+2.5,pPos[1]+2.5,pPos[2]);
    TogglePlayerControllable(playerid,true);
    SendClientMessage(playerid,FACTION_COL_YELLOW,"Glückwunsch zum neuen Fahrzeug.");
    SendClientMessage(playerid,FACTION_COL_YELLOW,"Bitte vergesse nicht das Fahrzeug mit: '/fpark' umzuparken.");
    SendClientMessage(playerid,FACTION_COL_YELLOW,"Das Fahrzeug steht am Ausgabepunkt bereit!");
    return 1;
    }
    }SendClientMessage(playerid,FACTION_COL_GREY,"Die maximale Anzahl von Fraktionsfahrzeugen ist bereits erreicht.");
    }else SendClientMessage(playerid,FACTION_COL_GREY,"Du hast nicht genügend Geld bei dir!");
    break;
    }
    }
    }else SendClientMessage(playerid,FACTION_COL_GREY,"Deine Fraktion hat das Limit von Fahrzeugen bereits erreicht.");
    }else SendClientMessage(playerid,FACTION_COL_GREY,"Du bist nicht brechtigt Fraktionsfahrzeuge zu kaufen!");
    new Float:pPos[3];
    GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
    SetPlayerPos(playerid,pPos[0]+2.5,pPos[1]+2.5,pPos[2]);
    TogglePlayerControllable(playerid,true);
    }
    }return 1;
    }return 0;
    }

  • was kann ich gegen die warning machenForAllPlayers.inc(20) : warning 201: redefinition of constant/macro (symbol "OnPlayerConnect")
    ForAllPlayers.inc(21) : warning 201: redefinition of constant/macro (symbol "OnPlayerDisconnect")


    und wie kann ich im script einstellen das zb 50 spieler drauf können

  • hier und wie kann man server slots im script einstellen


    #define ForAllPlayers(%0) for(new index_%0=0,%0=ConnectedPlayerList[0]; index_%0<ConnectedPlayers; index_%0++,%0=ConnectedPlayerList[index_%0])


    new ConnectedPlayers;
    new ConnectedPlayerList[MAX_PLAYERS+1];


    forward FAP_OnPlayerConnect(playerid);
    forward FAP_OnPlayerDisconnect(playerid, reason);


    public OnPlayerConnect(playerid){
    if(!IsPlayerNPC(playerid))
    AddPlayer(playerid);
    return FAP_OnPlayerConnect(playerid);
    }
    public OnPlayerDisconnect(playerid, reason){
    if(!IsPlayerNPC(playerid))
    RemovePlayer(playerid);
    return FAP_OnPlayerDisconnect(playerid, reason);
    }


    #define OnPlayerConnect FAP_OnPlayerConnect
    #define OnPlayerDisconnect FAP_OnPlayerDisconnect


    stock AddPlayer(playerid){
    if(ConnectedPlayers>=MAX_PLAYERS || playerid<0 || playerid>=MAX_PLAYERS) return 0;
    ConnectedPlayerList[ConnectedPlayers++]=playerid;
    return 1;
    }


    stock RemovePlayer(playerid){
    for(new i;i<ConnectedPlayers;i++){
    if(ConnectedPlayerList[i]==playerid){
    ConnectedPlayers--;
    ConnectedPlayerList[i]=ConnectedPlayerList[ConnectedPlayers];
    return 1;
    }
    }return 0;
    }

  • Ok, dann mache folgendes.
    Nimm das
    #include <ForAllPlayers>
    aus deinem Code raus.


    Dann füge unter den Includes das ein:
    #define ForAllPlayers(%0) for(new index_%0=0,%0=ConnectedPlayerList[0]; index_%0<ConnectedPlayers; index_%0++,%0=ConnectedPlayerList[index_%0])


    new ConnectedPlayers;
    new ConnectedPlayerList[MAX_PLAYERS+1];


    Das hier fügst du bei OnPlayerConnect ein:
    if(!IsPlayerNPC(playerid)) AddPlayer(playerid);


    Das bei OnPlayerDisconnect:
    if(!IsPlayerNPC(playerid)) RemovePlayer(playerid);


    Und das hier ganz unten im Gamemode:
    stock AddPlayer(playerid){
    if(ConnectedPlayers>=MAX_PLAYERS || playerid<0 || playerid>=MAX_PLAYERS) return 0;
    ConnectedPlayerList[ConnectedPlayers++]=playerid;
    return 1;
    }


    stock RemovePlayer(playerid){
    for(new i;i<ConnectedPlayers;i++){
    if(ConnectedPlayerList[i]==playerid){
    ConnectedPlayers--;
    ConnectedPlayerList[i]=ConnectedPlayerList[ConnectedPlayers];
    return 1;
    }
    }return 0;
    }



    und wie kann man server slots im script einstellen


    Die Slots des Servers ändern, das was im SA-MP Client angezeigt wird? Das geht nicht, das musst du in der server.cfg machen.