SA-MP Forums Archive
To make one command - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: To make one command (/showthread.php?tid=209967)



To make one command - Roma555 - 11.01.2011

How to make one command discovery cowl closing?


Код:
if (strcmp("/bonneton", cmdtext, true, 10) == 0)
	{
        GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
       	SetVehicleParamsEx(carid,engine,lights,alarm,doors,true,boot,objective);
		return 1;
	}
Код:
if (strcmp("/bonnetoff", cmdtext, true, 10) == 0)
	{
        GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
       	SetVehicleParamsEx(carid,engine,lights,alarm,doors,false,boot,objective);
		return 1;
	}
Here so:
/boonect - to open/close


Re: To make one command - Haydz - 11.01.2011

You will need to create a variable.

pawn Код:
new bonnetvar[MAX_PLAYERS]; //top of the script
if (strcmp("/bonnet", cmdtext, true, 10) == 0)
{
       if(bonnetvar[playerid] == 0)
       {
              GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
              SetVehicleParamsEx(carid,engine,lights,alarm,doors,false,boot,objective);
              bonnetvar[playerid] = 1;
       }
       else
       {
                GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(carid,engine,lights,alarm,doors,false,boot,objective);
                bonnetvar[playerid] = 0;
       }
       return 1;
}
Something like that should hopefully work, if i did something wrong you could work it out with this thread https://sampforum.blast.hk/showthread.php?tid=189464


Re: To make one command - Roma555 - 11.01.2011

And so it is possible?
Код:
if (strcmp("/bonnet", cmdtext, true, 10) == 0)
    {
        if(GetPVarInt(playerid, "bonnet") == 0)
        {
        GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
       	SetVehicleParamsEx(carid,engine,lights,alarm,doors,true,boot,objective);
        SetPVarInt(playerid, "bonnet", 1);
        }
        else if(GetPVarInt(playerid, "bonnet") == 1)
        {
        GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
       	SetVehicleParamsEx(carid,engine,lights,alarm,doors,false,boot,objective);
        SetPVarInt(playerid, "bonnet", 0);
        }
        return 1;
    }



Re: To make one command - Haydz - 11.01.2011

Yeh you can use PVars to.


Re: To make one command - Steven82 - 12.01.2011

Why would you use player varibles. It will not really bug but you may have to do the command twice for it to say open when you switch vehicles. I made mine use say

pawn Код:
new hood[MAX_VEHICLES];

hood[vehicleid] = 1;
Ofc this aint the whole code, but i hope you know what i meant.