28.07.2011, 09:51
How can I make this code more private cars?
To not do so on each machine:
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
new pname[MAX_PLAYER_NAME];
new car;
car = AddStaticVehicle(437,-709.94384766,912.88665771,12.69688034,90.00000000,-1,3);
GetPlayerName(playerid, pname, sizeof pname);
if(newstate == PLAYER_STATE_DRIVER)
{
if(vehicleid == car)
{
if(strcmp(pname, "Name", true) == 0)
{
return 1;
}
else
{
RemovePlayerFromVehicle(playerid);
new string[50];
format(string, sizeof(string), "~r~This car is private!");
GameTextForPlayer(playerid, string, 3000, 4);
}
}
}
return 1;
}
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
new pname[MAX_PLAYER_NAME];
new car2;
car2 = AddStaticVehicle(437,-709.94384766,912.88665771,12.69688034,90.00000000,-1,3);
GetPlayerName(playerid, pname, sizeof pname);
if(newstate == PLAYER_STATE_DRIVER)
{
if(vehicleid == car2)
{
if(strcmp(pname, "Name", true) == 0)
{
return 1;
}
else
{
RemovePlayerFromVehicle(playerid);
new string[50];
format(string, sizeof(string), "~r~This car is private!");
GameTextForPlayer(playerid, string, 3000, 4);
}
}
}
return 1;
}