Beiträge von blackybecks

    OK Auf Anfrage Machen wir das eben mal
    Bevor wir bearbeiten sieht es so aus:


    #include <a_samp>
    public OnGameModeInit()
    {
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
    }


    public OnGameModeExit()
    {
    return 1;
    }


    public OnPlayerRequestClass(playerid, classid)
    {
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
    }


    public OnPlayerConnect(playerid)
    {
    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    return 1;
    }


    public OnPlayerSpawn(playerid)
    {
    return 1;
    }


    public OnPlayerDeath(playerid, killerid, reason)
    {
    return 1;
    }


    public OnVehicleSpawn(vehicleid)
    {
    return 1;
    }


    public OnVehicleDeath(vehicleid, killerid)
    {
    return 1;
    }


    public OnPlayerText(playerid, text[])
    {
    return 1;
    }


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


    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    return 1;
    }


    public OnPlayerExitVehicle(playerid, vehicleid)
    {
    return 1;
    }


    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    return 1;
    }


    public OnPlayerEnterCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerLeaveCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerEnterRaceCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerLeaveRaceCheckpoint(playerid)
    {
    return 1;
    }


    public OnRconCommand(cmd[])
    {
    return 1;
    }


    public OnPlayerRequestSpawn(playerid)
    {
    return 1;
    }


    public OnObjectMoved(objectid)
    {
    return 1;
    }


    public OnPlayerObjectMoved(playerid, objectid)
    {
    return 1;
    }


    public OnPlayerPickUpPickup(playerid, pickupid)
    {
    return 1;
    }


    public OnVehicleMod(playerid, vehicleid, componentid)
    {
    return 1;
    }


    public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
    {
    return 1;
    }


    public OnVehicleRespray(playerid, vehicleid, color1, color2)
    {
    return 1;
    }


    public OnPlayerSelectedMenuRow(playerid, row)
    {
    return 1;
    }


    public OnPlayerExitedMenu(playerid)
    {
    return 1;
    }


    public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
    {
    return 1;
    }


    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    return 1;
    }


    public OnRconLoginAttempt(ip[], password[], success)
    {
    return 1;
    }


    public OnPlayerUpdate(playerid)
    {
    return 1;
    }


    public OnPlayerStreamIn(playerid, forplayerid)
    {
    return 1;
    }


    public OnPlayerStreamOut(playerid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamIn(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamOut(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    return 1;
    }


    public OnPlayerClickPlayer(playerid, clickedplayerid, source)
    {
    return 1;
    }


    zuerst ersetzten wir diesen Teil
    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
    return 1;
    }
    return 0;
    }

    durch diesen:


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    new tmp[256];
    new idx;
    new cmd[256];
    cmd = strtok(cmdtext, idx);
    if(!strcmp(cmd ,"/changeplate",true, 14))
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
    SendClientMessage(playerid, 0xaaffaaff, "Benutze: /changeplate [KFZ-Kennzeichen]");
    return 1;
    }
    else
    {


    if(IsPlayerInAnyVehicle(playerid) == 1)
    {
    new carstr[48];
    new vehiclefid = GetPlayerVehicleID(playerid);
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,sizeof(pname));
    format(carstr,sizeof(carstr),"/Cars/%s.ini",tmp);
    new string[9];
    format(string,sizeof(string),"%s",tmp);
    new Float: vX,Float: vY,Float: vZ;
    GetPlayerPos(playerid,vX,vY,vZ);


    if(dini_Exists(carstr))
    {
    SendClientMessage(playerid,0xffaaffaa,"Server {DDFFAA} Dieses Kennzeichen ist schon Registriert ");
    }
    else
    {
    dini_Create(carstr);
    dini_IntSet(carstr,"Vehicleid",GetVehicleModel(vehiclefid));
    dini_FloatSet(carstr,"Posx",vX);
    dini_FloatSet(carstr,"Posy",vY);
    dini_FloatSet(carstr,"Posz",vZ);
    new Float:roat;
    GetPlayerFacingAngle(playerid,roat);
    dini_FloatSet(carstr,"Roatation",roat);
    dini_Set(carstr,"Schild",string);
    SendClientMessage(playerid,0xffaaffaa,"Server {DDAAFF} Dieses Kennzeichen ist nun Registriert ");
    SetVehicleNumberPlate(vehiclefid, string);
    SetVehicleToRespawn(vehiclefid);
    SetVehiclePos(vehiclefid,vX,vY,vZ);
    PutPlayerInVehicle(playerid,vehiclefid,0);
    }
    return 1;
    }
    else
    {
    SendClientMessage(playerid,0xffaaffaa,"Du musst dafür in einem Auto sitzen.");
    }
    }
    return 1;
    }
    return 0;
    }





    und dann gehen wir in die Letzte Zeile:



    public OnPlayerStreamOut(playerid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamIn(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamOut(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    return 1;
    }


    public OnPlayerClickPlayer(playerid, clickedplayerid, source)
    {
    return 1;
    }
    das sind die Letzten zeilen und setzten dahinter einfach so das strtok:


    public OnPlayerStreamOut(playerid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamIn(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamOut(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    return 1;
    }


    public OnPlayerClickPlayer(playerid, clickedplayerid, source)
    {
    return 1;
    }
    strtok(const string[], &index)
    {
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
    index++;
    }


    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
    result[index - offset] = string[index];
    index++;
    }
    result[index - offset] = EOS;
    return result;
    }


    und fertig ist es :D
    Noch fragen :?:


    Gruß Blackybecks

    OK Hab es gefixed ohne bugs und wenn es kaputt geht wird der slot wieder frei!
    Wenn man off geht sind die auch weg
    Keine includes nötig
    so also zuerst
    new Auto1[MAX_PLAYERS];
    new Auto3[MAX_PLAYERS];
    new Auto2[MAX_PLAYERS];
    new Auto11[MAX_PLAYERS];
    new Auto31[MAX_PLAYERS];
    new Auto21[MAX_PLAYERS];
    public OnPlayerConnect(playerid)
    { Auto1[playerid]=999;
    Auto2[playerid]=999;
    Auto3[playerid]=999;
    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    DestroyVehicle(Auto11[playerid]);
    DestroyVehicle(Auto21[playerid]);
    DestroyVehicle(Auto31[playerid]);
    return 1;
    }



    als zweites wenn die autos kaputt gehen


    public OnVehicleDeath(vehicleid, killerid)
    {
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(vehicleid == Auto11[i])
    {
    DestroyVehicle(Auto11[i]);
    Auto1[i]=999;
    SendClientMessage(i,0xddaaffff,"Slot 1 ist nun frei");
    }
    else if(vehicleid == Auto21[i])
    {
    DestroyVehicle(Auto21[i]);
    Auto2[i]=999;
    SendClientMessage(i,0xddaaffff,"Slot 2 ist nun frei");
    }
    else if(vehicleid == Auto31[i])
    {
    DestroyVehicle(Auto31[i]);
    Auto3[i]=999;
    SendClientMessage(i,0xddaaffff,"Slot 3 ist nun frei");
    }
    }
    }
    return 1;
    }


    als drittes die CMD´s:
    und für die befehle das strget stock:


    new slot[MAX_PLAYERS];
    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(strcmp(strget(cmdtext,0),"/v",true)==0)
    {
    new vID = strval(strget(cmdtext,1));
    if( vID <= 611 && vID >= 400)
    {
    new Float:X,Float:Y,Float:Z,Float:Roat;
    new rand1=random(10);
    new rand2=random(10);
    GetPlayerPos(playerid,X,Y,Z);
    GetPlayerFacingAngle(playerid,Roat);
    if(Auto1[playerid]== 999)
    {
    Auto11[playerid]=CreateVehicle(vID,X,Y,Z,Roat,rand1,rand2,-1);
    PutPlayerInVehicle(playerid,Auto11[playerid],0);
    slot[playerid]=1;
    new string[128];
    Auto1[playerid]=1;
    format(string,sizeof(string),"Sie haben ein Auto auf Slot %i gespawnt cl1:%i cl2:%i",slot[playerid],rand1,rand2);
    SendClientMessage(playerid,0xddaaffff,string);
    }
    else if(Auto2[playerid]== 999)
    {
    Auto21[playerid]=CreateVehicle(vID,X,Y,Z,Roat,rand1,rand2,-1);
    PutPlayerInVehicle(playerid,Auto21[playerid],0);
    slot[playerid]=2;
    new string[128];
    Auto2[playerid]=1;
    format(string,sizeof(string),"Sie haben ein Auto auf Slot %i gespawnt cl1:%i cl2:%i",slot[playerid],rand1,rand2);
    SendClientMessage(playerid,0xddaaffff,string);
    }
    else if(Auto3[playerid]== 999)
    {
    Auto31[playerid]=CreateVehicle(vID,X,Y,Z,Roat,rand1,rand2,-1);
    PutPlayerInVehicle(playerid,Auto31[playerid],0);
    Auto3[playerid]=1;
    slot[playerid]=3;
    new string[128];
    format(string,sizeof(string),"Sie haben ein Auto auf Slot %i gespawnt cl1:%i cl2:%i",slot[playerid],rand1,rand2);
    SendClientMessage(playerid,0xddaaffff,string);
    }
    else
    {
    SendClientMessage(playerid,0xffaaffaa,"Sie Haben sich schon 3 Autos gerufe /ruf[1-3]um es zu holen");
    }
    return 1;
    }
    else
    {
    SendClientMessage(playerid,0xffaaffaa,"Sie müssen eine ID zwischen 400 und 611 wählen");
    }
    }
    if(strcmp(strget(cmdtext,0),"/ruf",true)==0)
    {
    new slot1 = strval(strget(cmdtext,1));
    new Float:X,Float:Y,Float:Z,Float:Roat;
    GetPlayerPos(playerid,X,Y,Z);
    GetPlayerFacingAngle(playerid,Roat);
    if(slot1 == 1)
    {
    if(Auto1[playerid] != 999)
    {
    PutPlayerInVehicle(playerid,Auto11[playerid],0);
    SetVehiclePos(Auto11[playerid],X,Y,Z);
    new string[128];
    format(string,sizeof(string),"Sie haben Slot %i gerufen",slot1);
    SendClientMessage(playerid,0xddaaffff,string);
    }
    else
    {
    SendClientMessage(playerid,0xffaaffaa,"Slot nicht besetzt");
    }
    }
    else if(slot1 == 2)
    {
    if(Auto2[playerid] != 999)
    {
    PutPlayerInVehicle(playerid,Auto21[playerid],0);
    SetVehiclePos(Auto21[playerid],X,Y,Z);
    new string[128];
    format(string,sizeof(string),"Sie haben Slot %i gerufen",slot1);
    SendClientMessage(playerid,0xddaaffff,string);
    }
    else
    {
    SendClientMessage(playerid,0xffaaffaa,"Slot nicht besetzt");
    }
    }
    else if(slot1 == 3)
    {
    if(Auto3[playerid] != 999)
    {
    PutPlayerInVehicle(playerid,Auto31[playerid],0);
    SetVehiclePos(Auto31[playerid],X,Y,Z);
    new string[128];
    format(string,sizeof(string),"Sie haben Slot %i gerufen",slot1);
    SendClientMessage(playerid,0xddaaffff,string);
    }
    else
    {
    SendClientMessage(playerid,0xffaaffaa,"Slot nicht besetzt");
    }
    }
    return 1;
    }
    return 0;
    }
    stock strget(strx[], pos, search = ' ') {
    new arg, ret[128], idxx;
    for (new i = 0; i < strlen(strx); i++) {
    if(strx[i] == search || i == strlen(strx) || strx[i + 1] == 10) {
    arg++;
    if (arg == pos + 1){
    ret[i-idxx] = EOS;
    return ret;
    } else if (arg == pos)
    idxx= i+1;
    }
    else if (arg == pos)
    ret[i - idxx] = strx[i];
    }
    return ret;
    }


    Hoffe es geht auch bei dir/euch



    Gruß Blackybecks
    ;D bitte sagen obs geht und obs das ist was du wolltest

    Ich war mal so nett und habs versucht muss es jetzt aber noch testen
    new Auto1[MAX_PLAYERS];
    new Auto3[MAX_PLAYERS];
    new Auto2[MAX_PLAYERS];
    new slot[MAX_PLAYERS];
    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(strcmp(strget(cmdtext,0),"/v",true)==0)
    {
    new vID = strval(strget(cmdtext,1));
    new Float:X,Float:Y,Float:Z,Float:Roat;
    new rand1=random(10);
    new rand2=random(10);
    GetPlayerPos(playerid,X,Y,Z);
    GetPlayerFacingAngle(playerid,Roat);
    if(Auto1[playerid] == 999 ||Auto2[playerid] == 999 ||Auto3[playerid] == 999)
    {
    PutPlayerInVehicle(playerid,CreateVehicle(vID,X,Y,Z,Roat,rand1,rand2,-1),1);
    if(Auto1[playerid]== 999)
    {
    Auto1[playerid]=GetPlayerVehicleID(playerid);
    slot[playerid]=1;
    }
    else if(Auto2[playerid]== 999)
    {
    Auto2[playerid]=GetPlayerVehicleID(playerid);
    slot[playerid]=2;
    }
    else if(Auto3[playerid]== 999)
    {
    Auto3[playerid]=GetPlayerVehicleID(playerid);
    slot[playerid]=3;
    }
    new string[128];
    format(string,sizeof(string),"Sie haben ein Auto auf Slot %i gespawnt cl1:%i cl2:%i",slot[playerid],rand1,rand2);
    SendClientMessage(playerid,0xddaaffff,string);
    }
    else
    {
    SendClientMessage(playerid,0xffaaffaa,"Sie Haben sich schon 3 Autos gerufe /ruf[1-3]um es zu holen");
    }
    }
    if(strcmp(strget(cmdtext,0),"/ruf",true)==0)
    {
    new slot1 = strval(strget(cmdtext,1));
    new Float:X,Float:Y,Float:Z,Float:Roat;
    GetPlayerPos(playerid,X,Y,Z);
    GetPlayerFacingAngle(playerid,Roat);
    if(slot1 == 1)
    {
    SetVehiclePos(Auto1[playerid],X,Y,Z);
    }
    else if(slot1 == 2)
    {
    SetVehiclePos(Auto2[playerid],X,Y,Z);
    }
    else if(slot1 == 3)
    {
    SetVehiclePos(Auto3[playerid],X,Y,Z);
    }
    new string[128];
    format(string,sizeof(string),"Sie haben Slot %i gerufen",slot1);
    SendClientMessage(playerid,0xddaaffff,string);
    }
    return 0;
    }
    stock strget(strx[], pos, search = ' ') {
    new arg, ret[128], idxx;
    for (new i = 0; i < strlen(strx); i++) {
    if(strx[i] == search || i == strlen(strx) || strx[i + 1] == 10) {
    arg++;
    if (arg == pos + 1){
    ret[i-idxx] = EOS;
    return ret;
    } else if (arg == pos)
    idxx= i+1;
    }
    else if (arg == pos)
    ret[i - idxx] = strx[i];
    }
    return ret;
    }

    AddStaticVehicleEx(517,2019.8801,-1128.5785,24.8026,91.3704,22,22,-1);//
    musste dann hier aus der -1 ganz hinten die zeit in sekunden reinschreiben.
    wenn man aussteigt zählt dieser timer ab und wennman davor nicht wieder einsteigt und er wieder gekillt wird respawnt es wenn ich das richtig weiss
    also musste bei dennen die du respawnen willst die zeit ändern -1 steht für niemals respawn 0
    für wenn man austeigt und eben 1,2,3... für 1sekunde,2sekunden,3sekunden...

    if (strcmp("/heal", cmdtext, true, 10) == 0)
    {
    new Float:heal[MAX_PLAYERS];
    GetPlayerHealth(playerid,heal[playerid]);
    if(heal[playerid]>= 75)
    {
    new Float:newheal= heal[playerid]+30;
    SetPlayerHealth(playerid,newheal);
    }
    else
    {
    SendClientMessage(playerid,0xffaaffaa,"Sie können nur bei über 75 hp beim Burger-Shot essen!");
    }
    return 1;
    }


    So ist die einfache Form muss man eben noch ausbauen aber im Prinzip :D