new idx<MAX_HOUSES, idx++; { // Getting House Setup new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); //Making House HouseInfo[idx][hName]= "Property For Sale!"; HouseInfo[idx][hLock] = 1; HouseInfo[idx][hHours] = 10; HouseInfo[idx][hPrice] = 15000; HouseInfo[idx][hEnterX] = X; HouseInfo[idx][hEnterY] = Y; HouseInfo[idx][hEnterZ] = Z; HouseInfo[idx][hExitX] = 2496.098876; HouseInfo[idx][hExitY] = -1692.503051; HouseInfo[idx][hExitZ] = 1014.742187; HouseInfo[idx][hOwner] = "The State"; HouseInfo[idx][hOwned] = 0; HouseInfo[idx][hRentable] = 0; HouseInfo[idx][hRent] = 1; HouseInfo[idx][hInterior] = 2; HouseInfo[idx][hMoney] = 0; HouseInfo[idx][hGun][0] = 0; HouseInfo[idx][hGunAmmo][0] = 0; HouseInfo[idx][hWeed] = 0; HouseInfo[idx][hCocaine] = 0; HouseInfo[idx][hCrack] = 0; HouseInfo[idx][hArmour] = 0; HouseInfo[idx][hType] = 0; HouseInfo[idx][hEInt] = 0; HouseInfo[idx][hEWorld] = 0; HouseInfo[idx][hTime] = 0; HouseInfo[idx][hGun][1] = 0; HouseInfo[idx][hGunAmmo][1] = 0; HouseInfo[idx][hGun][2] = 0; HouseInfo[idx][hGunAmmo][2] = 0; HouseInfo[idx][hGun][3] = 0; HouseInfo[idx][hGunAmmo][3] = 0; HouseInfo[idx][hComd] = 0; HouseInfo[idx][hGun][4] = 0; HouseInfo[idx][hGunAmmo][4] = 0; HouseInfo[idx][hGun][5] = 0; HouseInfo[idx][hGunAmmo][5] = 0; HouseInfo[idx][hGun][6] = 0; HouseInfo[idx][hGunAmmo][6] = 0; HouseInfo[idx][hGun][7] = 0; HouseInfo[idx][hGunAmmo][7] = 0; HouseInfo[idx][hGun][8] = 0; HouseInfo[idx][hGunAmmo][8] = 0; HouseInfo[idx][hGun][9] = 0; HouseInfo[idx][hGunAmmo][9] = 0; format(string, sizeof(string), "{FF0000}[Admin Warn]:{FF6347} %s has created house ID %d.", sendername, idx); SendAdminMessage(COLOR_LIGHTRED, 1, string); idx = MAX_HOUSES; } return 1; }
new idx<MAX_HOUSES, idx++;
You're using a "new", while you should use a "for" loop.
"new" explantion -> https://sampwiki.blast.hk/wiki/Scripting_Basics#Variables "for" loop -> https://sampwiki.blast.hk/wiki/Loops Focus on the line, pawn Код:
|
new idk, MAX_HOUSES, idkx++;
You're using a "new", while you should use a "for" loop.
"new" explantion -> https://sampwiki.blast.hk/wiki/Scripting_Basics#Variables "for" loop -> https://sampwiki.blast.hk/wiki/Loops Focus on the line, pawn Код:
|
for( ; ; ) { .. }
Again,
You need to use a for loop(Tutorial), NOT new. EDIT: And when I mean not a new, I mean not as a starter. You need to use the full for syntax. pawn Код:
|
for(new idx = 0,idx<MAX_HOUSES; idx++)
If not it's not correct please show me how you do it.
because i will never understand how. Thank's for the help. pawn Код:
|
if(idx != 500) {...} // (if idx does not(!=) equels to 500)
if(500 != 500) {...} // (if idx(500) does not(!=) equel to 500)
// But it does equel to 500, so it won't run and just end the process.
for(new idx = 0; idx < MAX_HOUSES; ++idx)
Again,
You need to use a for loop(Tutorial), NOT new. EDIT: And when I mean not a new, I mean not as a starter. You need to use the full for syntax. pawn Код:
|
Almost got that for loop there! Just one tiny problem:
pawn Код:
Also, idx++ and ++idx are the same thing |
for(new idx = 0,idx <MAX_HOUSES; ++idx)
{
// Getting House Setup
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
//Making House
HouseInfo[idx][hName]= "Property For Sale!";
HouseInfo[idx][hLock] = 1;
HouseInfo[idx][hHours] = 10;
HouseInfo[idx][hPrice] = 15000;
HouseInfo[idx][hEnterX] = X;
HouseInfo[idx][hEnterY] = Y;
HouseInfo[idx][hEnterZ] = Z;
HouseInfo[idx][hExitX] = 2496.098876;
HouseInfo[idx][hExitY] = -1692.503051;
HouseInfo[idx][hExitZ] = 1014.742187;
HouseInfo[idx][hOwner] = "The State";
HouseInfo[idx][hOwned] = 0;
HouseInfo[idx][hRentable] = 0;
HouseInfo[idx][hRent] = 1;
HouseInfo[idx][hInterior] = 2;
HouseInfo[idx][hMoney] = 0;
HouseInfo[idx][hGun][0] = 0;
HouseInfo[idx][hGunAmmo][0] = 0;
HouseInfo[idx][hWeed] = 0;
HouseInfo[idx][hCocaine] = 0;
HouseInfo[idx][hCrack] = 0;
HouseInfo[idx][hArmour] = 0;
HouseInfo[idx][hType] = 0;
HouseInfo[idx][hEInt] = 0;
HouseInfo[idx][hEWorld] = 0;
HouseInfo[idx][hTime] = 0;
HouseInfo[idx][hGun][1] = 0;
HouseInfo[idx][hGunAmmo][1] = 0;
HouseInfo[idx][hGun][2] = 0;
HouseInfo[idx][hGunAmmo][2] = 0;
HouseInfo[idx][hGun][3] = 0;
HouseInfo[idx][hGunAmmo][3] = 0;
HouseInfo[idx][hComd] = 0;
HouseInfo[idx][hGun][4] = 0;
HouseInfo[idx][hGunAmmo][4] = 0;
HouseInfo[idx][hGun][5] = 0;
HouseInfo[idx][hGunAmmo][5] = 0;
HouseInfo[idx][hGun][6] = 0;
HouseInfo[idx][hGunAmmo][6] = 0;
HouseInfo[idx][hGun][7] = 0;
HouseInfo[idx][hGunAmmo][7] = 0;
HouseInfo[idx][hGun][8] = 0;
HouseInfo[idx][hGunAmmo][8] = 0;
HouseInfo[idx][hGun][9] = 0;
HouseInfo[idx][hGunAmmo][9] = 0;
format(string, sizeof(string), "{FF0000}[Admin Warn]:{FF6347} %s has created house ID %d.", sendername, idx);
SendAdminMessage(COLOR_LIGHTRED, 1, string);
idx = MAX_HOUSES;
}
return 1;
}