Moving boat
#1

Hey im trying to make a boat to a island... But i got a problem... It does go to the island but if it tries to go back it goes back 5 meter then it got punched back to the island and i can find any fail in this code? :S

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
//Moving Timers
#define timer1 1000*60*3
#define timer2 1000*60*6
//news
new ship1;
//forwarders
forward shipmoving();
forward shipback();
public OnFilterScriptInit()
{
    ship1 = CreateObject(10771,2750.78759766,810.22570801,17.48415947,0.00000000,0.00000000,270.75000000); //object(carrier_hull_sfse) (1)

    SetTimer("shipmoving", timer1, true);
    return 1;
}
public shipmoving()
{
    MoveObject(ship1,2780.78759766,810.22570801,17.48415947, 7);
    printf("Boat is moving!");
}
public shipback()
{
    MoveObject(ship1,2750.78759766,810.22570801,17.48415947, 7);

    printf("Boat is moving");
}
Reply
#2

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
//Moving Timers
#define timer1 1000*60*3
#define timer2 1000*60*2 // You should use here a smaller amount of time.
//news
new ship1;
//forwarders
forward shipmoving();
forward shipback();
public OnFilterScriptInit()
{
    ship1 = CreateObject(10771,2750.78759766,810.22570801,17.48415947,0.00000000,0.00000000,270.75000000); //object(carrier_hull_sfse) (1)

    SetTimer("shipmoving", timer1, true);
    return 1;
}
public shipmoving()
{
    MoveObject(ship1,2780.78759766,810.22570801,17.48415947, 7);
    SetTimer("shipback", timer2, false); // Timer is used only 1 time when the callback is called.
    printf("Boat is moving!");
}
public shipback()
{
    MoveObject(ship1,2750.78759766,810.22570801,17.48415947, 7);
    printf("Boat is moving");
}
EDIT: You forgot a timer for the Shipback callback and I put a smaller amount of time for the timer2, it also depends how long the ship needs to reach its destination. You should calculate that and see how long you want the ship being there till it goes back.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)