SA-MP Forums Archive
private cars question - 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)
+--- Thread: private cars question (/showthread.php?tid=451366)



private cars question - Nines - 16.07.2013

Alright so i got private cars code. Name1 works fine, but in Name2 anyone can drive the car and no client message shows..... this is the code-.. no errors

Код:
	if(newstate == PLAYER_STATE_DRIVER)
{
  new pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  new v = GetPlayerVehicleID(playerid);
  if(v == name1car)
  {
    if(!strcmp(pname, "Name1", true))
    {
      SendClientMessage(playerid, COLOR_RED, "Welcome to your car");
    }
    else
    {
      SendClientMessage(playerid, COLOR_RED, "This car is private.");
      RemovePlayerFromVehicle(playerid);
    }
  }
  return 1;
  }
    if(newstate == PLAYER_STATE_DRIVER)
{
  new pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  new v = GetPlayerVehicleID(playerid);
  if(v == Name2)
  {
    if(!strcmp(pname, "Name2", true))
    {
      SendClientMessage(playerid, COLOR_RED, "Yo welcome to your car");
    }
    else
    {
      SendClientMessage(playerid, COLOR_RED, "Car is private");
      RemovePlayerFromVehicle(playerid);
    }
  }
  return 1;
}



Re: private cars question - Nines - 16.07.2013

help?


Re: private cars question - Jefff - 16.07.2013

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    new v = GetPlayerVehicleID(playerid);
    if(v == name1car || v == Name2)
    {
        if(!strcmp(pname, "Name1", true) || !strcmp(pname, "Name2", true))
        {
            SendClientMessage(playerid, COLOR_RED, "Welcome to your car");
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "This car is private.");
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}



Re: private cars question - Nines - 16.07.2013

Its 2 seperate cars though, not one jefff


Re: private cars question - Nines - 17.07.2013

bump


Re: private cars question - Aerotactics - 17.07.2013

I'm not sure, sorry, but I hope this bump gets you some help.


Re: private cars question - Nines - 18.07.2013

please guys lol really need help


Re: private cars question - DobbysGamertag - 18.07.2013

Try: http://codegenerators.pl/privateVehicle

Its a useful website.


Re: private cars question - Nines - 18.07.2013

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
Try: http://codegenerators.pl/privateVehicle

Its a useful website.
My code should work fine though, Name1 works but anyone can drive name2's car, why?


Re: private cars question - Nines - 21.07.2013

bumpp