11.12.2015, 11:33
hi, I made a /changename cmd so if I have a house to change name..but it dosent change the name properly..
PHP код:
forward ChangeName(playerid, newname[]);
public ChangeName(playerid, newname[]) {
if(cache_get_row_count(playerid))
{
return SendClientMessage(playerid, -1, "This name doesn't exist!");
}
new current[MAX_PLAYER_NAME];
GetPlayerName(playerid, current, sizeof current);
new query[128];
mysql_format(mysql_db, query, sizeof query, "UPDATE `players` SET `Name` = '%s' WHERE `Name` = '%s'", newname, current);
mysql_tquery(mysql_db, query);
SetPlayerName(playerid, newname);
return 1;
}
PHP код:
dcmd_changename(playerid, params[])
{
if(PlayerToPoint(3.0,playerid,358.5789,166.3685,1008.3828))
{
if(ChangedName[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "testt");
if(isnull(params))
{
return SendClientMessage(playerid, -1, "/changename [new name]");
}
if(strlen(params) > MAX_PLAYER_NAME)
{
return SendClientMessage(playerid, -1, "Name has to have 24 caracters.");
}
new current[MAX_PLAYER_NAME];
GetPlayerName(playerid, current, sizeof current);
if(!strcmp(current, params, false))
{
return SendClientMessage(playerid, -1, "This is already your name!");
}
new housekey = PlayerInfo[playerid][pPhousekey];
if(PlayerInfo[playerid][pPhousekey] != 255)
{
new query[100];
format(query, sizeof(query), "UPDATE houseid SET Owner='%s' WHERE Name='%s'", params, current);
mysql_tquery(mysql_db, query, "", "");
strmid(HouseInfo[housekey][hOwner],query,0,strlen(query),255);
OnPropTextdrawUpdate(1, housekey);
SCM(playerid, TEAM_GROVE_COLOR," test");
}
new query[128];
mysql_format(mysql_db, query, sizeof query, "SELECT * FROM `players` WHERE `Name` = '%s'", params);
mysql_tquery(mysql_db, query, "ChangeName", "is", playerid, params);
//return 1;
}
return 1;
}