Jump to content

Recommended Posts

Posted (edited)

Vin cu o problema si va rog daca se poate sa-mi oferiti un mic ajutor. Am gasit acest sistem de lift ,lasat in scriptul de mai jos. Intrebarea mea este: in acest script se pot folosi doua lifturi aflate in locatii diferite? Daca da, cum? va multumesc mult.  (scuze acele paranteze, le-am facut eu ca mici hint-uri in caz ca voi vrea sa schimb locatia lui)


 

#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

#define BackTime 12000 // Timpul in care liftul revine la pozitia initiala

new pdlift;

forward PdLift();
forward IsACop(playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);

public OnFilterScriptInit()
{
    //////////////////////////////////////////////////////////////////////////

 
    //////////aici se pune exteriorul ////////
    
    //////////////////////////////////////////////////////////////////////////
    
             

    pdlift =CreateObject(19359, 2089.24634, 2361.20728, 10.20070,   0.00000, -90.00000, 0.00000); ///// liftul


    print("\n--------------------------------------");
    print("        Flashhiee");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/lift", cmdtext, true, 10) == 0) {
        if(PlayerToPoint(5.0,playerid,2089.24634, 2361.20728, 10.20070) || PlayerToPoint(5.0,playerid,2089.24634, 2361.20728, 22.48570))  { /// sus /jos
            if(!IsObjectMoving(pdlift)) {
                MoveObject(pdlift,2089.24634, 2361.20728, 22.48570,1.5); //// jos
                SetTimer("PdLift",BackTime,false); } else {
                SendClientMessage(playerid,-1,"Lift is already used."); }
        } else {
            SendClientMessage(playerid,-1,"You must be close to lift."); }
        return 1;
    }
    return 0;
}


public PdLift()
{
    MoveObject(pdlift,2089.24634, 2361.20728, 10.20070,1.5); //// sus 
    return 1;
}

public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}

#endif
#define BackTime 12000 // Timpul in care liftul revine la pozitia initiala
 

Edited by Adrian Mircea
Posted

Poti lua filterscript-ul default de la gamemode-=ul dupa www.sa-mp.com si o sa mearga

Posted

Zi-mi ce coordonate vrei pentru al doilea lift (sus si jos) si ti-l fac eu.

  • Upvote 1

Discord:
! Akan !#6675

Posted
1 oră în urmă, Akan a spus:

Zi-mi ce coordonate vrei pentru al doilea lift (sus si jos) si ti-l fac eu.

CreateDynamicObject(19359, 2197.13550, 2396.73804, 22.55330,   0.00000, -90.00000, -90.00000); liftul sus
CreateDynamicObject(19359, 2197.13550, 2396.73804, 10.45930,   0.00000, -90.00000, -90.00000); liftul jos

 

Iti multumesc mult!

Posted

Cu multa placere. :)

 

#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

#define BackTime 12000 // Timpul in care liftul revine la pozitia initiala

new pdlift[2];

forward PdLift1();
forward PdLift2();
forward IsACop(playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);

public OnFilterScriptInit()
{
    //////////////////////////////////////////////////////////////////////////

    //////////aici se pune exteriorul ////////

    //////////////////////////////////////////////////////////////////////////


    pdlift[0] = CreateObject(19359, 2089.24634, 2361.20728, 10.20070,   0.00000, -90.00000, 0.00000); ///// liftul 1
    pdlift[1] = CreateObject(19359, 2197.13550, 2396.73804, 10.45930,   0.00000, -90.00000, -90.00000); ///// liftul 2


    print("\n--------------------------------------");
    print("        Flashhiee");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/lift", cmdtext, true, 10) == 0) {
        if(PlayerToPoint(5.0,playerid,2089.24634, 2361.20728, 10.20070) || PlayerToPoint(5.0,playerid,2089.24634, 2361.20728, 22.48570)) { /// sus/jos (lift 1)
            if(!IsObjectMoving(pdlift[0])) {
                MoveObject(pdlift[0],2089.24634, 2361.20728, 22.48570,1.5); //// jos (lift 1)
                SetTimer("PdLift1",BackTime,false); } else {
                SendClientMessage(playerid,-1,"Lift is already used."); }
        } else if(PlayerToPoint(5.0,playerid,2197.13550, 2396.73804, 10.45930) || PlayerToPoint(5.0,playerid,2197.13550, 2396.73804, 22.55330)) { /// sus/jos (lift 2)
            if(!IsObjectMoving(pdlift[1])) {
                MoveObject(pdlift[1],2197.13550, 2396.73804, 22.55330,1.5); //// jos (lift 2)
                SetTimer("PdLift2",BackTime,false); } else {
                SendClientMessage(playerid,-1,"Lift is already used."); }
        } else {
            SendClientMessage(playerid,-1,"You must be close to lift."); }
       	return 1;
    }
    return 0;
}

public PdLift1() return MoveObject(pdlift[0],2089.24634, 2361.20728, 10.20070,1.5); //// sus (lift 1)

public PdLift2() return MoveObject(pdlift[1],2197.13550, 2396.73804, 10.45930,1.5); //// sus (lift 2)

public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}

#endif
#define BackTime 12000 // Timpul in care liftul revine la pozitia initiala

Poftim! Bafta!

Discord:
! Akan !#6675

Posted
Acum 7 minute, Akan a spus:

Cu multa placere. :)

 


#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

#define BackTime 12000 // Timpul in care liftul revine la pozitia initiala

new pdlift[2];

forward PdLift1();
forward PdLift2();
forward IsACop(playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);

public OnFilterScriptInit()
{
    //////////////////////////////////////////////////////////////////////////

    //////////aici se pune exteriorul ////////

    //////////////////////////////////////////////////////////////////////////


    pdlift[0] = CreateObject(19359, 2089.24634, 2361.20728, 10.20070,   0.00000, -90.00000, 0.00000); ///// liftul 1
    pdlift[1] = CreateObject(19359, 2197.13550, 2396.73804, 10.45930,   0.00000, -90.00000, -90.00000); ///// liftul 2


    print("\n--------------------------------------");
    print("        Flashhiee");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/lift", cmdtext, true, 10) == 0) {
        if(PlayerToPoint(5.0,playerid,2089.24634, 2361.20728, 10.20070) || PlayerToPoint(5.0,playerid,2089.24634, 2361.20728, 22.48570)) { /// sus/jos (lift 1)
            if(!IsObjectMoving(pdlift[0])) {
                MoveObject(pdlift[0],2089.24634, 2361.20728, 22.48570,1.5); //// jos (lift 1)
                SetTimer("PdLift1",BackTime,false); } else {
                SendClientMessage(playerid,-1,"Lift is already used."); }
        } else if(PlayerToPoint(5.0,playerid,2197.13550, 2396.73804, 10.45930) || PlayerToPoint(5.0,playerid,2197.13550, 2396.73804, 22.55330)) { /// sus/jos (lift 2)
            if(!IsObjectMoving(pdlift[1])) {
                MoveObject(pdlift[1],2197.13550, 2396.73804, 22.55330,1.5); //// jos (lift 2)
                SetTimer("PdLift2",BackTime,false); } else {
                SendClientMessage(playerid,-1,"Lift is already used."); }
        } else {
            SendClientMessage(playerid,-1,"You must be close to lift."); }
       	return 1;
    }
    return 0;
}

public PdLift1() return MoveObject(pdlift[0],2089.24634, 2361.20728, 10.20070,1.5); //// sus (lift 1)

public PdLift2() return MoveObject(pdlift[1],2197.13550, 2396.73804, 10.45930,1.5); //// sus (lift 2)

public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}

#endif
#define BackTime 12000 // Timpul in care liftul revine la pozitia initiala

Poftim! Bafta!

iti multumesc , apreciez enorm.

 

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.