03.07.2012, 11:32
Hey guys i have problem within this command and function.... everytime i try to make a house i see the server console gives me an warning: sscanf warning: No default value found. I tryed recompile with all sscanf versions but it didn't help... i have all correct plugins, scriptfiles I also don't get any error or warning when i compile. So please tell me what is wrong with the command
Regards Rg-Gaming
Command
Function SaveHouse
Regards Rg-Gaming
Command
pawn Код:
CMD:houseedit(playerid, params[])
{
new string[128], choice[32], houseid, amount;
if(sscanf(params, "s[32]dD", choice, houseid, amount))
{
SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /hedit [name] [houseid] [(Optional)amount]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, CustomInterior, CustomExterior, Class (1-3), Level, Price");
return 1;
}
if(strcmp(choice, "interior", true) == 0)
{
GetPlayerPos(playerid, HouseInfo[houseid][hInteriorX], HouseInfo[houseid][hInteriorY], HouseInfo[houseid][hInteriorZ]);
GetPlayerFacingAngle(playerid, HouseInfo[houseid][hInteriorA]);
HouseInfo[houseid][hHInteriorWorld] = GetPlayerInterior( playerid );
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the interior!" );
SaveHouse(houseid);
format(string, sizeof(string), "%s has edited HouseID %d's Interior.", GetPlayerNameEx(playerid), houseid);
Log("logs/hedit.log", string);
return 1;
}
else if(strcmp(choice, "custominterior", true) == 0)
{
if(HouseInfo[houseid][hCustomInterior] == 0)
{
HouseInfo[houseid][hCustomInterior] = 1;
SendClientMessageEx( playerid, COLOR_WHITE, "House set to custom interior!" );
}
else
{
HouseInfo[houseid][hCustomInterior] = 0;
SendClientMessageEx( playerid, COLOR_WHITE, "House set to normal (not custom) interior!" );
}
SaveHouse(houseid);
format(string, sizeof(string), "%s has edited HouseID %d's Custom Interior.", GetPlayerNameEx(playerid), houseid);
Log("logs/hedit.log", string);
return 1;
}
else if(strcmp(choice, "customexterior", true) == 0)
{
if(HouseInfo[houseid][hCustomExterior] == 0)
{
HouseInfo[houseid][hCustomExterior] = 1;
SendClientMessageEx( playerid, COLOR_WHITE, "House set to custom exterior!" );
}
else
{
HouseInfo[houseid][hCustomExterior] = 0;
SendClientMessageEx( playerid, COLOR_WHITE, "House set to normal (not custom) exterior!" );
}
SaveHouse(houseid);
format(string, sizeof(string), "%s has edited HouseID %d's Custom Exterior.", GetPlayerNameEx(playerid), houseid);
Log("logs/hedit.log", string);
return 1;
}
else if(strcmp(choice, "exterior", true) == 0)
{
GetPlayerPos(playerid, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
GetPlayerFacingAngle(playerid, HouseInfo[houseid][hExteriorA]);
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the exterior!" );
DestroyPickupEx(HouseInfo[houseid][hPickupID]);
SaveHouse(houseid);
format(string, sizeof(string), "%s has edited HouseID %d's Exterior.", GetPlayerNameEx(playerid), houseid);
Log("logs/hedit.log", string);
if(HouseInfo[houseid][hOwned] ==0)
{
DestroyPickupEx(HouseInfo[houseid][hPickupID]);
DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
format(string, sizeof(string), "This house is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel( string, COLOR_GREEN, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,10.0, .testlos = 1, .streamdistance = 10.0);
HouseInfo[houseid][hPickupID] = CreatePickupEx(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
}
else
{
if(HouseInfo[houseid][hRentable] == 0)
{
DestroyPickupEx(HouseInfo[houseid][hPickupID]);
DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
format(string, sizeof(string), "This house is owned by\n%s\nLevel: %d\nID: %d",HouseInfo[houseid][hOwner],HouseInfo[houseid][hLevel],houseid);
HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel(string,COLOR_GREEN,HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,10.0, .testlos = 1, .streamdistance = 10.0);
HouseInfo[houseid][hPickupID] = CreatePickupEx(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
}
else
{
DestroyPickupEx(HouseInfo[houseid][hPickupID]);
DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
format(string, sizeof(string), "This house is owned by\n%s\nRent: $%d\nLevel: %d\nID: %d\nType /rentroom to rent a room",HouseInfo[houseid][hOwner],HouseInfo[houseid][hRentFee],HouseInfo[houseid][hLevel],houseid);
HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel(string,COLOR_GREEN,HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,10.0, .testlos = 1, .streamdistance = 10.0);
HouseInfo[houseid][hPickupID] = CreatePickupEx(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
}
}
}
else if(strcmp(choice, "level", true) == 0)
{
HouseInfo[houseid][hLevel] = amount;
format(string, sizeof(string), "You have set the house level to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(HouseInfo[houseid][hOwned] ==0)
{
format(string, sizeof(string), "This house is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
}
else
{
if(HouseInfo[houseid][hRentable] == 0)
{
format(string, sizeof(string), "This house is owned by\n%s\nLevel: %d\nID: %d",HouseInfo[houseid][hOwner],HouseInfo[houseid][hLevel],houseid);
UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
}
else
{
format(string, sizeof(string), "This house is owned by\n%s\nRent: $%d\nLevel: %d\nID: %d\nType /rentroom to rent a room",HouseInfo[houseid][hOwner],HouseInfo[houseid][hRentFee],HouseInfo[houseid][hLevel],houseid);
UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
}
}
format(string, sizeof(string), "%s has edited HouseID %d's Level to %d.", GetPlayerNameEx(playerid), houseid, amount);
Log("logs/hedit.log", string);
}
else if(strcmp(choice, "price", true) == 0)
{
HouseInfo[houseid][hValue] = amount;
format(string, sizeof(string), "You have set the houses price to $%d.", amount );
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(HouseInfo[houseid][hOwned] ==0)
{
format(string, sizeof(string), "This house is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
}
format(string, sizeof(string), "%s has edited HouseID %d's Price to $%d.", GetPlayerNameEx(playerid), amount);
Log("logs/hedit.log", string);
}
else if(strcmp(choice, "class", true) == 0)
{
switch(amount)
{
case 1:
{
format(HouseInfo[houseid][hDescription], 128, "Low" );
SendClientMessageEx(playerid, COLOR_WHITE, "You have set the house's class to 1 (Low)" );
}
case 2:
{
format(HouseInfo[houseid][hDescription], 128, "Medium" );
SendClientMessageEx(playerid, COLOR_WHITE, "You have set the house's class to 2 (Medium)" );
}
case 3:
{
format(HouseInfo[houseid][hDescription], 128, "High" );
SendClientMessageEx(playerid, COLOR_WHITE, "You have set the house's class to 3 (High)" );
}
}
if(HouseInfo[houseid][hOwned] ==0)
{
format(string, sizeof(string), "This home is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
}
format(string, sizeof(string), "%s has edited HouseID %d's Class to %d.", GetPlayerNameEx(playerid), houseid, amount);
Log("logs/hedit.log", string);
}
SaveHouse(houseid);
return 1;
}
pawn Код:
stock SaveHouse(houseid)
{
new string[2048];
format(string, sizeof(string), "UPDATE `houses` SET \
`Owned`=%d, \
`Level`=%d, \
`HInteriorWorld`=%d, \
`Description`='%s', \
`Owner`='%s', \
`ExteriorX`=%f, \
`ExteriorY`=%f, \
`ExteriorZ`=%f, \
`ExteriorR`=%f, \
`InteriorX`=%f, \
`InteriorY`=%f, \
`InteriorZ`=%f, \
`InteriorR`=%f,",
HouseInfo[houseid][hOwned],
HouseInfo[houseid][hLevel],
HouseInfo[houseid][hHInteriorWorld],
HouseInfo[houseid][hDescription],
HouseInfo[houseid][hOwner],
HouseInfo[houseid][hExteriorX],
HouseInfo[houseid][hExteriorY],
HouseInfo[houseid][hExteriorZ],
HouseInfo[houseid][hExteriorR],
HouseInfo[houseid][hInteriorX],
HouseInfo[houseid][hInteriorY],
HouseInfo[houseid][hInteriorZ],
HouseInfo[houseid][hInteriorR]
);
format(string, sizeof(string), "%s \
`Lock`=%d, \
`Rentable`=%d, \
`RentFee`=%d, \
`Value`=%d, \
`SafeMoney`=%d, \
`Pot`=%d, \
`Crack`=%d, \
`Materials`=%d, \
`Weapons0`=%d, \
`Weapons1`=%d, \
`Weapons2`=%d, \
`Weapons3`=%d, \
`Weapons4`=%d, \
`GLUpgrade`=%d, \
`CustomInterior`=%d, \
`CustomExterior`=%d, \
`ExteriorA`=%f, \
`InteriorA`=%f WHERE `id`=%d",
string,
HouseInfo[houseid][hLock],
HouseInfo[houseid][hRentable],
HouseInfo[houseid][hRentFee],
HouseInfo[houseid][hValue],
HouseInfo[houseid][hSafeMoney],
HouseInfo[houseid][hPot],
HouseInfo[houseid][hCrack],
HouseInfo[houseid][hMaterials],
HouseInfo[houseid][hWeapons][0],
HouseInfo[houseid][hWeapons][1],
HouseInfo[houseid][hWeapons][2],
HouseInfo[houseid][hWeapons][3],
HouseInfo[houseid][hWeapons][4],
HouseInfo[houseid][hGLUpgrade],
HouseInfo[houseid][hCustomInterior],
HouseInfo[houseid][hCustomExterior],
HouseInfo[houseid][hExteriorA],
HouseInfo[houseid][hInteriorA],
houseid+1
);
mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
}
stock SaveHouses()
{
for(new i = 0; i < MAX_HOUSES; i++)
{
SaveHouse(i);
}
return 1;
}