To make one command
#1

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
Reply
#2

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
Reply
#3

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;
    }
Reply
#4

Yeh you can use PVars to.
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)