NPC | Skin setzen

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 Tag,


    Mein Name lautet CIBERKILLER.
    Und zwar Funktioniert das setzen der Skins bei Bots nicht ganz.



    //Beim spawnen
    if(IsPlayerNPC(playerid)){
    if(!strcmp(getName(playerid), "Joe", true)){
    SetPlayerSkin(playerid, 33);
    ApplyAnimation(playerid, "SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0, 0);
    }
    return 1;
    }


    mfg :thumbup:

  • Hast du das auch so?
    public OnPlayerSpawn(playerid)
    {
    if(IsPlayerNPC(playerid))
    {
    if(!strcmp(getName(playerid),"Joe",true))
    {
    ApplyAnimation(playerid,"SMOKING","M_smklean_loop",4,1,0,0,0,0,0);
    SetPlayerSkin(playerid,33);
    }
    }
    //Rest
    return 1;
    }



  • public OnPlayerSpawn(playerid)
    {
    if(IsPlayerNPC(playerid)){
    if(!strcmp(getName(playerid), "Joe", true)){
    SetPlayerSkin(playerid, 33);
    ApplyAnimation(playerid, "SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0, 0);
    }
    return 1;
    }
    return 1;
    }


    mfg :thumbup:

  • public OnPlayerSpawn(playerid)
    {
    if(IsPlayerNPC(playerid))
    {
    if(!strcmp(getName(playerid),"Joe",true))
    {
    ApplyAnimation(playerid,"SMOKING","M_smklean_loop",4,1,0,0,0,0,0);
    SetTimerEx("NPC_Skin_Timer",350,0,"dd",playerid,33);
    }
    }
    //Rest
    return 1;
    }


    forward NPC_Skin_Timer(playerid);
    public NPC_Skin_Timer(playerid,skin_id)
    {
    SetPlayerSkin(playerid,skin_id);
    return 1;
    }

  • public OnPlayerSpawn(playerid)
    {
    if(IsPlayerNPC(playerid))
    {
    if(!strcmp(getName(playerid),"Joe",true))
    {
    ApplyAnimation(playerid,"SMOKING","M_smklean_loop",4,1,0,0,0,0,0);
    SetSpawnInfo(playerid,282,33,1542.2845, -1594.9248, 13.0540, -90.6000, 0, 0, 0, 0, 0, 0 );
    }
    }
    //Rest
    return 1;
    }


    Versuch das mal. DIe Koordinaten sind in dem Fall egal, da er sich die eh aus der .rec Datei nimmt.

  • Funktioniert immer noch nicht!


    if(IsPlayerNPC(playerid)){
    if(!strcmp(getName(playerid), "Joe", true)){
    RepairAnims(playerid);
    SetPlayerSkin(playerid, 33);
    SetSpawnInfo(playerid, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),SpawnPlayer(playerid);
    ApplyAnimation(playerid, "SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0, 0);
    }
    return 1;
    }


    Also die Anim führt er aus (kann aber auch an der .rec datei liegen!)


    mfg :thumbup:

  • SpawnPlayer bei OnPlayerSpawn ist eine schlechte Idee.


    if(IsPlayerNPC(playerid)){
    printf("Name = %s", getName(playerid));
    if(!strcmp(getName(playerid), "Joe", true)){
    printf("Skin 33 zu ID %d", playerid);
    RepairAnims(playerid);
    SetPlayerSkin(playerid, 33);
    ApplyAnimation(playerid, "SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0, 0);
    }
    return 1;
    }


    Was wird geprintet, wenn du es so laufen lässt?

  • Beitrag von Kaliber ()

    Dieser Beitrag wurde gelöscht, Informationen über den Löschvorgang sind nicht verfügbar.

  • Es wird nichts geprintet, er führt das Callback OnPlayerSpawn nicht aus!


    Kaliber


    stock RepairAnims(playerid){
    PreloadAnimLib(playerid,"AIRPORT");
    PreloadAnimLib(playerid,"Attractors");
    PreloadAnimLib(playerid,"BAR");
    PreloadAnimLib(playerid,"BASEBALL");
    PreloadAnimLib(playerid,"BD_FIRE");
    PreloadAnimLib(playerid,"BEACH");
    PreloadAnimLib(playerid,"benchpress");
    PreloadAnimLib(playerid,"BF_injection");
    PreloadAnimLib(playerid,"BIKED");
    PreloadAnimLib(playerid,"BIKEH");
    PreloadAnimLib(playerid,"BIKELEAP");
    PreloadAnimLib(playerid,"BIKES");
    PreloadAnimLib(playerid,"BIKEV");
    PreloadAnimLib(playerid,"BIKE_DBZ");
    PreloadAnimLib(playerid,"BLOWJOBZ");
    PreloadAnimLib(playerid,"BMX");
    PreloadAnimLib(playerid,"BOMBER");
    PreloadAnimLib(playerid,"BOX");
    PreloadAnimLib(playerid,"BSKTBALL");
    PreloadAnimLib(playerid,"BUDDY");
    PreloadAnimLib(playerid,"BUS");
    PreloadAnimLib(playerid,"CAMERA");
    PreloadAnimLib(playerid,"CAR");
    PreloadAnimLib(playerid,"CARRY");
    PreloadAnimLib(playerid,"CASINO");
    PreloadAnimLib(playerid,"CHAINSAW");
    PreloadAnimLib(playerid,"CHOPPA");
    PreloadAnimLib(playerid,"CLOTHES");
    PreloadAnimLib(playerid,"COACH");
    PreloadAnimLib(playerid,"COLT45");
    PreloadAnimLib(playerid,"COP_AMBIENT");
    PreloadAnimLib(playerid,"COP_DVBYZ");
    PreloadAnimLib(playerid,"CRACK");
    PreloadAnimLib(playerid,"CRIB");
    PreloadAnimLib(playerid,"DAM_JUMP");
    PreloadAnimLib(playerid,"DANCING");
    PreloadAnimLib(playerid,"DEALER");
    PreloadAnimLib(playerid,"DILDO");
    PreloadAnimLib(playerid,"DODGE");
    PreloadAnimLib(playerid,"DOZER");
    PreloadAnimLib(playerid,"DRIVEBYS");
    PreloadAnimLib(playerid,"FAT");
    PreloadAnimLib(playerid,"FIGHT_B");
    PreloadAnimLib(playerid,"FIGHT_C");
    PreloadAnimLib(playerid,"FIGHT_D");
    PreloadAnimLib(playerid,"FIGHT_E");
    PreloadAnimLib(playerid,"FINALE");
    PreloadAnimLib(playerid,"FINALE2");
    PreloadAnimLib(playerid,"FLAME");
    PreloadAnimLib(playerid,"Flowers");
    PreloadAnimLib(playerid,"FOOD");
    PreloadAnimLib(playerid,"Freeweights");
    PreloadAnimLib(playerid,"GANGS");
    PreloadAnimLib(playerid,"GHANDS");
    PreloadAnimLib(playerid,"GHETTO_DB");
    PreloadAnimLib(playerid,"goggles");
    PreloadAnimLib(playerid,"GRAFFITI");
    PreloadAnimLib(playerid,"GRAVEYARD");
    PreloadAnimLib(playerid,"GRENADE");
    PreloadAnimLib(playerid,"GYMNASIUM");
    PreloadAnimLib(playerid,"HAIRCUTS");
    PreloadAnimLib(playerid,"HEIST9");
    PreloadAnimLib(playerid,"INT_HOUSE");
    PreloadAnimLib(playerid,"INT_OFFICE");
    PreloadAnimLib(playerid,"INT_SHOP");
    PreloadAnimLib(playerid,"JST_BUISNESS");
    PreloadAnimLib(playerid,"KART");
    PreloadAnimLib(playerid,"KISSING");
    PreloadAnimLib(playerid,"KNIFE");
    PreloadAnimLib(playerid,"LAPDAN1");
    PreloadAnimLib(playerid,"LAPDAN2");
    PreloadAnimLib(playerid,"LAPDAN3");
    PreloadAnimLib(playerid,"LOWRIDER");
    PreloadAnimLib(playerid,"MD_CHASE");
    PreloadAnimLib(playerid,"MD_END");
    PreloadAnimLib(playerid,"MEDIC");
    PreloadAnimLib(playerid,"MISC");
    PreloadAnimLib(playerid,"MTB");
    PreloadAnimLib(playerid,"MUSCULAR");
    PreloadAnimLib(playerid,"NEVADA");
    PreloadAnimLib(playerid,"ON_LOOKERS");
    PreloadAnimLib(playerid,"OTB");
    PreloadAnimLib(playerid,"PARACHUTE");
    PreloadAnimLib(playerid,"PARK");
    PreloadAnimLib(playerid,"PAULNMAC");
    PreloadAnimLib(playerid,"PED");
    PreloadAnimLib(playerid,"PLAYER_DVBYS");
    PreloadAnimLib(playerid,"PLAYIDLES");
    PreloadAnimLib(playerid,"POLICE");
    PreloadAnimLib(playerid,"POOL");
    PreloadAnimLib(playerid,"POOR");
    PreloadAnimLib(playerid,"PYTHON");
    PreloadAnimLib(playerid,"QUAD");
    PreloadAnimLib(playerid,"QUAD_DBZ");
    PreloadAnimLib(playerid,"RAPPING");
    PreloadAnimLib(playerid,"RIFLE");
    PreloadAnimLib(playerid,"RIOT");
    PreloadAnimLib(playerid,"ROB_BANK");
    PreloadAnimLib(playerid,"ROCKET");
    PreloadAnimLib(playerid,"RUSTLER");
    PreloadAnimLib(playerid,"RYDER");
    PreloadAnimLib(playerid,"SCRATCHING");
    PreloadAnimLib(playerid,"SHAMAL");
    PreloadAnimLib(playerid,"SHOP");
    PreloadAnimLib(playerid,"SHOTGUN");
    PreloadAnimLib(playerid,"SILENCED");
    PreloadAnimLib(playerid,"SKATE");
    PreloadAnimLib(playerid,"SMOKING");
    PreloadAnimLib(playerid,"SNIPER");
    PreloadAnimLib(playerid,"SPRAYCAN");
    PreloadAnimLib(playerid,"STRIP");
    PreloadAnimLib(playerid,"SUNBATHE");
    PreloadAnimLib(playerid,"SWAT");
    PreloadAnimLib(playerid,"SWEET");
    PreloadAnimLib(playerid,"SWIM");
    PreloadAnimLib(playerid,"SWORD");
    PreloadAnimLib(playerid,"TANK");
    PreloadAnimLib(playerid,"TATTOOS");
    PreloadAnimLib(playerid,"TEC");
    PreloadAnimLib(playerid,"TRAIN");
    PreloadAnimLib(playerid,"TRUCK");
    PreloadAnimLib(playerid,"UZI");
    PreloadAnimLib(playerid,"VAN");
    PreloadAnimLib(playerid,"VENDING");
    PreloadAnimLib(playerid,"VORTEX");
    PreloadAnimLib(playerid,"WAYFARER");
    PreloadAnimLib(playerid,"WEAPONS");
    PreloadAnimLib(playerid,"WUZI");
    }


    mfg :thumbup:

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


  • Nein es funktioniert so auch irgendwie auch nicht.
    Was ist nur mit dem NPC los ??
    Möchtest du vielleicht mal die Joe.pwn sehen ? (Quellcode)


    mfg :thumbup:

  • Kannst ja mal posten.
    Hast du den Bot als im Fahrzeug oder als zu Fuß aufgenommen?


    Hast du andere NPCs ingame, bei denen es klappt?


    #include <a_npc>


    main(){}


    #define RECORDING "Joe"
    #define RECORDING_TYPE 2


    public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);


    public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);


    public OnNPCExitVehicle()StopRecordingPlayback();


    public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);


    Das wäre mein 1ter NPC!


    Ich habe ihn per /ofrecord zu Fuß aufgenommen.


    mfg :thumbup:

  • Also da hast du garantiert bei der Aufnahme einen Fehler gemacht. Normalerweise haben die NPCs mehrere 100 Kilobyte, deine Datei hat gerade mal 80 Bytes.
    Nehme den NPC nochmals neu auf.


    => Gehe an die Position an der du starten willst
    => /ofrecord Joe
    => Laufe deine Strecke ab
    => /stoprecord


    Dann sollte es passen.

  • Beitrag von Kasakow ()

    Dieser Beitrag wurde gelöscht, Informationen über den Löschvorgang sind nicht verfügbar.
  • Lass den NPC's ruhig länger aufnehmen. Bei so kurzer Zeit verlässt der NPC direkt wieder den Server, da er die .rec Datei durchgelaufen ist.


    Er durchgeht die .rec Datei unendlich lang, und der bot war die ganze Zeit da!


    EDIT://
    Jetzt funktionierst, habe es einfach beim connecten gemacht, der print hat mir geholfen!


    @ConnectNPC(_count);
    @ConnectNPC(_count){
    switch(_count){
    case 0:{
    ConnectNPC("Joe", "Joe");
    for(new playerid; playerid < MAX_PLAYERS; playerid ++){
    if(!IsPlayerConnected(playerid))continue;
    if(!IsPlayerNPC(playerid))continue;
    //printf("joe is connected, skin: %i", GetPlayerSkin(playerid));
    SetPlayerSkin(playerid, 33);
    //printf("joe is connected, skin: %i", GetPlayerSkin(playerid));
    }
    }
    }
    }



    mfg :thumbup:

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