Car help.
#1

Ok. So i was told to put this into my script and it gives me 12 errors and alot of warnings. Why didnt it work?

//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);
}
}
Reply
#2

use this...
pawn Код:
new admincar;

public OnGameModeInit()
{

admincar = AddStaticVehicle(ID,x,y,z,233.9429,1,62); // Vehicle


public OnPlayerStateChange(playerid, newstate, oldstate)
{
  new PlayerName[24];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

  if(newstate == PLAYER_STATE_DRIVER)
  {
   new Vehicle = GetPlayerVehicleID(playerid);
   if(Vehicle == admincar)
   {
     if(strcmp(PlayerName,"Name Player",true))
     {
      RemovePlayerFromVehicle(playerid);
      SendClientMessage(playerid, 0x33AA33AA, "text");
     }
   }
  }
  return 1;
}
Reply
#3

ok im kinda new to scripting. what do i change?

EDIT: NVM i got pawno to accept the code. testing now
Reply
#4

ok i got pawno to accept the codes. no errors or warnings. just when im in game i can enter those cars and its not my name. im logged in rcon admin and am admin on the server. would that make a difference?
Reply
#5

if(strcmp(PlayerName,"Name Player",true))


did u change that "Name Player" for your username?
Reply
#6

ohh. duh. thanks
Reply
#7

tht didnt work. anything else? i have it completely done. no errors or warnings. how do you put in the pawno code so i can show it?
Reply
#8

Код:
   if(Vehicle == admincar)
   {
That will check only 1 car, created as admincar.. if u say u have many cars that shouldnt work for the others unless u create admincar1 admincar2, etc then check each on new state driver
Reply
#9

ok i have like 100 cars in it. i use tht command with Roney_Remington. it doesnt make all the cars witht tht name locked for someone else?
Reply
#10

and how r u checking the 100 car ids? or u are just checking 1 car id?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)