16.06.2009, 22:05
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.
Under OnPlayerSpawn add this..
LockedVehicles();
now anywhere in the script, outside of any callback.
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.
So at the top of the gamemode..
pawn Код:
new PetersCar;
pawn Код:
PetersCar = AddStaticVehicle(model, x, y, z, Zangle, colour1, colour2);//Peters car
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
}
}
}
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.