Destroy Object

Započeo Vojinxt125x, Avgust 09, 2017, 15:25:05 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 4 gostiju pregledaju ovu temu.

Skripta koju koristim: Ath
Detaljan opis problema: Opet ja, attach sam objekte na vozilo i sada kada dodje do poslednjeg CPa on treba da unisti te objekte i ja sam isao sa DestroyObject i to sam uradio ovako :
[pawn]new VehicleObject1 = CreateObject(2909, -1.37, -1.75, 0.95,   0.00, 0.00, 0.00);
   new VehicleObject2 = CreateObject(2909, 1.43, -1.75, 0.95,   0.00, 0.00, 0.00);
   new VehicleObject3 = CreateObject(2909, 0.02, -1.77, 2.19,   0.00, -90.00, 0.00);
   new VehicleObject4 = CreateObject(2904, 0.02, -5.62, 0.98,   0.00, 90.00, 0.00);
        DestroyObject (VehicleObject)
[/pawn]
Pre respawna on bi trebao da unisti ove objekte evo kod poslednjeg cpa :
[pawn]case 52: {
             if( PlayerInfo[ playerid ][ xPosao ] == POSAO_STOCAR && ( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 578 ) ) {
                if(GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) {
                  if( IsPlayerInRangeOfPoint( playerid, 5.0, -1444.5360,-1577.2019,101.7578 ) ) {
                       Vojin_DisablePlayerCheckpoint( playerid );
                       CheckpointStatus[ playerid ] = 0;
                       SetVehicleToRespawn( GetPlayerVehicleID( playerid ) );
                  new bonus = random(100);
                  PlayerInfo[ playerid ][ xPlatniRacun ] += (1450+bonus);
                  SendJobMessage( playerid, "Zavrsili ste sa poslom i zaradili "col_white"%d$.", (1450+bonus) );
                  BussinesJobMoney( POSAO_FARMER, ((1450+bonus)/10) );
                  SavePlayer( playerid ); UpdatePlataTD( playerid );
                  farmerInfo[ playerid ][ fiCowNumber ] = 0;
                  PrevozKrava [ playerid ] = 0;
                  StaroVreme[ playerid ] = 0;
                   NovoVreme[ playerid ] = 0;// Ovde izbrisi krave
                  }
               }

            }
         }[/pawn]
Ja ubacim ovo destroy object  ovde izand respawnvehicle ali ga i dalje spawna sa objektima ? Gde mogu da ubacim ?

Dio skripte:
Neke slike/video za lakse dobivanje pomoci(neobavezno):

Ubacis tu, ali DestroyObject(VehicleObject1), DestroyObject(VehicleObject2) itd

Radio sam tako.. Dal mozda da sklonim respawn ? i na mestu respawna da ubacim destroyere i onda igrac mora da ga stavi na mesto ? Haj probacu tako

Ne mogu edit gornji post jer je neko procitao..
Uradio sam na mesto umesto respawna i dalje nece .. Evo ovako kodovi :

Ovde sam stavio da se attachobjectovehicle:
[pawn]forward StocarUtovar( playerid );
public StocarUtovar( playerid ) {
   Vojin_KillTimer( StocarTimer[ playerid ] );
    TogglePlayerControllable( playerid, true );
    GameTextForPlayer( playerid, "~w~Nova lokacija postavljena", 3000, 5 );
    new veh = GetPlayerVehicleID(playerid);
    new VehicleObject1 = CreateObject(2909, -1.37, -1.75, 0.95,   0.00, 0.00, 0.00);
   new VehicleObject2 = CreateObject(2909, 1.43, -1.75, 0.95,   0.00, 0.00, 0.00);
   new VehicleObject3 = CreateObject(2909, 0.02, -1.77, 2.19,   0.00, -90.00, 0.00);
   new VehicleObject4 = CreateObject(2904, 0.02, -5.62, 0.98,   0.00, 90.00, 0.00);
   AttachObjectToVehicle(VehicleObject1, veh, -1.37, -1.75, 0.95, 0.00, 0.00, 0.00);
   AttachObjectToVehicle(VehicleObject2, veh, 1.43, -1.75, 0.95, 0.00, 0.00, 0.00);
   AttachObjectToVehicle(VehicleObject3, veh, 0.02, -1.77, 2.19, 0.00, -90.00, 0.00);
   AttachObjectToVehicle(VehicleObject4, veh, 0.02, -5.62, 0.98, 0.00, 90.00, 0.00);
    SendClientMessage(playerid,-1,"Uspesno ste utovarili krave."); // OVDE STAVI KRAVE
    Vojin_SetPlayerCheckpoint( playerid, -1359.9373,-1489.7100,102.5057, 5.0 ); // CP ISTOVAR
    CheckpointStatus[playerid] = 51;
    return 1;
}[/pawn]

A ovde da se izbrise:
[pawn]case 52: {
             if( PlayerInfo[ playerid ][ xPosao ] == POSAO_STOCAR && ( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 578 ) ) {
                if(GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) {
                  if( IsPlayerInRangeOfPoint( playerid, 5.0, -1444.5360,-1577.2019,101.7578 ) ) {
                       Vojin_DisablePlayerCheckpoint( playerid );
                       CheckpointStatus[ playerid ] = 0;
                       SetVehicleToRespawn( GetPlayerVehicleID( playerid ) );
                       new VehicleObject1 = CreateObject(2909, -1.37, -1.75, 0.95,   0.00, 0.00, 0.00);
                  new VehicleObject2 = CreateObject(2909, 1.43, -1.75, 0.95,   0.00, 0.00, 0.00);
                  new VehicleObject3 = CreateObject(2909, 0.02, -1.77, 2.19,   0.00, -90.00, 0.00);
                  new VehicleObject4 = CreateObject(2904, 0.02, -5.62, 0.98,   0.00, 90.00, 0.00);
                    DestroyObject (VehicleObject1);
                    DestroyObject (VehicleObject2);
                    DestroyObject (VehicleObject3);
                    DestroyObject (VehicleObject4);
                  new bonus = random(100);
                  PlayerInfo[ playerid ][ xPlatniRacun ] += (1450+bonus);
                  SendJobMessage( playerid, "Zavrsili ste sa poslom i zaradili "col_white"%d$.", (1450+bonus) );
                  BussinesJobMoney( POSAO_FARMER, ((1450+bonus)/10) );
                  SavePlayer( playerid ); UpdatePlataTD( playerid );
                  farmerInfo[ playerid ][ fiCowNumber ] = 0;
                  PrevozKrava [ playerid ] = 0;
                  StaroVreme[ playerid ] = 0;
                   NovoVreme[ playerid ] = 0;// Ovde izbrisi krave
                  }
               }

            }
         }[/pawn]

Jel uocava neko negde neku gresku ?
MNOGO SE IZVINJAVAM AKO I OVO SPADA U DUPLI POST ALI NE MOGU EDITOVATI, IZVINITE

Citat: Vojinxt125x poslato Avgust 09, 2017, 23:48:40 POSLE PODNE
Ne mogu edit gornji post jer je neko procitao..
Uradio sam na mesto umesto respawna i dalje nece .. Evo ovako kodovi :

Ovde sam stavio da se attachobjectovehicle:
[pawn]forward StocarUtovar( playerid );
public StocarUtovar( playerid ) {
   Vojin_KillTimer( StocarTimer[ playerid ] );
    TogglePlayerControllable( playerid, true );
    GameTextForPlayer( playerid, "~w~Nova lokacija postavljena", 3000, 5 );
    new veh = GetPlayerVehicleID(playerid);
    new VehicleObject1 = CreateObject(2909, -1.37, -1.75, 0.95,   0.00, 0.00, 0.00);
   new VehicleObject2 = CreateObject(2909, 1.43, -1.75, 0.95,   0.00, 0.00, 0.00);
   new VehicleObject3 = CreateObject(2909, 0.02, -1.77, 2.19,   0.00, -90.00, 0.00);
   new VehicleObject4 = CreateObject(2904, 0.02, -5.62, 0.98,   0.00, 90.00, 0.00);
   AttachObjectToVehicle(VehicleObject1, veh, -1.37, -1.75, 0.95, 0.00, 0.00, 0.00);
   AttachObjectToVehicle(VehicleObject2, veh, 1.43, -1.75, 0.95, 0.00, 0.00, 0.00);
   AttachObjectToVehicle(VehicleObject3, veh, 0.02, -1.77, 2.19, 0.00, -90.00, 0.00);
   AttachObjectToVehicle(VehicleObject4, veh, 0.02, -5.62, 0.98, 0.00, 90.00, 0.00);
    SendClientMessage(playerid,-1,"Uspesno ste utovarili krave."); // OVDE STAVI KRAVE
    Vojin_SetPlayerCheckpoint( playerid, -1359.9373,-1489.7100,102.5057, 5.0 ); // CP ISTOVAR
    CheckpointStatus[playerid] = 51;
    return 1;
}[/pawn]

A ovde da se izbrise:
[pawn]case 52: {
             if( PlayerInfo[ playerid ][ xPosao ] == POSAO_STOCAR && ( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 578 ) ) {
                if(GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) {
                  if( IsPlayerInRangeOfPoint( playerid, 5.0, -1444.5360,-1577.2019,101.7578 ) ) {
                       Vojin_DisablePlayerCheckpoint( playerid );
                       CheckpointStatus[ playerid ] = 0;
                       SetVehicleToRespawn( GetPlayerVehicleID( playerid ) );
                       new VehicleObject1 = CreateObject(2909, -1.37, -1.75, 0.95,   0.00, 0.00, 0.00);
                  new VehicleObject2 = CreateObject(2909, 1.43, -1.75, 0.95,   0.00, 0.00, 0.00);
                  new VehicleObject3 = CreateObject(2909, 0.02, -1.77, 2.19,   0.00, -90.00, 0.00);
                  new VehicleObject4 = CreateObject(2904, 0.02, -5.62, 0.98,   0.00, 90.00, 0.00);
                    DestroyObject (VehicleObject1);
                    DestroyObject (VehicleObject2);
                    DestroyObject (VehicleObject3);
                    DestroyObject (VehicleObject4);
                  new bonus = random(100);
                  PlayerInfo[ playerid ][ xPlatniRacun ] += (1450+bonus);
                  SendJobMessage( playerid, "Zavrsili ste sa poslom i zaradili "col_white"%d$.", (1450+bonus) );
                  BussinesJobMoney( POSAO_FARMER, ((1450+bonus)/10) );
                  SavePlayer( playerid ); UpdatePlataTD( playerid );
                  farmerInfo[ playerid ][ fiCowNumber ] = 0;
                  PrevozKrava [ playerid ] = 0;
                  StaroVreme[ playerid ] = 0;
                   NovoVreme[ playerid ] = 0;// Ovde izbrisi krave
                  }
               }

            }
         }[/pawn]

Jel uocava neko negde neku gresku ?
MNOGO SE IZVINJAVAM AKO I OVO SPADA U DUPLI POST ALI NE MOGU EDITOVATI, IZVINITE

Pa jesi li probao compile tako?

Da compile sam i nece i dalje.. Da nije zato sto kod prvog cpa imam ovo :
[pawn]new veh = GetPlayerVehicleID(playerid);
    new VehicleObject1 = CreateObject(2909, -1.37, -1.75, 0.95,   0.00, 0.00, 0.00);
   new VehicleObject2 = CreateObject(2909, 1.43, -1.75, 0.95,   0.00, 0.00, 0.00);
   new VehicleObject3 = CreateObject(2909, 0.02, -1.77, 2.19,   0.00, -90.00, 0.00);
   new VehicleObject4 = CreateObject(2904, 0.02, -5.62, 0.98,   0.00, 90.00, 0.00);
   AttachObjectToVehicle(VehicleObject1, veh, -1.37, -1.75, 0.95, 0.00, 0.00, 0.00);
   AttachObjectToVehicle(VehicleObject2, veh, 1.43, -1.75, 0.95, 0.00, 0.00, 0.00);
   AttachObjectToVehicle(VehicleObject3, veh, 0.02, -1.77, 2.19, 0.00, -90.00, 0.00);
   AttachObjectToVehicle(VehicleObject4, veh, 0.02, -5.62, 0.98, 0.00, 90.00, 0.00);[/pawn]
a kod drugog ovo  [pawn]           new VehicleObject1 = CreateObject(2909, -1.37, -1.75, 0.95,   0.00, 0.00, 0.00);
                  new VehicleObject2 = CreateObject(2909, 1.43, -1.75, 0.95,   0.00, 0.00, 0.00);
                  new VehicleObject3 = CreateObject(2909, 0.02, -1.77, 2.19,   0.00, -90.00, 0.00);
                  new VehicleObject4 = CreateObject(2904, 0.02, -5.62, 0.98,   0.00, 90.00, 0.00);
                            DestroyObject (VehicleObject1);
                            DestroyObject (VehicleObject2);
                    DestroyObject (VehicleObject3);
                    DestroyObject (VehicleObject4);[/pawn]
Da nije do toga new vehicleObject = CreateObject () ?

Radi na ovu foru:



new Drvo[4][MAX_PLAYERS];

Pa onda:

Drvo[0][playerid] = CreateObject...
Drvo[1][playerid] = CreateObject...
Drvo[2][playerid] = CreateObject...

Ali kreces od 0

Tako da uradim i ovde gde se attachbojecttovehicle i gde treba da se unisti ?

[pawn]C:\Users\o-ji0o\Desktop\Vojin\bckup bitchz\Server\gamemodes\BEDM.pwn(35506) : error 017: undefined symbol "VehicleObject0"
C:\Users\o-ji0o\Desktop\Vojin\bckup bitchz\Server\gamemodes\BEDM.pwn(35507) : error 017: undefined symbol "VehicleObject1"
C:\Users\o-ji0o\Desktop\Vojin\bckup bitchz\Server\gamemodes\BEDM.pwn(35508) : error 017: undefined symbol "VehicleObject2"
C:\Users\o-ji0o\Desktop\Vojin\bckup bitchz\Server\gamemodes\BEDM.pwn(35509) : error 017: undefined symbol "VehicleObject3"
Pawn compiler 3.2.3664           Copyright (c) 1997-2006, ITB CompuPhase

[/pawn]
Dobijem te errore kad ovako uradim : [pawn]case 52: {
             if( PlayerInfo[ playerid ][ xPosao ] == POSAO_STOCAR && ( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 578 ) ) {
                if(GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) {
                  if( IsPlayerInRangeOfPoint( playerid, 5.0, -1444.5360,-1577.2019,101.7578 ) ) {
                       Vojin_DisablePlayerCheckpoint( playerid );
                       CheckpointStatus[ playerid ] = 0;
                       //SetVehicleToRespawn( GetPlayerVehicleID( playerid ) );
                       new VehicleObject[4][MAX_PLAYERS];
                   VehicleObject[0][playerid] = CreateObject(2909, -1.37, -1.75, 0.95,   0.00, 0.00, 0.00);
                   VehicleObject[1][playerid] = CreateObject(2909, 1.43, -1.75, 0.95,   0.00, 0.00, 0.00);
                   VehicleObject[2][playerid] = CreateObject(2909, 0.02, -1.77, 2.19,   0.00, -90.00, 0.00);
                   VehicleObject[3][playerid] = CreateObject(2904, 0.02, -5.62, 0.98,   0.00, 90.00, 0.00);
                    DestroyObject(VehicleObject0);
                    DestroyObject(VehicleObject1);
                    DestroyObject(VehicleObject2);
                    DestroyObject(VehicleObject3);
                  new bonus = random(100);
                  PlayerInfo[ playerid ][ xPlatniRacun ] += (1450+bonus);
                  SendJobMessage( playerid, "Zavrsili ste sa poslom i zaradili "col_white"%d$.", (1450+bonus) );
                  BussinesJobMoney( POSAO_FARMER, ((1450+bonus)/10) );
                  SavePlayer( playerid ); UpdatePlataTD( playerid );
                  farmerInfo[ playerid ][ fiCowNumber ] = 0;
                  PrevozKrava [ playerid ] = 0;
                  StaroVreme[ playerid ] = 0;
                   NovoVreme[ playerid ] = 0;// Ovde izbrisi krave
                  }
               }

            }
         }[/pawn]
Errori sa na destroyobject linijama

Pa moras kao i gore,DestroyObject(VehicleObject[0]);

[pawn]C:\Users\o-ji0o\Desktop\Vojin\bckup bitchz\Server\gamemodes\BEDM.pwn(35506) : error 035: argument type mismatch (argument 1)
C:\Users\o-ji0o\Desktop\Vojin\bckup bitchz\Server\gamemodes\BEDM.pwn(35507) : error 035: argument type mismatch (argument 1)
C:\Users\o-ji0o\Desktop\Vojin\bckup bitchz\Server\gamemodes\BEDM.pwn(35508) : error 035: argument type mismatch (argument 1)
C:\Users\o-ji0o\Desktop\Vojin\bckup bitchz\Server\gamemodes\BEDM.pwn(35509) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664           Copyright (c) 1997-2006, ITB CompuPhase[/pawn]
Sad taj eror.. Evo kod opet :"D  Opet na destroy object linijama


[pawn] new VehicleObject[4][MAX_PLAYERS];
                   VehicleObject[0][playerid] = CreateObject(2909, -1.37, -1.75, 0.95,   0.00, 0.00, 0.00);
                   VehicleObject[1][playerid] = CreateObject(2909, 1.43, -1.75, 0.95,   0.00, 0.00, 0.00);
                   VehicleObject[2][playerid] = CreateObject(2909, 0.02, -1.77, 2.19,   0.00, -90.00, 0.00);
                   VehicleObject[3][playerid] = CreateObject(2904, 0.02, -5.62, 0.98,   0.00, 90.00, 0.00);
                    DestroyObject(VehicleObject[0]);
                    DestroyObject(VehicleObject[1]);
                    DestroyObject(VehicleObject[2]);
                    DestroyObject(VehicleObject[3]);[/pawn]

DestroyObject(VehicleObject[0][playerid]); i tako i na ostalim

I dalje ostaje attachovan.. Nema erora i ot, ali IG i dalje objekat ostaje.. ://

probaj premjestiti dole ispod StaroVreme[ playerid ] = 0;

Kako mislis ? Da zamenim mesta ovome  StaroVreme[ playerid ] = 0; i NovoVreme [ Playerid ] = 0; ?
[pawn]    case 52: {
             if( PlayerInfo[ playerid ][ xPosao ] == POSAO_STOCAR && ( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 578 ) ) {
                if(GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) {
                  if( IsPlayerInRangeOfPoint( playerid, 5.0, -1444.5360,-1577.2019,101.7578 ) ) {
                       Vojin_DisablePlayerCheckpoint( playerid );
                       CheckpointStatus[ playerid ] = 0;
                       //SetVehicleToRespawn( GetPlayerVehicleID( playerid ) );
                       new VehicleObject[4][MAX_PLAYERS];
                   VehicleObject[0][playerid] = CreateObject(2909, -1.37, -1.75, 0.95,   0.00, 0.00, 0.00);
                   VehicleObject[1][playerid] = CreateObject(2909, 1.43, -1.75, 0.95,   0.00, 0.00, 0.00);
                   VehicleObject[2][playerid] = CreateObject(2909, 0.02, -1.77, 2.19,   0.00, -90.00, 0.00);
                   VehicleObject[3][playerid] = CreateObject(2904, 0.02, -5.62, 0.98,   0.00, 90.00, 0.00);
                    DestroyObject(VehicleObject[0][playerid]);
                    DestroyObject(VehicleObject[1][playerid]);
                    DestroyObject(VehicleObject[2][playerid]);
                    DestroyObject(VehicleObject[3][playerid]);
                  new bonus = random(100);
                  PlayerInfo[ playerid ][ xPlatniRacun ] += (1450+bonus);
                  SendJobMessage( playerid, "Zavrsili ste sa poslom i zaradili "col_white"%d$.", (1450+bonus) );
                  BussinesJobMoney( POSAO_FARMER, ((1450+bonus)/10) );
                  SavePlayer( playerid ); UpdatePlataTD( playerid );
                  farmerInfo[ playerid ][ fiCowNumber ] = 0;
                  PrevozKrava [ playerid ] = 0;
                  StaroVreme[ playerid ] = 0;
                   NovoVreme[ playerid ] = 0;// Ovde izbrisi krave
                  }
               }

            }
         }
         [/pawn]