17.12.2013, 04:20
Hi, I'm creating my own home system, I add the key but can not do wrong when I enter the password nothing happens
SET HOUSE PASSWORD
Entering password
FUCTION TO LOAD HOUSE
that can not do evil, help me please
SET HOUSE PASSWORD
pawn Код:
if(dialogid == DIALOG_HOUSE_PASSWORD + 1)
{
if(response)
{
if(strfind(inputtext, "%", false) != -1 || strfind(inputtext, "~", false) != -1) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF} Invalid, no use %, ~");
if(strlen(inputtext) > 16)
{
SendClientMessage(playerid,COLOR_RED,"[ERROR]{FFFFFF} Your password is too long.");
return 1;
}
if(strlen(inputtext) >= 3)
{
WP_Hash(hInfo[InHouse[playerid]][hpassword], 129, inputtext);
format(fquery, sizeof(fquery), "UPDATE `HOUSEINFO` SET Password = '%s' WHERE `ID` = '%d'", hInfo[InHouse[playerid]][hpassword], InHouse[playerid]);
db_query(HouseData, fquery); //Queries the SQLite database.
format(fquery, sizeof(fquery), "[HOUSE]{FFFFFF} You have changed the password of the house to %s", inputtext);
SendClientMessage(playerid, COLOR_SERVER, fquery);
}
else
{
SendClientMessage(playerid,COLOR_RED,"[ERROR]{FFFFFF} Your password is too short.");
}
}
}
pawn Код:
if(dialogid == DIALOG_HOUSE_PASSWORD + 2)
{
if(response)
{
new buf[129];
WP_Hash(buf, 129, inputtext);
if(!strcmp(buf, hInfo[InHouse[playerid]][hpassword], false))
{
SendClientMessageToAll(COLOR_SERVER, "WIII WORK *-* xd");
}
}
}
pawn Код:
forward FUNCTION_LoadHouses();
public FUNCTION_LoadHouses()
{
new DBResult:HOUSE_RESULT;
new ftd[75];
HOUSE_RESULT = db_query(HouseData, "SELECT * FROM `HOUSEINFO`");
if(db_num_rows(HOUSE_RESULT) > 0) // Logged In
{
new id;
for (new x=0; x<db_num_rows(HOUSE_RESULT); x++)
{
db_get_field_assoc(HOUSE_RESULT, "ID", ftd, 26);
id = strval(ftd);
db_get_field_assoc(HOUSE_RESULT, "Title", ftd, 100);
format(hInfo[id][Hname], 100, "%s", ftd);
db_get_field_assoc(HOUSE_RESULT, "Owner", ftd, 24);
format(hInfo[id][owner], 24, "%s", ftd);
db_get_field_assoc(HOUSE_RESULT, "Price", ftd, 30);
hInfo[id][costprice] = strval(ftd);
db_get_field_assoc(HOUSE_RESULT, "Password", ftd, 30);
hInfo[id][hpassword] = strval(ftd);
db_get_field_assoc(HOUSE_RESULT, "EnterX", ftd, 30);
hInfo[id][hEnterPos][0] = floatstr(ftd);
db_get_field_assoc(HOUSE_RESULT, "EnterY", ftd, 30);
hInfo[id][hEnterPos][1] = floatstr(ftd);
db_get_field_assoc(HOUSE_RESULT, "EnterZ", ftd, 30);
hInfo[id][hEnterPos][2] = floatstr(ftd);
db_get_field_assoc(HOUSE_RESULT, "Type", ftd, 30);
hInfo[id][Type] = strval(ftd);
//native CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
hInfo[id][hcheckpointidx][0] = CreateDynamicCP(hInfo[id][hEnterPos][0], hInfo[id][hEnterPos][1], hInfo[id][hEnterPos][2], 1.0, 0, -1, -1, 50.0);
format(fquery, sizeof(fquery), HOUSE_LABEL, hInfo[id][Hname], id, hInfo[id][owner], Comma(hInfo[id][costprice]));
hInfo[id][htextid][0] = Create3DTextLabel(fquery, 0x00bbffFF, hInfo[id][hEnterPos][0], hInfo[id][hEnterPos][1], hInfo[id][hEnterPos][2] + 0.5, 15.0, 0, 0);
switch(hInfo[id][Type])
{
case 0:
{
hInfo[id][hcheckpointidx][1] = CreateDynamicCP(271.884979, 306.631988, 999.148437, 1.0, 15500000+id , 2, -1, 5.0); // Default house
hInfo[id][htextid][1] = Create3DTextLabel("[Exit]", 0x00bbffFF, 271.884979, 306.631988, 999.148437, 8.0, 15500000+id, 1);
}
}
db_next_row(HOUSE_RESULT);
}
}
houseid = db_num_rows(HOUSE_RESULT);
return 1;
}