pawn Код:
CMD:createhouse(playerid, params[])
{
new string[128], Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(isnull(params)) return SendClientMessage(playerid, -1, ""Grey"Syntax"White": /createhouse [address]."); // checks if params was null so it gives the error
for(new houseid=1; houseid<MAX_HOUSES; houseid++)
{
if(HouseInfo[houseid][hid] != 0) continue; // if the houseid wasnt 0 (if it was already existed) as the loop already starts with id 1, so it skips.
HouseInfo[houseid][hID] = houseid; // i dont know how come that will work but ok.
format(HouseInfo[houseid][hAddress], 30, "%s", params); // Sets the address
format(HouseInfo[houseid][hOwner], 32, "None");
HouseInfo[houseid][hOwned] = 0;
HouseInfo[houseid][hPickUp] = CreateDynamicPickup(1273, 1, x, y, z, 0);
format(string, sizeof(string), ""Green"ID: %d\nHouse Address: %s", houseid, HouseInfo[houseid][hAddress]);
HouseInfo[houseid][hText] = CreateDynamic3DTextLabel(string, -1, x, y, z, 20.0);
//houseid = MAX_HOUSES; // break can be better than this
break;
}
return 1;
}