[HELP] /lock
#1

Yo, I just found a lock command for vehicles:

Код:
if(strcmp(cmdtext, "/lock", true)==0)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
		    new State;
		   	State = GetPlayerState(playerid);
			if(State! = PLAYER_STATE_DRIVER)
			{
				SendClientMessage(playerid,COLOR_GREY,"You can only lock the doors as the driver.");
				return 1;
			}
			new i;
			new Float:pX, Float:pY, Float:pZ;
			for(i=0;i<MAX_PLAYERS;i++)
			{
				if(i != playerid)
				{
					SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
				}
			}
			format(string, sizeof(string), "~r~Locked");
			GameTextForPlayer(playerid, string, 3000, 5);
		  	GetPlayerPos(playerid,pX,pY,pZ);
			PlayerPlaySound(playerid,1056,pX,pY,pZ);

		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "You're not in a vehicle!");
		}
		return 1;
	}
And I just get this error:

Код:
expected token: ")", but found "!"
Thanks for the help
Reply
#2

pawn Код:
if(strcmp(cmdtext, "/lock", true)==0)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerState(playerid) = PLAYER_STATE_DRIVER)
        {
            new Float:pX, Float:pY, Float:pZ;
            for(new i = 0;i<MAX_PLAYERS;i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(i != playerid)
                    {
                        SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
                    }
                }
            }
            format(string, sizeof(string), "~r~Locked");
            GameTextForPlayer(playerid, string, 3000, 5);
            GetPlayerPos(playerid,pX,pY,pZ);
            PlayerPlaySound(playerid,1056,pX,pY,pZ);
        }
        else
        {
            SendClientMessage(playerid,COLOR_GREY,"You can only lock the doors as the driver.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You're not in a vehicle!");
    }
    return 1;
}
But I suggest you to use something else, this cmd is s***s, I mean make other way how you lock the cars.

You will also need a global thing what will lock car for new players who connect
Reply
#3

Код:
if(State! = PLAYER_STATE_DRIVER)
should become


Код:
if(State != PLAYER_STATE_DRIVER)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)