/lock command help
#4

Try this
pawn Код:
native IsValidVehicle(vehicleid);//under includes on top of script THIS IS IMPORTANT


COMMAND:lk(playerid, params[])
{
    return cmd_lock(playerid, params);
}
COMMAND:lock(playerid, params[])
{
    if (PlayerInfo[playerid][pSpawn] == 1)
    {
        new PlayersInVehicle, string[256];

        if (!IsPlayerInAnyVehicle(playerid))
        {
           new VehicleId = PlayerInfo[playerid][pCar];
           if(!IsValidVehicle(VehicleId))return SendClientMessage(playerid, COLOR_ERROR, "You dont own any vehicle");

           for (new i = 0; i < GetMaxPlayers(); i++)
            {
                if (IsPlayerConnected(i))
                {
                    if (i != playerid)
                    {
                        if (IsPlayerInVehicle(i,VehicleId))
                        {
                            PlayersInVehicle ++;
                        }
                    }
                }
            }

            if (CarInfo[VehicleId][cLock] == 1)
            {
                SendClientMessage(playerid, COLOR_ERROR, "The Alarm is Already Activated on this Vehicle.");
                return 1;
            }

            PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
            SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, "You have Activated the Alarm System for this Vehicle.");
            GameTextForPlayer(playerid,"~w~Alarm Activated",5000,3);
            CarInfo[VehicleId][cOwned] = playerid;
            CarInfo[VehicleId][cLock] = 1;
            PlayerInfo[playerid][pCar] = VehicleId;
            format(string, sizeof(string), "%s",PlayerInfo[playerid][pName]);
            strmid(CarInfo[CurrentVehicleId][cOwner], string, 0, strlen(string), 256);


        }
        else
        {
            SendClientMessage(playerid, COLOR_ERROR, "You Cannot Activate the Alarm from Inside the Vehicle.");
        }

    }else{
        SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead.");
    }

    return 1;
}
And you can simply do PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0); you don't need to declare variable like XYZ and then put in the function as its parameter
Reply


Messages In This Thread
/lock command help - by danish007 - 03.02.2015, 13:19
Re: /lock command help - by Lidor124 - 03.02.2015, 14:07
Re: /lock command help - by danish007 - 03.02.2015, 14:32
Re: /lock command help - by BroZeus - 03.02.2015, 15:03

Forum Jump:


Users browsing this thread: 2 Guest(s)