Saving Vehicles To Certain Players
#1

i once seen a topic on here showing you how to save a vehicle to a name so only a certain player with that name could drive that car, however, i have searched and searched and i cannot seem to find that topic anywhere anymore, could someone please send me the topic or tell me how to do it?
Reply
#2

here

at the top with the news
Код:
/////////////////////////////////////////////PERCARSNEWS/////////////////////////
new dlegend;
/////////////////////////////////////////////END///////////////////////////////////
under ongamemodeinit
Код:
//=======================================================PERSOCARS=======================================
change to the id and location of you ride or other peoples	(dlegend = AddStaticVehicle(425,2528.4709,-1677.3651,20.5001,91.9561,0,0);// dlegends personal hunter)
//=================================================================ENDOFPERCARS=============================
place this at the bottom ov your script but change to wat u want and the names
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  new PlayerName[24];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

  if(newstate == PLAYER_STATE_DRIVER)
  {
   new Vehicle = GetPlayerVehicleID(playerid);
   if(Vehicle == dlegend)
   {
     if(strcmp(PlayerName,"dlegend",true))
     {
      RemovePlayerFromVehicle(playerid);
      SendClientMessage(playerid, 0xFB0000FF, "I'm sorry, but this car has been reserved for dlegend");
     }
   }

 }
  return 1;
}
to add more do if(newstate == PLAYER_STATE_DRIVER)
{
new Vehicle = GetPlayerVehicleID(playerid);
if(Vehicle == dlegend)
{
if(strcmp(PlayerName,"dlegend",true))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0xFB0000FF, "I'm sorry, but this car has been reserved for dlegend");
}
}place this here above fo example
Код:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  new PlayerName[24];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

  if(newstate == PLAYER_STATE_DRIVER)
  {
   new Vehicle = GetPlayerVehicleID(playerid);
   if(Vehicle == dlegend)
   {
     if(strcmp(PlayerName,"dlegend",true))
     {
      RemovePlayerFromVehicle(playerid);
      SendClientMessage(playerid, 0xFB0000FF, "I'm sorry, but this car has been reserved for dlegend");
     }
   }
  if(newstate == PLAYER_STATE_DRIVER)
  {
   new Vehicle = GetPlayerVehicleID(playerid);
   if(Vehicle == dlegend)
   {
     if(strcmp(PlayerName,"dlegend",true))
     {
      RemovePlayerFromVehicle(playerid);
      SendClientMessage(playerid, 0xFB0000FF, "I'm sorry, but this car has been reserved for dlegend");
     }
   }
 }
  return 1;
like so but remeber to add the news for that name and to change it so it matches the fucntion any problems get back to me
Reply
#3

o.o thx dlegend helped solve my problem now i can has a supur kewl car spawned and ppl kant have
Reply
#4

np glad to help
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)