19.06.2015, 15:27
hellow, iam a newbie scripter and i in the learning process mysql
ok first, iam creating a house system,
with db (samp) and colom (house)
but, i so confused (I did not find logic) to convert my command from dini to mysql
anony can help me?
this script
ok first, iam creating a house system,
with db (samp) and colom (house)
but, i so confused (I did not find logic) to convert my command from dini to mysql
anony can help me?
this script
pawn Код:
CMD:createhouse(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] > 0)
{
new string[512];
new NewHouse = HouseSpawn+1;
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
if(NewHouse >= MAX_HOUSE)
{
SCME(playerid, COLOR_WHITE, "Too many HOUSE are currently spawned!");
}
cache_get_data(rows, fields, mysql);
if(rows)
{
HouseSpawn++;
format( string, sizeof( string ), "House (ID: %d) already exist!", NewHouse);
SCME( playerid, COLOR_GREY, string);
SCME( playerid, COLOR_YELLOW, "Please try again by typing /createhouse" );
}
else
{
format(HouseInfo[NewHouse][hOwner], 69, "NoOwner");
dini_Create(string);
dini_IntSet(string, "Owned", HouseInfo[NewHouse][hOwned] = 0);
dini_Set(string, "Owner", HouseInfo[NewHouse][hOwner]);
dini_IntSet(string, "Lock", HouseInfo[NewHouse][hLock] = 1);
dini_IntSet(string, "Price", HouseInfo[NewHouse][hPrice] = -1);
dini_FloatSet(string, "Ext", HouseInfo[NewHouse][hIntEX] = 0);
dini_FloatSet(string, "ExteriorX", HouseInfo[NewHouse][hExtX] = x);
dini_FloatSet(string, "ExteriorY", HouseInfo[NewHouse][hExtY] = y);
dini_FloatSet(string, "ExteriorZ", HouseInfo[NewHouse][hExtZ] = z);
dini_FloatSet(string, "ExteriorA", HouseInfo[NewHouse][hExtA] = a);
dini_IntSet(string, "VirtualWorld", HouseInfo[NewHouse][hIntVW] = 0);
dini_FloatSet(string, "Int", HouseInfo[NewHouse][hIntIN] = 0);
dini_FloatSet(string, "InteriorX", HouseInfo[NewHouse][hIntX] = 0);
dini_FloatSet(string, "InteriorY", HouseInfo[NewHouse][hIntY] = 0);
dini_FloatSet(string, "InteriorZ", HouseInfo[NewHouse][hIntZ] = 0);
dini_FloatSet(string, "InteriorA", HouseInfo[NewHouse][hIntA] = 0);
new location[MAX_ZONE_NAME];
Get2DZone(location, MAX_ZONE_NAME, HouseInfo[NewHouse][hExtX], HouseInfo[NewHouse][hExtY], HouseInfo[NewHouse][hExtZ]);
format(string, sizeof(string), "{00F0F0}[House #%d]\n{FFFFFF}Selling!\n{0080FF}Location: {FFFFFF}%s\n{0080FF}Price: {FFFFFF}%d\n/buyhouse to buy this house", NewHouse, location, HouseInfo[NewHouse][hPrice]);
HouseInfo[NewHouse][hText] = CreateDynamik3DTextLabel(string, COLOR_YELLOW, HouseInfo[NewHouse][hExtX], HouseInfo[NewHouse][hExtY], HouseInfo[NewHouse][hExtZ], 10.0, 0);
HouseInfo[NewHouse][hCP] = CreateDynamicCP(HouseInfo[NewHouse][hExtX],HouseInfo[NewHouse][hExtY],HouseInfo[NewHouse][hExtZ], 2, 0, 0, -1, 5.0);
HouseInfo[NewHouse][hPickupEX] = CreateDynamicPickup(1273, 23, HouseInfo[NewHouse][hExtX],HouseInfo[NewHouse][hExtY],HouseInfo[NewHouse][hExtZ], 0, 0, -1, 10.0 );
}
}
return 1;
}