That is Carlitos I suppose. It's problem with virtual worlds and, so.
pawn Код:
if(strcmp(cmd, "/lock", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < sizeof(Houses); i++)
{
if (PlayerToPoint(3.0, playerid,Houses[i][EnterX], Houses[i][EnterY], Houses[i][EnterZ]))
{
if(GetPlayerVirtualWorld(playerid) == Houses[i][EnterWorld])
{
if(PlayerInfo[playerid][pHouseKey] == i || AdminDuty[playerid] == 1)
{
if(Houses[i][Locked] == 1)
{
Houses[i][Locked] = 0;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Unlocked.");
PlayerActionMessage(playerid,15.0,"puts in there key and opens the door.");
SaveHouses();
return 1;
}
if(Houses[i][Locked] == 0)
{
Houses[i][Locked] = 1;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Locked.");
PlayerActionMessage(playerid,15.0,"puts in there key and locks the door.");
SaveHouses();
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[ERROR:] You don't have a key for this house!");
return 1;
}
}
}
else if (PlayerToPoint(3.0, playerid,Houses[i][ExitX], Houses[i][ExitY], Houses[i][ExitZ]))
{
if(GetPlayerVirtualWorld(playerid) == i)
{
if(PlayerInfo[playerid][pHouseKey] == i || AdminDuty[playerid] == 1)
{
if(Houses[i][Locked] == 1)
{
Houses[i][Locked] = 0;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Unlocked.");
PlayerActionMessage(playerid,15.0,"puts in there key and opens the door.");
SaveHouses();
return 1;
}
if(Houses[i][Locked] == 0)
{
Houses[i][Locked] = 1;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Locked.");
PlayerActionMessage(playerid,15.0,"puts in there key and locks the door.");
SaveHouses();
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[ERROR:] You don't have a key for this house!");
return 1;
}
}
}
}
for(new i = 0; i < sizeof(Businesses); i++)
{
if (PlayerToPoint(3.0, playerid,Businesses[i][EnterX], Businesses[i][EnterY], Businesses[i][EnterZ]))
{
if(GetPlayerVirtualWorld(playerid) == Businesses[i][EnterWorld])
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
if(PlayerInfo[playerid][pBizKey] == i && strcmp(playername, Businesses[PlayerInfo[playerid][pBizKey]][Owner], true) == 0 || AdminDuty[playerid] == 1)
{
if(Businesses[i][Locked] == 1)
{
if(PlayerInfo[playerid][pSex] == 1)
{
Businesses[i][Locked] = 0;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Unlocked.");
PlayerActionMessage(playerid,15.0,"puts in his key and opens the door.");
SaveBusinesses();
}
else
{
Businesses[i][Locked] = 0;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Unlocked.");
PlayerActionMessage(playerid,15.0,"puts in her key and opens the door.");
SaveBusinesses();
}
return 1;
}
if(Businesses[i][Locked] == 0)
{
if(PlayerInfo[playerid][pSex] == 1)
{
Businesses[i][Locked] = 1;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Locked.");
PlayerActionMessage(playerid,15.0,"puts in his key and locks the door.");
SaveBusinesses();
}
else
{
Businesses[i][Locked] = 1;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Locked.");
PlayerActionMessage(playerid,15.0,"puts in her key and locks the door.");
SaveBusinesses();
}
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[ERROR:] You don't have a key for this business!");
return 1;
}
}
}
else if (PlayerToPoint(3.0, playerid,Businesses[i][ExitX], Businesses[i][ExitY], Businesses[i][ExitZ]))
{
if(GetPlayerVirtualWorld(playerid) == i)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
if(PlayerInfo[playerid][pBizKey] == i && strcmp(playername, Businesses[PlayerInfo[playerid][pBizKey]][Owner], true) == 0 || AdminDuty[playerid] == 1)
{
if(Businesses[i][Locked] == 1)
{
if(PlayerInfo[playerid][pSex] == 1)
{
Businesses[i][Locked] = 0;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Unlocked.");
PlayerActionMessage(playerid,15.0,"puts in his key and opens the door.");
SaveBusinesses();
}
else
{
Businesses[i][Locked] = 0;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Unlocked.");
PlayerActionMessage(playerid,15.0,"puts in her key and opens the door.");
SaveBusinesses();
}
return 1;
}
if(Businesses[i][Locked] == 0)
{
if(PlayerInfo[playerid][pSex] == 1)
{
Businesses[i][Locked] = 1;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Locked.");
PlayerActionMessage(playerid,15.0,"puts in his key and locks the door.");
SaveBusinesses();
}
else
{
Businesses[i][Locked] = 1;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Locked.");
PlayerActionMessage(playerid,15.0,"puts in her key and locks the door.");
SaveBusinesses();
}
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[ERROR:] You don't have a key for this business!");
return 1;
}
}
}
}
for(new i = 0; i < sizeof(Building); i++)
{
if (PlayerToPoint(3.0, playerid,Building[i][EnterX], Building[i][EnterY], Building[i][EnterZ]))
{
if(GetPlayerVirtualWorld(playerid) == Building[i][EnterWorld])
{
if((PlayerInfo[playerid][pFaction] == Building[i][Faction]) || AdminDuty[playerid] == 1)
{
if(Building[i][Locked] == 1)
{
Building[i][Locked] = 0;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Unlocked.");
PlayerActionMessage(playerid,15.0,"puts in there key and opens the door.");
SaveBuildings();
return 1;
}
if(Building[i][Locked] == 0)
{
Building[i][Locked] = 1;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Locked.");
PlayerActionMessage(playerid,15.0,"puts in there key and locks the door.");
SaveBuildings();
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[ERROR:] You don't have a key for this building!");
return 1;
}
}
}
else if (PlayerToPoint(3.0, playerid,Building[i][ExitX], Building[i][ExitY], Building[i][ExitZ]))
{
if(GetPlayerVirtualWorld(playerid) == i)
{
if((PlayerInfo[playerid][pFaction] == Building[i][Faction]) || AdminDuty[playerid] == 1)
{
if(Building[i][Locked] == 1)
{
Building[i][Locked] = 0;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Unlocked.");
PlayerActionMessage(playerid,15.0,"puts in there key and opens the door.");
SaveBuildings();
return 1;
}
if(Building[i][Locked] == 0)
{
Building[i][Locked] = 1;
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[INFO:] Door Locked.");
PlayerActionMessage(playerid,15.0,"puts in there key and locks the door.");
SaveBuildings();
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[ERROR:] You don't have a key for this building!");
return 1;
}
}
}
}
}
return 1;
}
This one works, but it's a bit edited, so take a look and use parts which you need to use.