PDA

View Full Version : private cars question


Nines
16/07/2013, 09:22 PM
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;
}

Nines
16/07/2013, 09:48 PM
help?

Jefff
16/07/2013, 09:59 PM
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;
}

Nines
16/07/2013, 10:55 PM
Its 2 seperate cars though, not one jefff

Nines
17/07/2013, 03:40 PM
bump

Aerotactics
17/07/2013, 07:20 PM
I'm not sure, sorry, but I hope this bump gets you some help.

Nines
18/07/2013, 12:20 PM
please guys lol really need help

DobbysGamertag
18/07/2013, 01:29 PM
Try: http://codegenerators.pl/privateVehicle

Its a useful website.

Nines
18/07/2013, 01:33 PM
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?

Nines
21/07/2013, 02:39 PM
bumpp