15.02.2015, 14:45
Hey guys,
Iґm still working on my Attack and Defend gamemode and actually I try to create a /build command for bases.
The Positions are getting printed in the debugmode but it just dont saves the values in the database.
I want it to add a new row with continueing IDґs
@Edit: Here is a Screenshot of the DB: http://www11.pic-upload.de/15.02.15/jdws6ld2syhj.png
Here is the code:
And here is the text out of the rcon console
But it just doesnt saves it in the ID, I dont know what Iґm doing wrong
Iґm still working on my Attack and Defend gamemode and actually I try to create a /build command for bases.
The Positions are getting printed in the debugmode but it just dont saves the values in the database.
I want it to add a new row with continueing IDґs
@Edit: Here is a Screenshot of the DB: http://www11.pic-upload.de/15.02.15/jdws6ld2syhj.png
Here is the code:
PHP код:
CMD:savebase(playerid, params[])
{
if(BuildMode[playerid] == 1)
{
if(BuildProgress[playerid] == 6)
{
new string[128],query[1024];
mysql_format(mysql, query, sizeof(query), "INSERT INTO `bases` (`Name`, `Description`, `Creater`, `Interior`, `aPosX`, `aPosY`, `aPosZ`, `aFacingAng`, `dPosX`, `dPosY`, `dPosZ`, `dFacingAng`, `cpPosX`, `cpPosY`, `cpPosZ`) VALUES ('%s', '%s', '%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f')", BuildInfo[playerid][BaseName], BuildInfo[playerid][Description],PlayerName(playerid), BuildInfo[playerid][Interior],
BuildInfo[playerid][aPosX],BuildInfo[playerid][aPosY],BuildInfo[playerid][aPosZ],BuildInfo[playerid][aFacingAng],BuildInfo[playerid][dPosX],BuildInfo[playerid][dPosY],BuildInfo[playerid][dPosZ],BuildInfo[playerid][dFacingAng],
BuildInfo[playerid][cpPosX],BuildInfo[playerid][cpPosY],BuildInfo[playerid][cpPosZ]);
BuildInfo[playerid][ID] = cache_insert_id();
printf(query); //Debug
BuildProgress[playerid] = 0;
BuildMode[playerid] = 0;
SpawnPlayer(playerid);
format(string, sizeof string,"{4BFF5D}Your base have been saved! {FFFFFF}ID: %d",BuildInfo[playerid][ID]);
SendClientMessage(playerid,0x4BFF5DFF,string);
printf("%s created a new base - ID: %d",PlayerName(playerid), BuildInfo[playerid][ID]);
}
else return SendClientMessage(playerid,0xFFFFFFFF,"{FFFFFF}Error: {791A1A}You cant use this command yet!");
}
else return SendClientMessage(playerid,0xFFFFFFFF,"{FFFFFF}Error: {791A1A}You are currently not in the Buildmode!");
return 1;
}
Quote:
[16:16:51] INSERT INTO `bases` (`Name`, `Description`, `Creater`, `Interior`, `aPosX`, `aPosY`, `aPosZ`, `aFacingAng`, `dPosX`, `dPosY`, `dPosZ`, `dFacingAng`, `cpPosX`, `cpPosY`, `cpPosZ`) VALUES ('saize test wf lobby', 'so pro', '[PeM]Saize420', '18', '1728.435', '-1668.262', '22.609', '22.609', '1728.563', '-1668.736', '22.609', '22.609', '1726.611', '-1668.707', '22.58') [16:16:51] [PeM]Saize420 created a new base - ID: 0 |