forward OnAdminCreateEntrance(playerid, entranceid, name[], Float:x, Float:y, Float:z, Float:angle);
public OnAdminCreateEntrance(playerid, entranceid, name[], Float:x, Float:y, Float:z, Float:angle)
{
strcpy(EntranceInfo[entranceid][eOwner], "Nobody", MAX_PLAYER_NAME);
strcpy(EntranceInfo[entranceid][eName], name, 40);
strcpy(EntranceInfo[entranceid][ePassword], "None", 64);
EntranceInfo[entranceid][eExists] = 1;
EntranceInfo[entranceid][eID] = cache_insert_id(connectionID);
EntranceInfo[entranceid][eOwnerID] = 0;
EntranceInfo[entranceid][eIcon] = 1239;
EntranceInfo[entranceid][eLocked] = 0;
EntranceInfo[entranceid][eRadius] = 3.0;
EntranceInfo[entranceid][ePosX] = x;
EntranceInfo[entranceid][ePosY] = y;
EntranceInfo[entranceid][ePosZ] = z;
EntranceInfo[entranceid][ePosA] = angle;
EntranceInfo[entranceid][eIntX] = 0.0;
EntranceInfo[entranceid][eIntY] = 0.0;
EntranceInfo[entranceid][eIntZ] = 0.0;
EntranceInfo[entranceid][eIntA] = 0.0;
EntranceInfo[entranceid][eInterior] = 0;
EntranceInfo[entranceid][eWorld] = EntranceInfo[entranceid][eID] + 4000000;
EntranceInfo[entranceid][eOutsideInt] = GetPlayerInterior(playerid);
EntranceInfo[entranceid][eOutsideVW] = GetPlayerVirtualWorld(playerid);
EntranceInfo[entranceid][eAdminLevel] = 0;
EntranceInfo[entranceid][eFactionType] = FACTION_NONE;
EntranceInfo[entranceid][eGang] = -1;
EntranceInfo[entranceid][eVIP] = 0;
EntranceInfo[entranceid][eVehicles] = 0;
EntranceInfo[entranceid][eFreeze] = 0;
EntranceInfo[entranceid][eLabel] = 1;
EntranceInfo[entranceid][eType] = 0;
EntranceInfo[entranceid][eMapIcon] = 0;
EntranceInfo[entranceid][eText] = Text3D:INVALID_3DTEXT_ID;
EntranceInfo[entranceid][ePickup] = -1;
EntranceInfo[entranceid][eMapIconID] = -1;
EntranceInfo[entranceid][eColor] = -256;
Iter_Add(Entrance, entranceid);
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "UPDATE entrances SET world = %i WHERE id = %i", EntranceInfo[entranceid][eWorld], EntranceInfo[entranceid][eID]);
mysql_tquery(connectionID, queryBuffer);
ReloadEntrance(entranceid);
SendClientMessageEx(playerid, COLOR_GREEN, "** Entrance %i created successfully.", entranceid);
}
CREATE TABLE `entrances` (
`id` int(10) NOT NULL,
`ownerid` int(10) DEFAULT '0',
`owner` varchar(24) DEFAULT NULL,
`name` varchar(40) DEFAULT NULL,
`iconid` smallint(5) DEFAULT '1239',
`locked` tinyint(1) DEFAULT '0',
`radius` float DEFAULT '3',
`pos_x` float DEFAULT '0',
`pos_y` float DEFAULT '0',
`pos_z` float DEFAULT '0',
`pos_a` float DEFAULT '0',
`int_x` float DEFAULT '0',
`int_y` float DEFAULT '0',
`int_z` float DEFAULT '0',
`int_a` float DEFAULT '0',
`interior` tinyint(2) DEFAULT '0',
`world` int(10) DEFAULT '0',
`outsideint` tinyint(2) DEFAULT '0',
`outsidevw` int(10) DEFAULT '0',
`adminlevel` tinyint(2) DEFAULT '0',
`factiontype` tinyint(2) DEFAULT '0',
`vip` tinyint(2) DEFAULT '0',
`vehicles` tinyint(1) DEFAULT '0',
`freeze` tinyint(1) DEFAULT '0',
`password` varchar(64) DEFAULT 'None',
`label` tinyint(1) DEFAULT '1',
`mapicon` tinyint(3) NOT NULL DEFAULT '0',
`gang` tinyint(2) DEFAULT '-1',
`type` tinyint(2) DEFAULT '0',
`color` int(10) DEFAULT '-256'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
I don't think the problem is in there...
Can you show me how you create the icons and the text above? I think its in the way you use your iterate |
CMD:createentrance(playerid, params[])
{
new name[40], Float:x, Float:y, Float:z, Float:a;
if(PlayerInfo[playerid][pAdmin] < 5 && !PlayerInfo[playerid][pGangMod])
{
return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
}
if(sscanf(params, "s[40]", name))
{
return SendClientMessage(playerid, COLOR_GREY3, "[Usage]: /createentrance [name]");
}
if(GetNearbyEntrance(playerid) >= 0)
{
return SendClientMessage(playerid, COLOR_GREY, "There is an entrance in range. Find somewhere else to create this one.");
}
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
for(new i = 0; i < MAX_ENTRANCES; i ++)
{
if(!EntranceInfo[i][eExists])
{
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "INSERT INTO entrances (name, pos_x, pos_y, pos_z, pos_a, outsideint, outsidevw) VALUES('%e', '%f', '%f', '%f', '%f', %i, %i)", name, x, y, z, a - 180.0, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
mysql_tquery(connectionID, queryBuffer, "OnAdminCreateEntrance", "iisffff", playerid, i, name, x, y, z, a);
return 1;
}
}
SendClientMessage(playerid, COLOR_GREY, "Entrance slots are currently full. Ask Kirito to increase the internal limit.");
return 1;
}
Create3DTextLabel(text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, virtualworld, testLOS=0)
CreateDynamic3DTextLabel(const text[], color, Float:x, Float:y, Float:z, Float:drawdistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = STREAMER_3D_TEXT_LABEL_SD, STREAMER_TAG_AREA areaid = STREAMER_TAG_AREA -1)
CreateDynamic3DTextLabelEx(const text[], color, Float:x, Float:y, Float:z, Float:drawdistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0, Float:streamdistance = STREAMER_3D_TEXT_LABEL_SD, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, STREAMER_TAG_AREA areas[] = { STREAMER_TAG_AREA -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players, maxareas = sizeof areas)
No that's the create command. What I mean is when you create the icons.
This one PHP код:
Also to help you more, its when you buffer, load, or create the entrance of the house. |
if(EntranceInfo[entranceid][eLabel])
{
if(EntranceInfo[entranceid][eOwnerID])
{
format(string, sizeof(string), "%s\nOwner: %s\nPress 'Y' to go inside\n Entrance Id %d", EntranceInfo[entranceid][eName], EntranceInfo[entranceid][eOwner], entranceid);
}
else
{
format(string, sizeof(string), "%s\nPress 'Y' to go inside\n Entrance Id %d.", EntranceInfo[entranceid][eName], entranceid);
}
EntranceInfo[entranceid][eText] = CreateDynamic3DTextLabel(string, COLOR_GREY1, EntranceInfo[entranceid][ePosX], EntranceInfo[entranceid][ePosY], (EntranceInfo[entranceid][eIcon] == 19902) ? (EntranceInfo[entranceid][ePosZ] + 0.1) : (EntranceInfo[entranceid][ePosZ]), 10.0, .worldid = EntranceInfo[entranceid][eOutsideVW], .interiorid = EntranceInfo[entranceid][eOutsideInt]);
}
EntranceInfo[entranceid][ePickup] = CreateDynamicPickup(EntranceInfo[entranceid][eIcon], 1, EntranceInfo[entranceid][ePosX], EntranceInfo[entranceid][ePosY], (EntranceInfo[entranceid][eIcon] == 19902) ? (EntranceInfo[entranceid][ePosZ] - 1.0) : (EntranceInfo[entranceid][ePosZ]), .worldid = EntranceInfo[entranceid][eOutsideVW], .interiorid = EntranceInfo[entranceid][eOutsideInt]);
for(new i = 0; i < MAX_ENTRANCES; i ++)
{
if(!EntranceInfo[i][eExists])
{
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "INSERT INTO entrances (name, pos_x, pos_y, pos_z, pos_a, outsideint, outsidevw) VALUES('%e', '%f', '%f', '%f', '%f', %i, %i)", name, x, y, z, a - 180.0, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
mysql_tquery(connectionID, queryBuffer, "OnAdminCreateEntrance", "iisffff", playerid, i, name, x, y, z, a);
break; // Use break instead of return 1; It'll stop the loop.
}
}
Ahh I see the problem
PHP код:
As I've seen the loop continues up to the MAX_ENTRANCES you have made for your server, it does not get stopped because you were using return and not break. |
Here up
PHP код:
|
if(!EntranceInfo[i][eExists])