SA-MP Forums Archive
Someone help please - 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: Someone help please (/showthread.php?tid=127090)



Someone help please - RoneyRemington - 11.02.2010

i tried a [FS] earlier witch would let only a play with a certian name enter a car. it didnt work because it gave me errors and i cldnt seem to fix them.

can someone PLEASE give me a link to one because ii cant find one and this will finish my server

thanks,

Roney



Re: Someone help please - Grim_ - 11.02.2010

Something like this:
pawn Код:
//top of script
new car;

//OnGameModeInit
car = CreateVehicle(..); // or AddStaticVehicle

//OnPlayerEnterVehicle
if(vehicleid == car)
{
  new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, sizeof name);
  if(strcmp(name, "desired name here", true) != 0)
  {
   RemovePlayerFromVehicle(playerid);
  }
}
Untested.


Re: Someone help please - RoneyRemington - 11.02.2010

i will try. thank you


Re: Someone help please - RoneyRemington - 11.02.2010

ok it didnt work. i can enter other peoples cars. it doesnt give me any warning


Re: Someone help please - Grim_ - 11.02.2010

That only disallows you to enter the selected car, unless your name is whatever you put in the quotation marks.


Re: Someone help please - RoneyRemington - 11.02.2010

i know. but i made more people have this. i can enter their cars and i dont have their name




Re: Someone help please - GTAguillaume - 11.02.2010

Код:
if(strcmp(name, "desired name here", true) != 0)
Hmmm this will be called when the names are NOT the same (strcmp returns a 0 when the strings are equal):
Код:
if(!strcmp(name, "desired name here", true))
Edit: @_Xerxes_: Ohh im not good in english :d


Re: Someone help please - Grim_ - 11.02.2010

Quote:
Originally Posted by GTAguillaume
Код:
if(strcmp(name, "desired name here", true) != 0)
Hmmm this will be called when the names are NOT the same (strcmp returns a 0 when the strings are equal):
Код:
if(!strcmp(name, "desired name here", true))
I know, that's why it is "!= 0".


Re: Someone help please - RoneyRemington - 11.02.2010

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == Roney_Remington)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof name);
if(strcmp(name, "Roney_Remington", true) != 0)
{
RemovePlayerFromVehicle(playerid);
}
}


thats what i have. nd i have

new Roney_Remington;

that is at top under includes. then there is

Roney_Remington = AddStaticVehicle(463,-917.7588,2680.2612,41.9102,313.2037,86,86); // tjs bike 3

tht is under gamemodeinit


Re: Someone help please - RoneyRemington - 11.02.2010

it doesnt lock anyone out of any car

i made like 15 cars for 3 people. they can all enter eachothers cars


Re: Someone help please - RoneyRemington - 11.02.2010

someone please help me. my server will be done after this is done



Re: Someone help please - Grim_ - 11.02.2010

I forgot..

Use CreateVehicle instead of AddStaticVehicle, that should do it.