CMD:lockgarage(playerid, params[])
{
new string[128];
for(new i = 0; i< sizeof(GarageInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5, GarageInfo[i][gExteriorX], GarageInfo[i][gExteriorY], GarageInfo[i][gExteriorZ]) || IsPlayerInRangeOfPoint(playerid, 5, 1860.0675,-2347.2207,-37.4430))
{
if(strmatch(HouseInfo[GarageInfo[i][gHouseID]][hOwner],GetPlayerNameEx(playerid)))
{
if(!GarageInfo[i][gLock])
{
GarageInfo[i][gLock] = 1;
format(string, sizeof(string), "* %s unlocks their garage.", RPN(playerid));
ProxDetector(15.0, playerid, string, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME);
GText(playerid, "~g~Garage Unlocked", 3500, 3);
}
else if(GarageInfo[i][gLock])
{
GarageInfo[i][gLock] = 0;
format(string, sizeof(string), "* %s locks their garage", RPN(playerid));
ProxDetector(15.0, playerid, string, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME);
GText(playerid, "~r~Garage Locked", 3500, 3);
}
SaveGarages(i);
}
}
}
return 1;
}
stock strmatch(const String1[], const String2[])
{
if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1)))
{
return true;
}
else
{
return false;
}
}
CMD:lockgarage(playerid, params[])
{
new string[128];
for(new i = 0; i< sizeof(GarageInfo); i++)
{
print("1");
if(IsPlayerInRangeOfPoint(playerid, 5, GarageInfo[i][gExteriorX], GarageInfo[i][gExteriorY], GarageInfo[i][gExteriorZ]) || IsPlayerInRangeOfPoint(playerid, 5, 1860.0675,-2347.2207,-37.4430))
{
print("2");
if(strmatch(HouseInfo[GarageInfo[i][gHouseID]][hOwner],GetPlayerNameEx(playerid)))
{
print("3");
if(!GarageInfo[i][gLock])
{
GarageInfo[i][gLock] = 1;
format(string, sizeof(string), "* %s unlocks their garage.", RPN(playerid));
ProxDetector(15.0, playerid, string, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME);
GText(playerid, "~g~Garage Unlocked", 3500, 3);
print("4");
}
else if(GarageInfo[i][gLock])
{
GarageInfo[i][gLock] = 0;
format(string, sizeof(string), "* %s locks their garage", RPN(playerid));
ProxDetector(15.0, playerid, string, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME);
GText(playerid, "~r~Garage Locked", 3500, 3);
print("5");
}
SaveGarages(i);
print("6");
}
// so on and forth.
}
}
return 1;
}
[23:58:37] 1 [23:58:37] 1 [23:58:37] 2 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:37] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 2 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1 [23:58:39] 1
CMD:lockgarage(playerid, params[])
{
new string[128];
for(new i = 0; i< sizeof(GarageInfo); i++)
{
print("1");
if(IsPlayerInRangeOfPoint(playerid, 5, GarageInfo[i][gExteriorX], GarageInfo[i][gExteriorY], GarageInfo[i][gExteriorZ]) || IsPlayerInRangeOfPoint(playerid, 5, 1860.0675,-2347.2207,-37.4430))
{
print("2");
if(!strcmp(HouseInfo[GarageInfo[i][gHouseID]][hOwner],GetPlayerNameEx(playerid)))
{
print("3");
if(!GarageInfo[i][gLock])
{
GarageInfo[i][gLock] = 1;
format(string, sizeof(string), "* %s unlocks their garage.", RPN(playerid));
ProxDetector(15.0, playerid, string, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME);
GText(playerid, "~g~Garage Unlocked", 3500, 3);
print("4");
}
else if(GarageInfo[i][gLock])
{
GarageInfo[i][gLock] = 0;
format(string, sizeof(string), "* %s locks their garage", RPN(playerid));
ProxDetector(15.0, playerid, string, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME);
GText(playerid, "~r~Garage Locked", 3500, 3);
print("5");
}
SaveGarages(i);
print("6");
}
// so on and forth.
break;
}
}
return 1;
}
|
Ok. You have a continuous loop. Use break to stop it once you have an avaliable house. I.e:
Код:
CMD:lockgarage(playerid, params[])
{
new string[128];
for(new i = 0; i< sizeof(GarageInfo); i++)
{
print("1");
if(IsPlayerInRangeOfPoint(playerid, 5, GarageInfo[i][gExteriorX], GarageInfo[i][gExteriorY], GarageInfo[i][gExteriorZ]) || IsPlayerInRangeOfPoint(playerid, 5, 1860.0675,-2347.2207,-37.4430))
{
print("2");
if(!strcmp(HouseInfo[GarageInfo[i][gHouseID]][hOwner],GetPlayerNameEx(playerid)))
{
print("3");
if(!GarageInfo[i][gLock])
{
GarageInfo[i][gLock] = 1;
format(string, sizeof(string), "* %s unlocks their garage.", RPN(playerid));
ProxDetector(15.0, playerid, string, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME);
GText(playerid, "~g~Garage Unlocked", 3500, 3);
print("4");
}
else if(GarageInfo[i][gLock])
{
GarageInfo[i][gLock] = 0;
format(string, sizeof(string), "* %s locks their garage", RPN(playerid));
ProxDetector(15.0, playerid, string, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME, COLOR_ACCIONME);
GText(playerid, "~r~Garage Locked", 3500, 3);
print("5");
}
SaveGarages(i);
print("6");
}
// so on and forth.
break;
}
}
return 1;
}
|
if(strcmp(HouseInfo[GarageInfo[i][gHouseID]][hOwner],GetPlayerNameEx(playerid)))
|
Try this instead:
Код:
if(strcmp(HouseInfo[GarageInfo[i][gHouseID]][hOwner],GetPlayerNameEx(playerid))) |