SA-MP Forums Archive
/Ramp problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /Ramp problem (/showthread.php?tid=345485)



/Ramp problem - calin1996 - 25.05.2012

I have a ramp which create/move/destroy a ramp on DFT-30:
pawn Код:
new rampup = CreateObject(18756,0,0,-1000,0,0,0,100);
new rampdn = CreateObject(18756,0,0,-1000,0,0,0,100);
                new carid = GetPlayerVehicleID(playerid);
                //new mm = GetVehicleModel(carid);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(IsADFT(carid))
                {
                    if(strcmp(x_nr,"up",true) == 0)
                    {
                        AttachObjectToVehicle(rampup, carid, 0.524999,-2.700001,1.650000,-269.999877,0.000000,89.099983);
                        format(string, sizeof(string), "* %s a ridicat rampa.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        DestroyObject(rampdn);
                        return 1;
                    }
                    else if(strcmp(x_nr,"down",true) == 0)
                    {
                        AttachObjectToVehicle(rampdn, carid, 0.450000,-8.324991,0.075000,-35.100002,269.999877,178.199890);
                        format(string, sizeof(string), "* %s a lasat rampa.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        DestroyObject(rampup);
                        return 1;
When i use /ramp up after using /ramp down, the rampdn object is not being destroyed,a little help?
When i use both commands, and /ramp up command, the /ramp down object should be destroyed,but is not


Re: /Ramp problem - calin1996 - 25.05.2012

If i use /ramp up, the /ramp down object should be destroyed,but is not


Re: /Ramp problem - MadeMan - 25.05.2012

You need to save the object IDs to a global variable (PVar for example)

pawn Код:
new rampup = GetPVarInt(playerid, "RampUp");
                new rampdn = GetPVarInt(playerid, "RampDown");
                new carid = GetPlayerVehicleID(playerid);
                //new mm = GetVehicleModel(carid);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(IsADFT(carid))
                {
                    if(strcmp(x_nr,"up",true) == 0)
                    {
                        if(IsValidObject(rampdn))
                        {
                            DestroyObject(rampdn);
                            SetPVarInt(playerid, "RampDown", 0);
                        }
                        if(!IsValidObject(rampup))
                        {
                            rampup = CreateObject(18756,0,0,-1000,0,0,0,100);
                            SetPVarInt(playerid, "RampUp", rampup);
                        }
                        AttachObjectToVehicle(rampup, carid, 0.524999,-2.700001,1.650000,-269.999877,0.000000,89.099983);
                        format(string, sizeof(string), "* %s a ridicat rampa.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
                    else if(strcmp(x_nr,"down",true) == 0)
                    {
                        if(IsValidObject(rampup))
                        {
                            DestroyObject(rampup);
                            SetPVarInt(playerid, "RampUp", 0);
                        }
                        if(!IsValidObject(rampdn))
                        {
                            rampdn = CreateObject(18756,0,0,-1000,0,0,0,100);
                            SetPVarInt(playerid, "RampDown", rampdn);
                        }
                        AttachObjectToVehicle(rampdn, carid, 0.450000,-8.324991,0.075000,-35.100002,269.999877,178.199890);
                        format(string, sizeof(string), "* %s a lasat rampa.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;



Re: /Ramp problem [SOLVED] - calin1996 - 25.05.2012

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
You need to save the object IDs to a global variable (PVar for example)

pawn Код:
new rampup = GetPVarInt(playerid, "RampUp");
                new rampdn = GetPVarInt(playerid, "RampDown");
                new carid = GetPlayerVehicleID(playerid);
                //new mm = GetVehicleModel(carid);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(IsADFT(carid))
                {
                    if(strcmp(x_nr,"up",true) == 0)
                    {
                        if(IsValidObject(rampdn))
                        {
                            DestroyObject(rampdn);
                            SetPVarInt(playerid, "RampDown", 0);
                        }
                        if(!IsValidObject(rampup))
                        {
                            rampup = CreateObject(18756,0,0,-1000,0,0,0,100);
                            SetPVarInt(playerid, "RampUp", rampup);
                        }
                        AttachObjectToVehicle(rampup, carid, 0.524999,-2.700001,1.650000,-269.999877,0.000000,89.099983);
                        format(string, sizeof(string), "* %s a ridicat rampa.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
                    else if(strcmp(x_nr,"down",true) == 0)
                    {
                        if(IsValidObject(rampup))
                        {
                            DestroyObject(rampup);
                            SetPVarInt(playerid, "RampUp", 0);
                        }
                        if(!IsValidObject(rampdn))
                        {
                            rampdn = CreateObject(18756,0,0,-1000,0,0,0,100);
                            SetPVarInt(playerid, "RampDown", rampdn);
                        }
                        AttachObjectToVehicle(rampdn, carid, 0.450000,-8.324991,0.075000,-35.100002,269.999877,178.199890);
                        format(string, sizeof(string), "* %s a lasat rampa.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
Thank you,it worked,REP +