Saving Co-Ords
#1

Hey,

Well i'm trying to make this faction system but with the command /factioncreate, The coordinates and the interior get set as 0.

pawn Код:
dcmd_factioncreate(playerid, params[])
{
  new gangcount, name, giveplayerid;
  if (sscanf(params, "si", name, giveplayerid)) return SendClientMessage(playerid, COLOR_HOTPINK, "[VT ERROR] Right Usage: /factioncreate [FName] [LID]");
  else
  {
    new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        new Float:interior;
        interior = GetPlayerInterior(playerid);
        gangcount = djInt("GangCount", "Count")+ 1;
        format(query,sizeof(query),"INSERT INTO `factions` (sqlid, spawnx,spawny, spawnz, spawnint ,wep1, wep2, wep3, wep4, skin, leaderskin, bank, leaderid) VALUES (%d,%f,%f,%f,%d,%d,%d,%d,%d,%d,%d,%d,%d)", gangcount,x,y,z, interior, 24, 29, 5, 25, 0, 0, 0, giveplayerid);
        mysql_query(query);
    }
    return 1;
}
With the mysql log I got this:



Код:
[16:24:07] CMySQLHandler::Query(INSERT INTO `factions` (sqlid, spawnx,spawny, spawnz, spawnint ,wep1, wep2, wep3, wep4, skin, leaderskin, bank, leaderid) VALUES (10,0.000000,0.000000,0.000000,0,24,29,5,25,0,0,0,0)) - Successfully executed.
Anyone know why this happens?

thanks
James
Reply
#2

Код:
new Float:interior;
GetPlayerInterior() does not return a float but a integer variable.
Use the below instead
Код:
new interior;
Код:
dcmd_factioncreate(playerid, params[])
{
  new gangcount, name, giveplayerid;
  if (sscanf(params, "si", name, giveplayerid)) return SendClientMessage(playerid, COLOR_HOTPINK, "[VT ERROR] Right Usage: /factioncreate [FName] [LID]");
  new 
      Float:fl[3],
      interior = GetPlayerInterior(playerid);
  GetPlayerPos(playerid, fl[0], fl[1], fl[2]);
  format(query, sizeof(query), "INSERT INTO `factions` (`sqlid`, `spawnx`, `spawny`, `spawnz`, `spawnint`, `wep1`, `wep2`, `wep3`, `wep4`, `skin`, `leaderskin`, `bank`, `leaderid`) VALUES ('%d', '%f', '%f', '%f', '%d', '24', '29', '5', '25', '0', '0', '0', '%d')", gangcount, fl[0], fl[1], fl[2], interior, giveplayerid);
  samp_mysql_query(query);
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)