14.01.2014, 00:25
pawn Код:
YCMD:changename(playerid, params[], help)
{
if(help) return SCM(playerid, COLOR_GREY, "Not supported");
if(IsPlayerConnected(playerid))
{
if(CanChangeName[playerid] == 0) return SCM(playerid, COLOR_GREY, "* For security reasons, you need to authorize the name change first! (/account)");
new string[256], tmp[24];
if(sscanf(params, "s[60]", tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /changename [NewName]");
return 1;
}
if(PlayerInfo[playerid][pShiftName] == 0 && GetPlayerMoney(playerid) < 75000) return SCM(playerid, COLOR_GREY, "* You do not have enough money!");
if(ChangedName[playerid] == 1) return SCM(playerid, COLOR_GREY, "* You have now changed your name.");
if(!IsPlayerInRangeOfPoint(playerid, 3, 358.3578,167.7956,1008.3828) && PlayerInfo[playerid][pShiftName] == 0) return SCM(playerid, COLOR_GREY, "* You are not at the City Hall Desk, Nor you have a Free Changename!");
new csql[256], namestring = strfind(tmp, "_", true);
format(csql, sizeof(csql), "SELECT name FROM users WHERE `name`='%s'", tmp);
mysql_tquery(dbhandle, csql, "", "");
if(namestring == -1)
{
return SCM(playerid, COLOR_LIGHTRED, "You ALMOST forgot the UNDERSCORE ( _ ) in your name!");
}
else
{
format(string, sizeof(string),"* Your have successfuly changed your name to %s", tmp);
SCM(playerid, COLOR_LIGHTRED, string);
new housekey = PlayerInfo[playerid][pPhousekey];
new bizzkey = PlayerInfo[playerid][pPbiskey];
new carkey1 = PlayerInfo[playerid][pPcarkey];
new carkey2 = PlayerInfo[playerid][pPcarkey2];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playerid][pShiftName] == 0)
{
SafeGivePlayerMoney(playerid, -75000);
}
if(PlayerInfo[playerid][pPhousekey] != 9999)
{
new query[500];
format(query, sizeof(query), "UPDATE properties SET owner='%s' WHERE owner='%s'", tmp, sendername);
mysql_tquery(dbhandle, query, "", "");
strmid(HouseInfo[housekey][hOwner],query,0,strlen(query),255);
OnPropTextdrawUpdate(1, housekey);
SCM(playerid, TEAM_GROVE_COLOR,"* House ownership changed successfuly!");
}
if(PlayerInfo[playerid][pPbiskey] != 9999)
{
new query[500];
format(query, sizeof(query), "UPDATE business SET owner='%s' WHERE owner='%s'", tmp, sendername);
mysql_tquery(dbhandle, query, "", "");
strmid(BizzInfo[bizzkey][bOwner],query,0,strlen(query),255);
OnPropTextdrawUpdate(2, bizzkey);
SCM(playerid, TEAM_GROVE_COLOR,"* Business ownership changed successfuly!");
}
if(PlayerInfo[playerid][pPcarkey] != 9999)
{
new query[500];
format(query, sizeof(query), "UPDATE vehicles SET owner='%s' WHERE owner='%s'", tmp, sendername);
mysql_tquery(dbhandle, query, "", "");
strmid(CarInfo[carkey1][cOwner],query,0,strlen(query),255);
SCM(playerid, TEAM_GROVE_COLOR,"* First Vehicle ownership changed successfuly!");
}
if(PlayerInfo[playerid][pPcarkey2] != 9999)
{
new query[500];
format(query, sizeof(query), "UPDATE vehicles SET owner='%s' WHERE owner='%s'", tmp, sendername);
mysql_tquery(dbhandle, query, "", "");
strmid(CarInfo[carkey2][cOwner],query,0,strlen(query),255);
OnPropTextdrawUpdate(1, housekey);
SCM(playerid, TEAM_GROVE_COLOR,"* Second Vehicle ownership changed successfuly!");
}
new query[500];
format(query, sizeof(query), "UPDATE users SET name='%s' WHERE name='%s'", tmp, sendername);
mysql_tquery(dbhandle, query, "", "");
SetPlayerName(playerid, tmp);
ChangeNameTimer = repeat ChangeYourName[1500]( playerid);
ChangedName[playerid] = 1;
if(PlayerInfo[playerid][pShiftName] == 1) { PlayerInfo[playerid][pShiftName] = 0; SCM(playerid, COLOR_GREY, "* You used your Shiftname Rights!"); }
}
}
return 1;
}
pawn Код:
[02:30:30] [DEBUG] mysql_tquery - connection: 1, query: "SELECT name FROM users WHERE `name`='Matt_NewName'", callback: "(null)", format: "(null)"
[02:30:30] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called
[02:30:30] [DEBUG] mysql_tquery - scheduling query "SELECT name FROM users WHERE `name`='Matt_NewName'"..
[02:30:30] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE properties SET owner='Matt_Newname' WHERE owner='Matt_Oldna", callback: "(null)", format: "(null)"
[02:30:30] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called
[02:30:30] [DEBUG] mysql_tquery - scheduling query "UPDATE properties SET owner='Matt_Haigh' WHERE owner='Matt_Oldna'"..
[02:30:30] [DEBUG] CMySQLQuery::Execute[()] - starting query execution
[02:30:30] [DEBUG] CMySQLQuery::Execute[()] - query was successful
Matt_NewName
Matt_Oldname
It's saying "Matt_Oldna", is there any reason it should be doing this?