PDA

View Full Version : On Player Enter Vehicle


MadnessJohnson
08/10/2008, 05:20 PM
Ok i think iv done this b4, but forgot how, got a idea how but not entiely sure,

how cud i under OnPlayerEnterVehicle have
like if your name isnt [LSB]Johnson you get ejected from the car? I know its realy simple but completely forgot, also the name of the car is jsay ..

ty , J

Rks25
08/10/2008, 07:29 PM
new mycar;

//@Ongamemodeinit
mycar = CreateVehicle(..

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == mycar)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp(PlayerName, "[LSB]Johnson", true) == 0)
{
SendClientMessage(playerid, COLOR_COLOR,"This is your car.");
}
else
{
SendClientMessage(playerid, COLOR_COLOR, "This car is reserved for [LSB]Johnson!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}

Untested.

JoeDaDude
08/10/2008, 09:24 PM
This is actually quite simple, I would give you an code but it so happens that if i do
i will be giving away my private car script, And i will be breaking many rules.

MadnessJohnson
08/10/2008, 09:54 PM
new mycar;

//@Ongamemodeinit
mycar = CreateVehicle(..

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == mycar)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp(PlayerName, "[LSB]Johnson", true) == 0)
{
SendClientMessage(playerid, COLOR_COLOR,"This is your car.");
}
else
{
SendClientMessage(playerid, COLOR_COLOR, "This car is reserved for [LSB]Johnson!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}

Untested.


ty you for this g,

but i alredi got it from one of mi old gm's, but thankyou for your help ;)

Johnson

Erkan
08/10/2008, 10:13 PM
new mycar;

//@Ongamemodeinit
mycar = CreateVehicle(..

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == mycar)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp(PlayerName, "[LSB]Johnson", true) == 0)
{
SendClientMessage(playerid, COLOR_COLOR,"This is your car.");
}
else
{
SendClientMessage(playerid, COLOR_COLOR, "This car is reserved for [LSB]Johnson!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}

Untested.


ty you for this g,

but i alredi got it from one of mi old gm's, but thankyou for your help ;)

Johnson


Are you making this for Streetz ?

Or you make your own Server. :S

MadnessJohnson
09/10/2008, 02:38 PM
Erkan ]



new mycar;

//@Ongamemodeinit
mycar = CreateVehicle(..

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == mycar)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp(PlayerName, "[LSB]Johnson", true) == 0)
{
SendClientMessage(playerid, COLOR_COLOR,"This is your car.");
}
else
{
SendClientMessage(playerid, COLOR_COLOR, "This car is reserved for [LSB]Johnson!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}

Untested.


ty you for this g,

but i alredi got it from one of mi old gm's, but thankyou for your help ;)

Johnson


Are you making this for Streetz ?

Or you make your own Server. :S


for streetz, but fo games car ... why?

Backwardsman97
10/10/2008, 04:01 AM
This won't work I don't think. You need to have it under OnPlayerStateChange because OnPlayerEnterVehicle is called when the player hits enter near a vehicle. They could easily stop walking towards it. So they could hit enter and cancel it and receive this message. OnPlayerStateChange is only called once they are in the car and it is on.

mamorunl
10/10/2008, 07:32 AM
new mycar;

//@Ongamemodeinit
mycar = CreateVehicle(..

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == mycar)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp(PlayerName, "[LSB]Johnson", true) == 0)
{
SendClientMessage(playerid, COLOR_COLOR,"This is your car.");
}
else
{
SendClientMessage(playerid, COLOR_COLOR, "This car is reserved for [LSB]Johnson!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}

Untested.


1. pastebin
2. you cant remove a player from a vehicle if he isn't in one.
3. You are offering scripts and yourself as a scripter but you don't know this? shame on you

Cueball
10/10/2008, 07:37 AM
SpeedDevil ]
3. You are offering scripts and yourself as a scripter but you don't know this? shame on you


LOL pwnt. That wasn't nice though, so you earn -2.4 Cuenits. Please be nicer next time, expecially to somebody as holy as Rksss.

~Cueball~

mamorunl
10/10/2008, 11:39 AM
SpeedDevil ]
3. You are offering scripts and yourself as a scripter but you don't know this? shame on you


LOL pwnt. That wasn't nice though, so you earn -2.4 Cuenits. Please be nicer next time, expecially to somebody as holy as Rksss.

~Cueball~


now I only have 1.6 cuenits left :(

Rks holy? please explain yourself... no really!

MadnessJohnson
10/10/2008, 02:44 PM
SpeedDevil ]


new mycar;

//@Ongamemodeinit
mycar = CreateVehicle(..

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == mycar)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp(PlayerName, "[LSB]Johnson", true) == 0)
{
SendClientMessage(playerid, COLOR_COLOR,"This is your car.");
}
else
{
SendClientMessage(playerid, COLOR_COLOR, "This car is reserved for [LSB]Johnson!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}

Untested.


1. pastebin
2. you cant remove a player from a vehicle if he isn't in one.
3. You are offering scripts and yourself as a scripter but you don't know this? shame on you



yhyh, iv made it different,

getplayerpos
setplayerpos +2 etc, so when they do it it just moves em, much more effective way imo.

[AC]Flow
26/04/2010, 04:23 AM
i have 1 error :(

(2526) : error 010: invalid function or declaration

can u plz help

Kirchhoff
26/04/2010, 07:13 AM
new mycar;

//@Ongamemodeinit
mycar = CreateVehicle(..

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == mycar)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp(PlayerName, "[LSB]Johnson", true) == 0)
{
SendClientMessage(playerid, COLOR_COLOR,"This is your car.");
}
else
{
SendClientMessage(playerid, COLOR_COLOR, "This car is reserved for [LSB]Johnson!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}



Sorry for asking but if i already have defined OnPlayerEnterVehicle what can i do ?

Think
26/04/2010, 07:21 AM
Sorry for asking but if i already have defined OnPlayerEnterVehicle what can i do ?




move it to your own OnPlayerEnterVehicle callback.

Rac3r
26/04/2010, 08:14 AM
This won't work I don't think. You need to have it under OnPlayerStateChange because OnPlayerEnterVehicle is called when the player hits enter near a vehicle. They could easily stop walking towards it. So they could hit enter and cancel it and receive this message. OnPlayerStateChange is only called once they are in the car and it is on.
Can't believe they all ignored this post. Fail.

imnoob
05/06/2012, 11:41 AM
I alrady done
#define COLOR_LIGHTBLUE ***** BLA BLA
new car1;
new car2;
new car3;

car1 = AddStaticVehicle(....)
car2 = .............................
car3 = ..............................
AND STILL GIVES THIS
C:\Documents and Settings\Корисник\Desktop\FreakWorld RPG Macedonia\filterscripts\test.pwn(40) : error 017: undefined symbol "car1"
C:\Documents and Settings\Корисник\Desktop\FreakWorld RPG Macedonia\filterscripts\test.pwn(41) : error 017: undefined symbol "car2"
C:\Documents and Settings\Корисник\Desktop\FreakWorld RPG Macedonia\filterscripts\test.pwn(42) : error 017: undefined symbol "car3"
C:\Documents and Settings\Корисник\Desktop\FreakWorld RPG Macedonia\filterscripts\test.pwn(97) : error 017: undefined symbol "car1"
C:\Documents and Settings\Корисник\Desktop\FreakWorld RPG Macedonia\filterscripts\test.pwn(103) : error 017: undefined symbol "COLOR_YELLOW"
C:\Documents and Settings\Корисник\Desktop\FreakWorld RPG Macedonia\filterscripts\test.pwn(107) : error 017: undefined symbol "COLOR_GREEN"
C:\Documents and Settings\Корисник\Desktop\FreakWorld RPG Macedonia\filterscripts\test.pwn(108) : error 017: undefined symbol "COLOR_WHITE"
C:\Documents and Settings\Корисник\Desktop\FreakWorld RPG Macedonia\filterscripts\test.pwn(112) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

AND ERROR ? :S

7 Errors.