SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 01/06/2012, 03:51 PM   #1
Geniuss
Big Clucker
 
Join Date: May 2012
Posts: 82
Reputation: 2
Default /lock Command dont work..

Hey!

Well i have been creating a lock command for when you are near your 1st, 2nd or 3rd car and you do /lock it unlocks it but it never works i have tried everything to try and make this work but it just wont

Would appreciate it if someone could help me

Thanks

pawn Code:
command(lock, playerid, params[])
{
    #pragma unused params
    new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
    if(Player[playerid][PlayerCarModel] > 0)
    {
        if(IsPlayerInRangeOfVehicle(playerid, Player[playerid][CarLinkID], 10))
        {
            if(Player[playerid][CarLinkID] > 0)
                {
                    if(Player[playerid][LockedCar] == 0)
                        {
                            Player[playerid][LockedCar] = 1;
                            format(string, sizeof(string), "%s has locked their vehicle");
                            NearByMessage(playerid, PURPLE, string);

                            for(new i = 0; i < MAX_PLAYERS; i++)
                            {
                                if(i != playerid)
                                {
                                    GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                                    SetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, 1, bonnet, boot, 0);
                                }
                            }
                            return 1;
                        }
                        else
                        {
                            Player[playerid][LockedCar] = 0;
                            format(string, sizeof(string),"%s has unlocked their vehicle");
                            NearByMessage(playerid, PURPLE, string);

                            for(new i = 0; i < MAX_PLAYERS; i++)
                            {
                                GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                                SetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, 0, bonnet, boot, 0);
                               
                            }
                        }
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "You do not own a car");
                }
        }
        else
        {
            SendClientMessage(playerid, WHITE, "You are not near any of your vehicles");
        }
    }
    return 1;
}

If you need more code just ask
Geniuss is offline   Reply With Quote
Old 01/06/2012, 04:17 PM   #2
Sandiel
Huge Clucker
 
Sandiel's Avatar
 
Join Date: May 2012
Location: SA-MP Forums. Pawn Level: Master. Occupation: Scripter.
Posts: 384
Reputation: 45
Default Re: /lock Command dont work..

Any error lines? and how exactly doesn't it 'work'?
Paste the error lines here, would help, if they exist..
__________________
My work:
[FS]New unique DJ Job, suitable for everyone[UPDATED]
[FS]SmartChecker System v1.3[UPDATED]
WILL CODE FOR LEAGUE OF LEGENDS SKINS.


All of the work made by SandieL is registered and fully licensed by Creative Common, this work is copyrighted
Sandiel is offline   Reply With Quote
Old 01/06/2012, 04:20 PM   #3
Geniuss
Big Clucker
 
Join Date: May 2012
Posts: 82
Reputation: 2
Default Re: /lock Command dont work..

Quote:
Originally Posted by Sandiel View Post
Any error lines? and how exactly doesn't it 'work'?
Paste the error lines here, would help, if they exist..
No error lines, Just when im in game and im in range of my second or third car, and i do /lock it dont unlock or lock them it dont even send the message..

If you need more code just ask
Geniuss is offline   Reply With Quote
Old 01/06/2012, 04:22 PM   #4
teomakedonija
Banned
 
Join Date: Nov 2011
Posts: 404
Reputation: -46
Default Re: /lock Command dont work..

if(strcmp(cmd, "/lock", true) == 0)
{
if(PlayerConnected(playerid))
#pragma unused params
new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
if(Player[playerid][PlayerCarModel] > 0)
{
if(IsPlayerInRangeOfVehicle(playerid, Player[playerid][CarLinkID], 10))
{
if(Player[playerid][CarLinkID] > 0)
{
if(Player[playerid][LockedCar] == 0)
{
Player[playerid][LockedCar] = 1;
format(string, sizeof(string), "%s has locked their vehicle");
NearByMessage(playerid, PURPLE, string);

for(new i = 0; i < MAX_PLAYERS; i++)
{
if(i != playerid)
{
GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, 1, bonnet, boot, 0);
}
}
return 1;
}
else
{
Player[playerid][LockedCar] = 0;
format(string, sizeof(string),"%s has unlocked their vehicle");
NearByMessage(playerid, PURPLE, string);

for(new i = 0; i < MAX_PLAYERS; i++)
{
GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, 0, bonnet, boot, 0);

}
}
}
else
{
SendClientMessage(playerid, WHITE, "You do not own a car");
}
}
else
{
SendClientMessage(playerid, WHITE, "You are not near any of your vehicles");
}
}
return 1;
}
teomakedonija is offline   Reply With Quote
Old 01/06/2012, 04:25 PM   #5
Sandiel
Huge Clucker
 
Sandiel's Avatar
 
Join Date: May 2012
Location: SA-MP Forums. Pawn Level: Master. Occupation: Scripter.
Posts: 384
Reputation: 45
Default Re: /lock Command dont work..

Quote:
Originally Posted by Geniuss View Post
[PAWN]

if(Player[playerid][PlayerCarModel] > 0)
if(Player[playerid][CarLinkID] > 0)
What are these? what are they supposed to represent?
__________________
My work:
[FS]New unique DJ Job, suitable for everyone[UPDATED]
[FS]SmartChecker System v1.3[UPDATED]
WILL CODE FOR LEAGUE OF LEGENDS SKINS.


All of the work made by SandieL is registered and fully licensed by Creative Common, this work is copyrighted
Sandiel is offline   Reply With Quote
Old 01/06/2012, 04:25 PM   #6
Geniuss
Big Clucker
 
Join Date: May 2012
Posts: 82
Reputation: 2
Default Re: /lock Command dont work..

Quote:
Originally Posted by teomakedonija View Post
if(strcmp(cmd, "/lock", true) == 0)
{
if(PlayerConnected(playerid))
#pragma unused params
new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
if(Player[playerid][PlayerCarModel] > 0)
{
if(IsPlayerInRangeOfVehicle(playerid, Player[playerid][CarLinkID], 10))
{
if(Player[playerid][CarLinkID] > 0)
{
if(Player[playerid][LockedCar] == 0)
{
Player[playerid][LockedCar] = 1;
format(string, sizeof(string), "%s has locked their vehicle");
NearByMessage(playerid, PURPLE, string);

for(new i = 0; i < MAX_PLAYERS; i++)
{
if(i != playerid)
{
GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, 1, bonnet, boot, 0);
}
}
return 1;
}
else
{
Player[playerid][LockedCar] = 0;
format(string, sizeof(string),"%s has unlocked their vehicle");
NearByMessage(playerid, PURPLE, string);

for(new i = 0; i < MAX_PLAYERS; i++)
{
GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, 0, bonnet, boot, 0);

}
}
}
else
{
SendClientMessage(playerid, WHITE, "You do not own a car");
}
}
else
{
SendClientMessage(playerid, WHITE, "You are not near any of your vehicles");
}
}
return 1;
}
That is pretty much all i have got at the minute, You pretty much just copied and pasted my script, Im asking how could i make it so when im near car 2 and i do /lock it locks/unlocks it or when im near car 3...
Geniuss is offline   Reply With Quote
Old 01/06/2012, 04:29 PM   #7
Geniuss
Big Clucker
 
Join Date: May 2012
Posts: 82
Reputation: 2
Default Re: /lock Command dont work..

Quote:
Originally Posted by Sandiel View Post
What are these? what are they supposed to represent?

The carmodelid and the car linked to it i think.. Here is my code for when i buy a cr

pawn Code:
public PurchaseCar(playerid, carid, price, slotid)
{
    new string[128];
    if(carid < 400 || carid > 611)
    {
        SendClientMessage(playerid, WHITE, "Valid car IDs start from 400, ending at 611.");
        return 1;
    }
    else
    {
        if(Player[playerid][Money] >= price)
        {
            switch(slotid)
            {
                case 1:
                {
                    if(Player[playerid][PlayerCarModel] > 0)
                    {
                        SendClientMessage(playerid, WHITE, "You already have a vehicle in slot 1, /abandoncar first.");
                    }
                    else
                    {
                        Player[playerid][OwnedCarModSlot0] = 0;
                        Player[playerid][OwnedCarModSlot1] = 0;
                        Player[playerid][OwnedCarModSlot2] = 0;
                        Player[playerid][OwnedCarModSlot3] = 0;
                        Player[playerid][OwnedCarModSlot4] = 0;
                        Player[playerid][OwnedCarModSlot5] = 0;
                        Player[playerid][OwnedCarModSlot6] = 0;
                        Player[playerid][OwnedCarModSlot7] = 0;
                        Player[playerid][OwnedCarModSlot8] = 0;
                        Player[playerid][OwnedCarModSlot9] = 0;
                        Player[playerid][OwnedCarModSlot10] = 0;
                        Player[playerid][OwnedCarModSlot11] = 0;
                        Player[playerid][OwnedCarModSlot12] = 0;
                        Player[playerid][OwnedCarModSlot13] = 0;

                        Player[playerid][Money] -= price;
                        Player[playerid][CarX] = OwnedCarSpawnX;
                        Player[playerid][CarY] = OwnedCarSpawnY;
                        Player[playerid][CarZ] = OwnedCarSpawnZ;
                        Player[playerid][PlayerCarModel] = carid;
                        Player[playerid][CarCol1] = 0;
                        Player[playerid][CarCol2] = 0;
                        SpawnOwnedCar(playerid, 1);
                        SavePlayerData(playerid);
                    }
                }
                case 2:
                {
                    if(Player[playerid][PlayerCarModel2] > 0)
                    {
                        SendClientMessage(playerid, WHITE, "You already have a vehicle in slot 2, /abandoncar first.");
                    }
                    else
                    {
                        Player[playerid][Car2OwnedCarModSlot0] = 0;
                        Player[playerid][Car2OwnedCarModSlot1] = 0;
                        Player[playerid][Car2OwnedCarModSlot2] = 0;
                        Player[playerid][Car2OwnedCarModSlot3] = 0;
                        Player[playerid][Car2OwnedCarModSlot4] = 0;
                        Player[playerid][Car2OwnedCarModSlot5] = 0;
                        Player[playerid][Car2OwnedCarModSlot6] = 0;
                        Player[playerid][Car2OwnedCarModSlot7] = 0;
                        Player[playerid][Car2OwnedCarModSlot8] = 0;
                        Player[playerid][Car2OwnedCarModSlot9] = 0;
                        Player[playerid][Car2OwnedCarModSlot10] = 0;
                        Player[playerid][Car2OwnedCarModSlot11] = 0;
                        Player[playerid][Car2OwnedCarModSlot12] = 0;
                        Player[playerid][Car2OwnedCarModSlot13] = 0;

                        Player[playerid][Money] -= price;
                        Player[playerid][Car2X] = OwnedCarSpawnX;
                        Player[playerid][Car2Y] = OwnedCarSpawnY;
                        Player[playerid][Car2Z] = OwnedCarSpawnZ;
                        Player[playerid][PlayerCarModel2] = carid;
                        Player[playerid][Car2Col1] = 0;
                        Player[playerid][Car2Col2] = 0;
                        SpawnOwnedCar(playerid, 2);
                        SavePlayerData(playerid);
                    }
                }
                case 3:
                {
                    if(Player[playerid][PlayerCarModel3] > 0)
                    {
                        SendClientMessage(playerid, WHITE, "You already have a vehicle in slot 3, /abandoncar first.");
                    }
                    else
                    {
                        Player[playerid][Car3OwnedCarModSlot0] = 0;
                        Player[playerid][Car3OwnedCarModSlot1] = 0;
                        Player[playerid][Car3OwnedCarModSlot2] = 0;
                        Player[playerid][Car3OwnedCarModSlot3] = 0;
                        Player[playerid][Car3OwnedCarModSlot4] = 0;
                        Player[playerid][Car3OwnedCarModSlot5] = 0;
                        Player[playerid][Car3OwnedCarModSlot6] = 0;
                        Player[playerid][Car3OwnedCarModSlot7] = 0;
                        Player[playerid][Car3OwnedCarModSlot8] = 0;
                        Player[playerid][Car3OwnedCarModSlot9] = 0;
                        Player[playerid][Car3OwnedCarModSlot10] = 0;
                        Player[playerid][Car3OwnedCarModSlot11] = 0;
                        Player[playerid][Car3OwnedCarModSlot12] = 0;
                        Player[playerid][Car3OwnedCarModSlot13] = 0;

                        Player[playerid][Money] -= price;
                        Player[playerid][Car3X] = OwnedCarSpawnX;
                        Player[playerid][Car3Y] = OwnedCarSpawnY;
                        Player[playerid][Car3Z] = OwnedCarSpawnZ;
                        Player[playerid][PlayerCarModel3] = carid;
                        Player[playerid][Car3Col1] = 0;
                        Player[playerid][Car3Col2] = 0;
                        SpawnOwnedCar(playerid, 3);
                        SavePlayerData(playerid);
                    }
                }
            }
        }
        else
        {
            format(string, sizeof(string), "You must have $%d to purchase this vehicle.", price);
            SendClientMessage(playerid, WHITE, string);
        }
    }
    return 1;
}


pawn Code:
stock SpawnOwnedCar(playerid, slotid)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    if(IsPlayerConnectedEx(playerid))
    {
        switch(slotid)
        {
            case 1:
            {
                if(Player[playerid][PlayerCarModel] >= 1)
                {
                    if(Player[playerid][CarLinkID] >= 1)
                    {
                        DestroyVehicle(Player[playerid][CarLinkID]);
                        Player[playerid][CarLinkID] = 0;
                    }

                    CarCount++;
                    OwnedCarCount++;
                    Player[playerid][CarLinkID] = CreateVehicle(Player[playerid][PlayerCarModel], Player[playerid][CarX], Player[playerid][CarY], Player[playerid][CarZ], Player[playerid][CarZAngle], Player[playerid][CarCol1], Player[playerid][CarCol2], -1);
                    GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                    SetVehicleParamsEx(Player[playerid][CarLinkID], 0, lights, alarm, 1, bonnet, boot, objective);
                    SendClientMessage(playerid, WHITE, "Your first owned vehicle has been spawned. If you can't find it, please use the /callcar command.");

                    if(GetVehicleModel(Player[playerid][CarLinkID]) != Player[playerid][PlayerCarModel])
                    {
                        DestroyVehicle(Player[playerid][CarLinkID]);
                        Player[playerid][CarLinkID] = 0;
                        Player[playerid][CarLinkID] = CreateVehicle(Player[playerid][PlayerCarModel], Player[playerid][CarX], Player[playerid][CarY], Player[playerid][CarZ], Player[playerid][CarZAngle], Player[playerid][CarCol1], Player[playerid][CarCol2], -1);
                    }

                    ChangeVehiclePaintjob(Player[playerid][CarLinkID], Player[playerid][CarPaintJobID]);

                    if(Player[playerid][OwnedCarModSlot0] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot0]);
                    }

                    if(Player[playerid][OwnedCarModSlot1] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot1]);
                    }

                    if(Player[playerid][OwnedCarModSlot2] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot2]);
                    }

                    if(Player[playerid][OwnedCarModSlot3] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot3]);
                    }

                    if(Player[playerid][OwnedCarModSlot4] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot4]);
                    }

                    if(Player[playerid][OwnedCarModSlot5] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot5]);
                    }

                    if(Player[playerid][OwnedCarModSlot6] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot6]);
                    }

                    if(Player[playerid][OwnedCarModSlot7] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot7]);
                    }

                    if(Player[playerid][OwnedCarModSlot9] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot9]);
                    }

                    if(Player[playerid][OwnedCarModSlot10] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot10]);
                    }

                    if(Player[playerid][OwnedCarModSlot11] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot11]);
                    }

                    if(Player[playerid][OwnedCarModSlot12] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot12]);
                    }

                    if(Player[playerid][OwnedCarModSlot13] > 0)
                    {
                        AddVehicleComponent(Player[playerid][CarLinkID], Player[playerid][OwnedCarModSlot13]);
                    }
                }
            }
            case 2:
            {
                if(Player[playerid][PlayerCarModel2] >= 1)
                {
                    if(Player[playerid][Car2LinkID] >= 1)
                    {
                        DestroyVehicle(Player[playerid][Car2LinkID]);
                        Player[playerid][Car2LinkID] = 0;
                    }

                    CarCount++;
                    OwnedCarCount++;
                    Player[playerid][Car2LinkID] = CreateVehicle(Player[playerid][PlayerCarModel2], Player[playerid][Car2X], Player[playerid][Car2Y], Player[playerid][Car2Z], Player[playerid][Car2ZAngle], Player[playerid][Car2Col1], Player[playerid][Car2Col2], -1);
                    GetVehicleParamsEx(Player[playerid][Car2LinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                    SetVehicleParamsEx(Player[playerid][Car2LinkID], 0, lights, alarm, 1, bonnet, boot, objective);
                    SendClientMessage(playerid, WHITE, "Your second owned vehicle has been spawned. If you can't find it, please use the /callcar command.");

                    if(GetVehicleModel(Player[playerid][Car2LinkID]) != Player[playerid][PlayerCarModel2])
                    {
                        DestroyVehicle(Player[playerid][Car2LinkID]);
                        Player[playerid][Car2LinkID] = 0;
                        Player[playerid][Car2LinkID] = CreateVehicle(Player[playerid][PlayerCarModel2], Player[playerid][Car2X], Player[playerid][Car2Y], Player[playerid][Car2Z], Player[playerid][Car2ZAngle], Player[playerid][Car2Col1], Player[playerid][Car2Col2], -1);
                    }

                    ChangeVehiclePaintjob(Player[playerid][Car2LinkID], Player[playerid][Car2PaintJobID]);

                    if(Player[playerid][Car2OwnedCarModSlot0] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot0]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot1] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot1]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot2] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot2]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot3] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot3]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot4] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot4]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot5] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot5]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot6] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot6]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot7] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot7]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot9] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot9]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot10] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot10]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot11] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot11]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot12] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot12]);
                    }

                    if(Player[playerid][Car2OwnedCarModSlot13] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car2LinkID], Player[playerid][Car2OwnedCarModSlot13]);
                    }
                }
            }
            case 3:
            {
                if(Player[playerid][PlayerCarModel3] >= 1)
                {
                    CarCount++;
                    OwnedCarCount++;
                    Player[playerid][Car3LinkID] = CreateVehicle(Player[playerid][PlayerCarModel3], Player[playerid][Car3X], Player[playerid][Car3Y], Player[playerid][Car3Z], Player[playerid][Car3ZAngle], Player[playerid][Car3Col1], Player[playerid][Car3Col2], -1);
                    GetVehicleParamsEx(Player[playerid][Car3LinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                    SetVehicleParamsEx(Player[playerid][Car3LinkID], 0, lights, alarm, 1, bonnet, boot, objective);
                    SendClientMessage(playerid, WHITE, "Your third owned vehicle has been spawned. If you can't find it, please use the /callcar command.");

                    if(GetVehicleModel(Player[playerid][Car3LinkID]) != Player[playerid][PlayerCarModel3])
                    {
                        DestroyVehicle(Player[playerid][Car3LinkID]);
                        Player[playerid][Car3LinkID] = 0;
                        Player[playerid][Car3LinkID] = CreateVehicle(Player[playerid][PlayerCarModel3], Player[playerid][Car3X], Player[playerid][Car3Y], Player[playerid][Car3Z], Player[playerid][Car3ZAngle], Player[playerid][Car3Col1], Player[playerid][Car3Col2], -1);
                    }

                    ChangeVehiclePaintjob(Player[playerid][Car3LinkID], Player[playerid][Car3PaintJobID]);

                    if(Player[playerid][Car3OwnedCarModSlot0] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot0]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot1] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot1]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot2] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot2]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot3] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot3]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot4] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot4]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot5] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot5]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot6] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot6]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot7] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot7]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot9] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot9]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot10] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot10]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot11] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot11]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot12] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot12]);
                    }

                    if(Player[playerid][Car3OwnedCarModSlot13] > 0)
                    {
                        AddVehicleComponent(Player[playerid][Car3LinkID], Player[playerid][Car3OwnedCarModSlot13]);
                    }
                }
            }
        }
    }
}
Geniuss is offline   Reply With Quote
Old 01/06/2012, 04:54 PM   #8
Geniuss
Big Clucker
 
Join Date: May 2012
Posts: 82
Reputation: 2
Default Re: /lock Command dont work..

Can any one help
Geniuss is offline   Reply With Quote
Old 01/06/2012, 06:14 PM   #9
Geniuss
Big Clucker
 
Join Date: May 2012
Posts: 82
Reputation: 2
Default Re: /lock Command dont work..

I made this command to check if i was near my second car it would say a message.. Where would i put this in the lock command to make it say it if im near the second vehicle if i type /lock

Command

pawn Code:
command(lol, playerid, params[])
{
    #pragma unused params
    if(Player[playerid][PlayerCarModel2] > 0)
    {
        if(IsPlayerInRangeOfVehicle(playerid, Player[playerid][Car2LinkID], 10))
        {
            if(Player[playerid][Car2LinkID] > 0)
                {
                    SendClientMessage(playerid, WHITE, "Yes you are near your vehicle");
                }
        }
    }
}

pawn Code:
command(lock, playerid, params[])
{
    #pragma unused params
    new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
    if(Player[playerid][PlayerCarModel] > 0)
    {
        if(IsPlayerInRangeOfVehicle(playerid, Player[playerid][CarLinkID], 10))
        {
            if(Player[playerid][CarLinkID] > 0)
                {
                    if(Player[playerid][LockedCar] == 0)
                        {
                            Player[playerid][LockedCar] = 1;
                            format(string, sizeof(string), "%s has locked their vehicle", GetName(playerid));
                            NearByMessage(playerid, PURPLE, string);

                            for(new i = 0; i < MAX_PLAYERS; i++)
                            {
                                if(i != playerid)
                                {
                                    GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                                    SetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, 1, bonnet, boot, 0);
                                }
                            }
                            return 1;
                        }
                        else
                        {
                            Player[playerid][LockedCar] = 0;
                            format(string, sizeof(string),"%s has unlocked their vehicle", GetName(playerid));
                            NearByMessage(playerid, PURPLE, string);

                            for(new i = 0; i < MAX_PLAYERS; i++)
                            {
                                GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                                SetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, 0, bonnet, boot, 0);
                               
                            }
                        }
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "You do not own a car");
                }
        }
        else
        {
            SendClientMessage(playerid, WHITE, "You are not near any of your vehicles");
        }
    }
    return 1;
}

If you help me i will appreciate it
Geniuss is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lock Command Doesnt Work? Nuke547 Scripting Help 1 29/01/2012 05:50 AM
Why my command dont work? Admigo Scripting Help 6 07/11/2011 07:17 PM
why this command dont work? Admigo Scripting Help 5 01/11/2011 05:08 PM
Why the command /lock dont work? _ERO_ Help Archive 1 03/01/2010 06:56 PM
why dont my fight command work? [mad]MLK Help Archive 18 10/09/2009 12:53 PM


All times are GMT. The time now is 10:31 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.