SA-MP Forums Archive
Saving Vehicles To Certain Players - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Saving Vehicles To Certain Players (/showthread.php?tid=108812)



Saving Vehicles To Certain Players - Ritchie999 - 15.11.2009

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?


Re: Saving Vehicles To Certain Players - [HKS]dlegend - 16.11.2009

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



Re: Saving Vehicles To Certain Players - DiddyBop - 16.11.2009

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


Re: Saving Vehicles To Certain Players - [HKS]dlegend - 16.11.2009

np glad to help