Ok first the vehicle must be created, and identified as Peter_Johnsons vehicle.
So at the top of the gamemode..
and with all the rest of the vehicles you have created.
pawn Код:
PetersCar = AddStaticVehicle(model, x, y, z, Zangle, colour1, colour2);//Peters car
Under OnPlayerSpawn add this..
LockedVehicles();
now anywhere in the script, outside of any callback.
pawn Код:
stock LockedVehicles()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
new plname[32];
GetPlayerName(i, plname, 32);
if(strcmp(plname, "Peter_Johnson", true)==0)
{
SetVehicleParamsForPlayer(PetersCar, i, 0, 0);//unlocked for Peter_Johnson
}
else
{
SetVehicleParamsForPlayer(PetersCar, i, 0, 1);//locked if the players name isnt Peter_Johnson
}
}
}
Theres a simple way of doing it.
But if you are wanting to have it so the player actually buys the vehicle, then its locked for them only, thats possible too. It would just take quite a bit more work.