SA-MP Forums Archive
Locked Cars Help - 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)
+--- Thread: Locked Cars Help (/showthread.php?tid=389583)



Locked Cars Help - teomakedonija - 02.11.2012

How to create this.When car locked i press enter and that say me That vehicle is Locked and get you in the prevous position.View this video http://www.youtube.com/watch?v=3DfMR...ature=********* Please !

I like this script

pawn Код:
RemovePlayerFromVehicle(playerid);
                new Float:slx, Float:sly, Float:slz;
                GetPlayerPos(playerid, slx, sly, slz);
                SetPlayerPos(playerid, slx, sly, slz);
Please help me to show me like video


AW: Locked Cars Help - Skimmer - 02.11.2012

Try under

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}



Re: Locked Cars Help - teomakedonija - 02.11.2012

Yes i like this.Becouse i want to make this i like a script when enter eject him that script in video watch it please When you try to enter immediately put it in the same place as the video


AW: Locked Cars Help - Skimmer - 02.11.2012

Do you have Car Lock System in your script ?


Re: Locked Cars Help - teomakedonija - 02.11.2012

no please give me


Re: Locked Cars Help - Lorrden - 02.11.2012

https://sampwiki.blast.hk/wiki/SetVehicleParamsForPlayer


AW: Locked Cars Help - Skimmer - 02.11.2012

Paste this top of your script

pawn Код:
new pCar[MAX_PLAYERS];
new CarLocked[MAX_VEHICLES];
Go under OnPlayerConnect(playerid) and paste this

pawn Код:
pCar[playerid] = -1;
Add this under OnPlayerDisconnect(playerid) too

pawn Код:
pCar[playerid] = -1;
Search for OnVehicleSpawn(vehicleid) and paste this:

pawn Код:
CarLocked[vehicleid] = 0;
Go to OnPlayerCommandText(playerid, cmdtext[]), add this

pawn Код:
if (strcmp("/lockcar", cmdtext, true, 10) == 0)
{
    if(pCar[playerid] == -1) return SendClientMessage(playerid, 0xFF0000FF, "You don't own any car.");
    new vehid = pCar[playerid];
    if(CarLocked[vehid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "Your car is already locked.");
    CarLocked[vehid] = 1;
    SendClientMessage(playerid, 0xFFE600FF, "You have successfully locked your car.");
    return 1;
}
if (strcmp("/unlockcar", cmdtext, true, 10) == 0)
{
    if(pCar[playerid] == -1) return SendClientMessage(playerid, 0xFF0000FF, "You don't own any car.");
    new vehid = pCar[playerid];
    if(CarLocked[vehid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "Your car is already unlocked.");
    CarLocked[vehid] = 0;
    SendClientMessage(playerid, 0xFFE600FF, "You have successfully unlocked your car.");
    return 1;
}
Search for OnPlayerStateChange(playerid, newstate, oldstate) and add this

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
    pCar[playerid] = GetPlayerVehicleID(playerid);
}
Last time paste this code under OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)

pawn Код:
if(CarLocked[vehicleid] == 1)
{
    SendClientMessage(playerid, 0xFF8C00FF, "This car is locked. You cannot drive it.");
    ClearAnimations(playerid);
}



Re: AW: Locked Cars Help - Lorrden - 02.11.2012

Quote:
Originally Posted by MouseBreaker
Посмотреть сообщение
Paste this top of your script

pawn Код:
new pCar[MAX_PLAYERS];
new CarLocked[MAX_VEHICLES];
Go under OnPlayerConnect(playerid) and paste this

pawn Код:
pCar[playerid] = -1;
Add this under OnPlayerDisconnect(playerid) too

pawn Код:
pCar[playerid] = -1;
Search for OnVehicleSpawn(vehicleid) and paste this:

pawn Код:
CarLocked[vehicleid] = 0;
Go to OnPlayerCommandText(playerid, cmdtext[]), add this

pawn Код:
if (strcmp("/lockcar", cmdtext, true, 10) == 0)
{
    if(pCar[playerid] == -1) return SendClientMessage(playerid, 0xFF0000FF, "You don't own any car.");
    new vehid = pCar[playerid];
    if(CarLocked[vehid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "Your car is already locked.");
    CarLocked[vehid] = 1;
    SendClientMessage(playerid, 0xFFE600FF, "You have successfully locked your car.");
    return 1;
}
if (strcmp("/unlockcar", cmdtext, true, 10) == 0)
{
    if(pCar[playerid] == -1) return SendClientMessage(playerid, 0xFF0000FF, "You don't own any car.");
    new vehid = pCar[playerid];
    if(CarLocked[vehid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "Your car is already unlocked.");
    CarLocked[vehid] = 0;
    SendClientMessage(playerid, 0xFFE600FF, "You have successfully unlocked your car.");
    return 1;
}
Search for OnPlayerStateChange(playerid, newstate, oldstate) and add this

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
    pCar[playerid] = GetPlayerVehicleID(playerid);
}
Last time paste this code under OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)

pawn Код:
if(CarLocked[vehicleid] == 1)
{
    SendClientMessage(playerid, 0xFF8C00FF, "This car is locked. You cannot drive it.");
    ClearAnimations(playerid);
}
That's just dumb when you've got:

pawn Код:
SetVehicleParamsForPlayer(vehicleid, playerid, objective, doorslocked);



AW: Locked Cars Help - Skimmer - 02.11.2012

He wants like this on the video. See it first.


Re: Locked Cars Help - Lorrden - 02.11.2012

Sorry, didn't watch it, only read that he wanted a lock system..
But alright, if that's what he really wants, I can't really understand why though.
Looks like shit :P