21.12.2014, 10:00
This is a command that lock doors:
But, it's not working. All can enter the car if its doors are locked too.
Someone, please help me.
rep++;
PHP код:
// /lock
if(strcmp(cmdtext, "/lock", true, 20) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_ORANGE, "ERROR: You are not in any vehicle.");
if(GetPlayerState(playerid)==PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_ORANGE, "ERROR: Only drivers can lock car doors.");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin]<5)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid), i, 0, 1);
doorslocked[playerid]=1;
}
}
}
SendClientMessage(playerid, COLOR_YELLOW, "Doors locked.");
return 1;
}
// /unlock
if(strcmp(cmdtext, "/unlock", true, 20) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_ORANGE, "ERROR: You are not in any vehicle.");
if(GetPlayerState(playerid)==PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_ORANGE, "ERROR: Only drivers can unlock car doors.");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid), i, 0, 0);
doorslocked[playerid]=0;
}
}
SendClientMessage(playerid, COLOR_YELLOW, "Doors unlocked.");
return 1;
}
Someone, please help me.
rep++;