03.07.2014, 22:43
pawn Код:
CMD:npirkti(playerid,params[])
{
for(new h=0; h < sizeof(HouseInfo); h++)
{
printf("h = %d - sizeof = %d", h , sizeof(HouseInfo));
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(strcmp(HouseInfo[h][hOwnerName], pName, false ) == 1)
{
if(IsPlayerInRangeOfPoint(playerid, 5, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY] , HouseInfo[h][hEnterZ]))
{
if(HouseInfo[h][hOwned] == 0)
{
if(GetPlayerMoney(playerid) > HouseInfo[h][hPrice])
{
strmid(HouseInfo[h][hOwnerName], pName, 0, strlen(pName),MAX_PLAYER_NAME);
HouseInfo[h][hOwned] = 1;
GivePlayerMoney(playerid,-HouseInfo[h][hPrice]);
SendClientMessage(playerid, COL_RED,"Sveikiname, nusipirkote nama! Visas komandas rasite /namai.");
HouseInfo[h][hIsRented] = 0;
new labelstring[500];
DestroyDynamic3DTextLabel(HouseInfo[h][hLabel]);
DestroyDynamicMapIcon(HouseInfo[h][hIcon]);
DestroyDynamicPickup(HouseInfo[h][hPickup]);
format(labelstring, sizeof(labelstring),""TCCYAN"Savininkas: "TCRED"%s\n"TCCYAN"Nuoma: "TCRED"%s\n"TCCYAN"Nuomos kaina: "TCRED"%d\n"TCCYAN"Adresas: "TCRED"%s", HouseInfo[h][hOwnerName],HouseInfo[h][hRenter],HouseInfo[h][hRentPrice],HouseInfo[h][hAddress]);
HouseInfo[h][hLabel] = CreateDynamic3DTextLabel(labelstring, COL_GREEN, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 20);
HouseInfo[h][hPickup] = CreateDynamicPickup(1272, 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
HouseInfo[h][hIcon] = CreateDynamicMapIcon(HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 32, 0,0);
SaveHouseData(h);
return 1;
}
else { SendClientMessage(playerid, COL_RED, "Jums neuztenka pinigu ipirkti siam namui!"); return 1; }
}
else { SendClientMessage(playerid, COL_RED, "Sis namas jau nupirktas!Jei jis nuomuojamas gali ji nuomuoti."); return 1; }
}
else { SendClientMessage(playerid, COL_RED, "Jus nesate prie parduodamo namo!"); return 1; }
}
else { SendClientMessage(playerid, COL_RED, "Tu jau turi namus!"); return 1; }
}
return 1;
}
DEBUG:
Код:
[02:04:11] Number of vehicle models: 0 [02:05:52] Incoming connection: 192.168.1.1:50174 [02:05:52] [join] Interneto_Tiekejas has joined the server (0:192.168.1.1) [02:06:47] h = 0 - sizeof = 100 [02:06:48] h = 0 - sizeof = 100 [02:07:02] Interneto_Tiekejas paliko serveri [Isejo] [02:07:02] [part] Interneto_Tiekejas has left the server (0:1)