You using pickups or checkpoints?
What is the variable name of the created pickup/checkpoint?
E.G hInfo[id][DynamicCheckpointID]
EDIT: I didn't see your last post, the error in your code is
pawn Код:
for(new i=1; i<=CreatedHouses; i++)
{
id = i;
break;
}
That uses house ID 1 everytime.
BTW: don't use 25 for max player name, the max player name is actually 20 based on the client so use 21, or just use the define MAX_PLAYER_NAME which is set to 24.
pawn Код:
if(dialogid == BUY_HOUSE && response==1)
{
switch(listitem)
{
case 0:
{
new id = 0, name[MAX_PLAYER_NAME], count = 0;
if( count >= 3 )
return SendClientMessage(playerid, RED, "ERROR:{FFFFFF} You can't own more than 3 houses at a time");
if( GetPlayerMoney(playerid) < hInfo[id][Price] )
return SendClientMessage(playerid, RED, "ERROR:{FFFFFF} You do not have enough money to buy this house");
for(new i = 1; i <= CreatedHouses; i++)
{
if(InPlayerInDynamicCP(playerid, hInfo[i][Owner])) {// change this line!
id = i;
break;
}
}
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
for(new i = 1; i <= CreatedHouses; i++)
{
if(hInfo[i][Owner][0] == '\0') continue; // Add this here to skip unowned houses.
if(strcmp(name, hInfo[i][Owner]) == 0)
count++;
}
hInfo[id][Owned] = 1;
hInfo[id][Owner] = name;
GivePlayerMoney( playerid, -hInfo[id][Price] );
DestroyDynamicMapIcon(hInfo[id][Icon]);
PutPlayerInHouse(playerid, id);
new
str[300],
query[400];
format(str, sizeof(str),"House Owned: Yes\nHouse Owner: %s\nHouse Price: $%i\nHouse Locked: %s", hInfo[id][Owner], hInfo[id][Price], (hInfo[id][Locked] == 1) ? ("Yes") : ("No"));
UpdateDynamic3DTextLabelText(Text3D:hInfo[id][Label], 0xFF0000FF, str);
format(query, sizeof(query), "UPDATE `"Houses_Table"` SET `Owned` = '%i', `Owner` = '%s' WHERE `ID` = '%i'", hInfo[id][Owned], hInfo[id][Owner], id);
mysql_query(query);
}
}
}