House system problem
#1

Hi all!
MY problem is that the houses that i made doesen't have interior, i tried to add from database but nothing happened.
So when i create a house with the command /creeazacasa the house doesen't creates an interior.I think so..
So my script is :
Код HTML:
/-----------------------------------------Comanda-----------------------------------------//
//-----------------------------------------Comanda-----------------------------------------//
if(strcmp(cmd, "/creeazacasa", true) == 0)
{
if(IsPlayerConnected(playerid))
{
   //new houseid = -1;
   new Float:x, Float:y, Float:z, query[100];
   new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
   if(PlayerData[playerid][pAdmin] >= 6)
   {
    if(PlayerData[playerid][pAdmin] >= 6)
    {
//MySQLCHouse();
       tmp = strtok(cmdtext, idx);
       if(!strlen(tmp))
       {
           SendUsage(playerid,"/creeazacasa [tip] [id casa]");
           SendClientMessage(playerid, COLOR_GRAD1, "TipCasa: {FF9900}[0]Lux {00CC00}[1]Bogatas {FFFF00}[2]Miliardar {FF3300}[3]Milionar");
           return 1;
}
new tip;
tip = strval(tmp);
tmp = strtok(cmdtext, idx);
       if(!strlen(tmp))
       {
           SendUsage(playerid,"/creeazacasa [tip] [id casa]");
           SendClientMessage(playerid, COLOR_GRAD1, "TipCasa: {FF9900}[0]Lux {00CC00}[1]Bogatas {FFFF00}[2]Miliardar {FF3300}[3]Milionar");
           return 1;
}
new houseid;
houseid = strval(tmp);
GetPlayerPos(playerid, x, y, z);
HouseData[houseid][hEntrancex] = x;
HouseData[houseid][hEntrancey] = y;
HouseData[houseid][hEntrancez] = z;
format(query, sizeof(query), "INSERT INTO houses (`id`,`Entrancex`) VALUES ('%d','%f')",houseid,x);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Entrancex='%f' WHERE id=%d", HouseData[houseid][hEntrancex], houseid);
    mysql_query(query);
    format(query, sizeof(query), "UPDATE houses SET Entrancey='%f' WHERE id=%d", HouseData[houseid][hEntrancey], houseid);
    mysql_query(query);
    format(query, sizeof(query), "UPDATE houses SET Entrancez='%f' WHERE id=%d", HouseData[houseid][hEntrancez], houseid);
    mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Owner ='The State',Hel = 0,Arm = 0 WHERE id=%d",houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Healthx ='0',Healthy = 0,Healthz = 0 WHERE id=%d",houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Armourx ='0',Armoury = 0,Armourz = 0 WHERE id=%d",houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Takings=0,Date=0 WHERE id=%d",houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Lockk = 0, Owned=0 WHERE id=%d",houseid);
mysql_query(query);
    format(query, sizeof(query), "UPDATE houses SET Rooms='1' WHERE id=%d", houseid);
    mysql_query(query);
    format(query, sizeof(query), "UPDATE houses SET Rent='100' WHERE id=%d", houseid);
    mysql_query(query);
    format(query, sizeof(query), "UPDATE houses SET Rentabil='1' WHERE id=%d", houseid);
    mysql_query(query);
if(tip == 0)
{
   HouseData[houseid][hExitx] = 234.19;
   HouseData[houseid][hExity] = 1063.73;
   HouseData[houseid][hExitz] = 1084.21;
   HouseData[houseid][hValue] = 5000000;
HouseData[houseid][hLevel] = 15;
strmid(HouseData[houseid][hDiscription], "Lux", 0, strlen("Lux"), 255);
HouseData[houseid][hInt] = 6;
format(query, sizeof(query), "UPDATE houses SET Exitx='%f' WHERE id=%d", HouseData[houseid][hExitx], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Exity='%f' WHERE id=%d", HouseData[houseid][hExity], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Exitz='%f' WHERE id=%d", HouseData[houseid][hExitz], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Value='%d' WHERE id=%d", HouseData[houseid][hValue], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Level='%d' WHERE id=%d", HouseData[houseid][hLevel], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Discription='%s' WHERE id=%d", HouseData[houseid][hDiscription], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Int='%d' WHERE id=%d", HouseData[houseid][hInt], houseid);
mysql_query(query);
}
if(tip == 1)
{
   HouseData[houseid][hExitx] = 225.68;
   HouseData[houseid][hExity] = 1021.45;
   HouseData[houseid][hExitz] = 1084.02;
   HouseData[houseid][hValue] = 3500000;
HouseData[houseid][hLevel] = 5;
strmid(HouseData[houseid][hDiscription], "Bogatas", 0, strlen("Bogatas"), 255);
HouseData[houseid][hInt] = 7;
format(query, sizeof(query), "UPDATE houses SET Exitx='%f' WHERE id=%d", HouseData[houseid][hExitx], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Exity='%f' WHERE id=%d", HouseData[houseid][hExity], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Exitz='%f' WHERE id=%d", HouseData[houseid][hExitz], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Value='%d' WHERE id=%d", HouseData[houseid][hValue], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Level='%d' WHERE id=%d", HouseData[houseid][hLevel], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Discription='%s' WHERE id=%d", HouseData[houseid][hDiscription], houseid);
                  mysql_query(query);
                  format(query, sizeof(query), "UPDATE houses SET Int='%d' WHERE id=%d", HouseData[houseid][hInt], houseid);
mysql_query(query);
}
if(tip == 2)
{
   HouseData[houseid][hExitx] = 226.30;
   HouseData[houseid][hExity] = 1114.24;
   HouseData[houseid][hExitz] = 1080.99;
   HouseData[houseid][hValue] = 2500000;
HouseData[houseid][hLevel] = 7;
strmid(HouseData[houseid][hDiscription], "Miliardar", 0, strlen("Miliardar"), 255);
HouseData[houseid][hInt] = 5;
format(query, sizeof(query), "UPDATE houses SET Exitx='%f' WHERE id=%d", HouseData[houseid][hExitx], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Exity='%f' WHERE id=%d", HouseData[houseid][hExity], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Exitz='%f' WHERE id=%d", HouseData[houseid][hExitz], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Value='%d' WHERE id=%d", HouseData[houseid][hValue], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Level='%d' WHERE id=%d", HouseData[houseid][hLevel], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Discription='%s' WHERE id=%d", HouseData[houseid][hDiscription], houseid);
                  mysql_query(query);
                  format(query, sizeof(query), "UPDATE houses SET Int='%d' WHERE id=%d", HouseData[houseid][hInt], houseid);
mysql_query(query);
}
if(tip == 3)
{
   HouseData[houseid][hExitx] = 140.17;
   HouseData[houseid][hExity] = 1366.07;
   HouseData[houseid][hExitz] = 1083.65;
   HouseData[houseid][hValue] = 4500000;
HouseData[houseid][hLevel] = 10;
strmid(HouseData[houseid][hDiscription], "Milionar", 0, strlen("Milionar"), 255);
HouseData[houseid][hInt] = 5;
format(query, sizeof(query), "UPDATE houses SET Exitx='%f' WHERE id=%d", HouseData[houseid][hExitx], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Exity='%f' WHERE id=%d", HouseData[houseid][hExity], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Exitz='%f' WHERE id=%d", HouseData[houseid][hExitz], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Value='%d' WHERE id=%d", HouseData[houseid][hValue], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Level='%d' WHERE id=%d", HouseData[houseid][hLevel], houseid);
mysql_query(query);
format(query, sizeof(query), "UPDATE houses SET Discription='%s' WHERE id=%d", HouseData[houseid][hDiscription], houseid);
                  mysql_query(query);
                  format(query, sizeof(query), "UPDATE houses SET Int='%d' WHERE id=%d", HouseData[houseid][hInt], houseid);
mysql_query(query);
}
format(string, sizeof(string),"{00CC00}Casa creata id: %d.Aceasta casa se seteaza automat.Foloseste {FFFFFF}/edit {00CC00}pentru a edita ceva la casa.",houseid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "{009933}Casa de vanzare! \n {FF9900}Pret: {FFFFFF}%d$ \n {FF9900}Level: {FFFFFF}%d \n {009933}Ca sa o cumperi scrie {FF3300}/buyhouse",HouseData[houseid][hValue],HouseData[houseid][hLevel]);
HouseLabel[houseid] = CreateDynamic3DTextLabel(string,0x00FF00AA,x,y,z,25, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100.0);
OnPropTextdrawUpdate(1, houseid);
}
}
}
return 1;
}
All the house commands are working properly but my house doesen't have interior.
Hope you can help me!
Thanks!.
Reply
#2

It looks like you didn't changed the interior number when you do your queries.

Add an UPDATE query which changes it. Note that each pre-mapped interior (from the solo or added by samp) has its own coordinaries and his own interior, means that you can't change them.

Btw, you can really optimize your queries : you made a query per field whereas you could make a query for all

Example

PHP код:

format
(querysizeof(query), "UPDATE houses SET Exitx = '%f', Exity = '%f', Exitz = '%f', Value = '%d', Level = '%d', Discription = '%s', Int = '%d' WHERE id = '%d' "Parameters_Correspondance);
mysql_query(query); 
Reply
#3

Can you show where to add all the codes?
When i add your code at the end of /creeazacasa i get the following errors:
C:\Users\i7\Desktop\roleplay.pwn(34096) : error 017: undefined symbol "query"
C:\Users\i7\Desktop\roleplay.pwn(34096) : error 017: undefined symbol "query"
C:\Users\i7\Desktop\roleplay.pwn(34096) : error 029: invalid expression, assumed zero
C:\Users\i7\Desktop\roleplay.pwn(34096) : fatal error 107: too many error messages on one line
Please make a pastebin link with my command script to show me where to add your codes.
Thanks!
Reply
#4

I won't gave you a read-made code, I just did not created the "query" array

Solution : new query[256]; before the code.
Reply
#5

Still not working i get now :
C:\Users\i5\Desktop\roleplay.pwn(34097) : error 017: undefined symbol "Parameters_Correspondance"
C:\Users\i5\Desktop\roleplay.pwn(3411 : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(34186) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(34213) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(35780) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(35787) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(38312) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(38812) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(38827) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(39470) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(39710) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(39949) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(40317) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(40389) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(40424) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(40456) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(42033) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(44565) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(44610) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(44806) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(45022) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(45363) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(45550) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(45592) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(45633) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(45699) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(45741) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(4586 : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(46015) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(46026) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(46096) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(46170) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(46210) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(46249) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(46313) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(46353) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(4647 : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(46679) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(48105) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(48165) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(50097) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(5416 : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54181) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54194) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54207) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54220) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54233) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54246) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54259) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54272) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54285) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(5429 : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54311) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54324) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54375) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54392) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54409) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54426) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54443) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54460) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54477) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54494) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54511) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(5452 : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54545) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54562) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54579) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(54889) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(57549) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(58046) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\i5\Desktop\roleplay.pwn(58159) : warning 219: local variable "query" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#6

You are using the query variable two or more times and you already have the query as a global string variable. Simply remove the global 'new query[...];'.

Also, next time please use
Reply
#7

Ok thanks iZN so new query is already putted , how can i fix the /creeazacasa command?
Reply
#8

I mean what i need to do to house have interiors?
Please explain me one more time.
Reply
#9

UP! UP ! UP!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)