18.02.2012, 20:36
Hey - I'm kinda tired this morning, i'm looking at this code and I'm just not seeing the error.
Could a fresh pair of eyes check it out and tell me wassup with it:
Works fine when there's a clantag, but it won't reattatch it..
It also scrambles the name into odd unicode characters for global chat, but not for anything else.
ehhhhhh
Could a fresh pair of eyes check it out and tell me wassup with it:
pawn Код:
CMD:setname(playerid, params[])
{
new TargetID;
new NewName[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(sscanf(params, "us[25]", TargetID, NewName) == 0 && NewName[0] != '[')
{
if(TargetID != INVALID_PLAYER_ID)
{
if(!DoesUserExist(NewName))
{
new Query[512];
format(ReceiverName, sizeof(ReceiverName), "%s", ConnectedName[TargetID]);
GetPlayerName(playerid, SenderName, sizeof(SenderName));
format(str, sizeof(str), "<A> %s has set %s's name to %s", SenderName, ReceiverName, NewName);
ABroadCast(COLOR_YELLOW, str, 1);
format(str, sizeof(str), "<INFO> Your name has been set to %s by %s", NewName, SenderName);
SendClientMessage(TargetID, COLOR_LIGHTGREEN, str);
format(Query, sizeof(Query), "UPDATE `USERS` SET NAME = '%s' WHERE NAME = '%s'", NewName, ConnectedName[TargetID]);
format(ConnectedName[TargetID], MAX_PLAYER_NAME, NewName);
db_query(Database, Query);
if(PlayerInfo[TargetID][pClan] != 0)
{
new TotalName[MAX_PLAYER_NAME];
new CurClan = PlayerInfo[TargetID][pClan];
new CurTag[30];
format(CurTag, sizeof(CurTag), "%s", ClanInfo[CurClan][gTag], true);
if(strcmp(ClanInfo[CurClan][gName], "Null", true) == 0)
{
PlayerInfo[playerid][pClan] = 0;
format(PlayerInfo[playerid][pClanName], 128, "Null");
format(TotalName, sizeof(TotalName), "%s", ConnectedName[TargetID]);
}
else if(strcmp(PlayerInfo[playerid][pClanName], ClanInfo[CurClan][gName], true) != 0)
{
PlayerInfo[playerid][pClan] = 0;
format(PlayerInfo[playerid][pClanName], 128, "Null");
format(TotalName, sizeof(TotalName), "%s", ConnectedName[TargetID]);
}
else
{
format(TotalName, sizeof(TotalName), "%s%s", CurTag, ConnectedName[TargetID]);
}
SetPlayerName(TargetID, TotalName);
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Error - That name is in use.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /SetName "COL_WHITE"[PlayerID/PartOfName] [Name] (No ClanTags or Numeric names.)");
return 1;
}
}
return 1;
}
It also scrambles the name into odd unicode characters for global chat, but not for anything else.
ehhhhhh