How to lock a car for everyone when a specific player is offline...
#1

Hey...

How can i lock a car for everyone when a player with name:

Peter_Johnson

is offline...

And if: Peter_Johnson is online, it gets locked for everyone except him

Thanks :P
Reply
#2

Ok first the vehicle must be created, and identified as Peter_Johnsons vehicle.

So at the top of the gamemode..

pawn Код:
new PetersCar;
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)