24.03.2011, 23:49
Ok, i've made this command where it sets a buncha building shit before it adds it.
The command works fine but when i try to do names with spaces it just return the command text
How can i make it so i can add spaces in BuildingName
like this
/addbuildingenter <BuildingId> <BuildingName> <type> <lock (1 for locked)>
/addbuildingenter 1 Los Santos Police Department 0 0
I just wanna make it so i can add spaces to the names
The command works fine but when i try to do names with spaces it just return the command text
How can i make it so i can add spaces in BuildingName
like this
/addbuildingenter <BuildingId> <BuildingName> <type> <lock (1 for locked)>
/addbuildingenter 1 Los Santos Police Department 0 0
pawn Код:
YCMD:addbuildingenter(playerid, params[], help)
{
#pragma unused params
new b;
new str[128];
new name[64];
new type;
new lock;
new Float:X, Float:Y, Float:Z;
new location[MAX_ZONE_NAME];
if(PlayerInfo[playerid][pAdmin] < 9 && !IsPlayerAdmin(playerid)) return
SendClientMessage(playerid, COLOR_GREY, ADMIN_CMD_ERROR);
if (help) return
SendClientMessage(playerid, COMMAND_HELP_COLOR, "Create a building enter and save it");
if (sscanf(params,"ds[64]dd",b,name,type,lock)) return SendClientMessage(playerid, COMMAND_PRINT, "Usage: /addbuildingenter <BuildingId> <BuildingName> <type> <lock (1 for locked)>.");
format(Query, sizeof(Query), "SELECT * FROM buildings WHERE BuildingId=%d",b);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() == 1) return
SendClientMessage(playerid, COMMAND_PRINT, "This Buildingid is allready in use");
GetPlayerPos(playerid, X, Y, Z);
BuildingInfo[b][bName] = name;
BuildingInfo[b][bId] = b;
BuildingInfo[b][bLocked] = lock;
BuildingInfo[b][bType] = type;
BuildingInfo[b][bEnterX] = X;
BuildingInfo[b][bEnterY] = Y;
BuildingInfo[b][bEnterZ] = Z;
format(Query, sizeof(Query), "INSERT INTO `buildings` (BuildingId, BuildingName, BuildingType, BuildingLock, BuildingEnterX, BuildingEnterY, BuildingEnterZ) VALUES(%d, '%s', %d, %d, '%f', '%f', '%f')",
b,name,type,lock,X,Y,Z);
mysql_query(Query);
printf("%s",Query);
mysql_free_result();
Get2DZone(location, MAX_ZONE_NAME, X, Y, Z);
format(str, sizeof (str), "Building Enter Save ~ BuildingId [ %d ] - BuildingName [ %s ] - BuildingType [ %d ] - BuildingLock [ %d ]",b,name,type,lock);
SendClientMessage(playerid, COLOR_WHITE, str);
format(str, sizeof(str), "%s\n",BuildingInfo[b][bName]);
BuildingText[b] = Create3DTextLabel(str,0x008080FF,BuildingInfo[b][bEnterX],BuildingInfo[b][bEnterY],BuildingInfo[b][bEnterZ],20,0,1);
return 1;
}