Personal Car
#1

Hi ! First sorry for my English . PLease , someone help me with a little problem . I want to add personal cars in my gamemode 0.3c . I tried with new variable; and with car id but both doesn't work . Please help me !
Reply
#2

this at the top:
pawn Код:
new pcar;
at OnGameModeInit:
pawn Код:
pcar = AddStaticVehicle(............);
at "OnPlayerStateChange"
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
  new pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  new v = GetPlayerVehicleID(playerid);
  if(v == pcar)
  {
    if(!strcmp(name, "OwnerName", true))
    {
      SendClientMessage(playerid, 0x999999AA, "Welcome to your private vehicle!");
    }
    else
    {
      SendClientMessage(playerid, 0x999999AA, "This vehicle belongs to OwnerName!");
      RemovePlayerFromVehicle(playerid);
    }
  }
  return 1;
}
Reply
#3

Thank you ! but :
Код:
H:\Global\gamemodes\petru.pwn(6852) : error 017: undefined symbol "name"
Reply
#4

oh sorry..
use this:;
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
  new pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  new v = GetPlayerVehicleID(playerid);
  if(v == pcar)
  {
    if(!strcmp(pname, "OwnerName", true))
    {
      SendClientMessage(playerid, 0x999999AA, "Welcome to your private vehicle!");
    }
    else
    {
      SendClientMessage(playerid, 0x999999AA, "This vehicle belongs to OwnerName!");
      RemovePlayerFromVehicle(playerid);
    }
  }
  return 1;
}
Reply
#5

Thank you but another error . When I try to enter in my car doesn't work . Why ?
Reply
#6

did you change
if(!strcmp(pname, "OwnerName", true))
to accompany your name
Reply
#7

have you changed the name to your name?
and added a unique variable for your vehicle?

(in this way you need 1 variable for each private vehicle)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)