16.03.2012, 15:46
Nгo! O certo era deixar os frename, pois sem eles nгo tem como vc mudar o nick dos jogadores. O que esta causando os bugs eh a include Dini e nela tem incluida uma outra include que buga o GM. Entгo faзa isso...
Coloque isso no seu GM(Caso nгo tenha).
Comando para mudar o nick. Atualize para este...
Coloque isso no seu GM(Caso nгo tenha).
pawn Код:
stock fcopy(oldname[],newname[]) {
new File:ohnd,File:nhnd;
if (!fexist(oldname)) return false;
ohnd=fopen(oldname,io_read);
nhnd=fopen(newname,io_write);
new buf2[1];
new i;
for (i=flength(ohnd);i>0;i--) {
fputchar(nhnd, fgetchar(ohnd, buf2[0],false),false);
}
fclose(ohnd);
fclose(nhnd);
return true;
}
stock frename(oldname[],newname[]) {
if (!fexist(oldname)) return false;
fremove(newname);
if (!fcopy(oldname,newname)) return false;
fremove(oldname);
return true;
}
pawn Код:
dcmd_mudarnome(playerid,params[])
{
if(Player[playerid][pAdmin] < 6)
return SendClientMessage(playerid, COLOR_RED, "[ERRO] Vocк nгo tem permissгo para usar este comando!");
new tmp[24],tmp2[256],Index;
tmp = strtok(params,Index);
tmp2 = strtok(params,Index);
if(!strlen(tmp)||!strlen(tmp2))
return SendClientMessage(playerid,COLOR_GREY,"-OperServ- Uso: /mudarnome [conta] [nova conta] [id]");
new tmp3[128];
tmp3 = strtok(params,Index);
if(!strlen(tmp3))
return SendClientMessage(playerid, COLOR_GREY, "[USO] Digite o ID do jogador");
new giveid;
giveid = ReturnUser(tmp3);
if(IsPlayerConnected(giveid))
{
if(giveid != INVALID_PLAYER_ID)
{
if(GetPlayerGP(giveid) < 50000)
return SendClientMessage(playerid, COLOR_RED, "[ERRO] O jogador nгo tem dinheiro suficiente em mгos.");
if(Player[playerid][pAdmin] < 7 && Player[giveid][pAdmin] > 0)
return SendClientMessage(playerid, COLOR_RED, "[ERRO] Vocк nгo pode mudar nome de um Admin!");
new file[256];
format(file,256,"/RPG/users/%s.ini",tmp2);
new oldfile[256];
format(oldfile,256,"/RPG/users/%s.ini",tmp);
new nome[24];
GetPlayerName(giveid, nome, sizeof nome);
if(!DOF2_FileExists(oldfile)) return SendClientMessage(playerid,COLOR_RED,"-OperServ- Erro: A conta antiga nгo existe.");
else if(DOF2_FileExists(file)) return SendClientMessage(playerid,COLOR_RED,"-OperServ- Erro: A nova conta jб existe.");
else
{
if(strfind(nome, tmp, true) == 0)
{
new oldcarro[256];
format(oldcarro,256,"/RPG/carros/%s.ini",tmp);
if(DOF2_FileExists(oldcarro))
{
new vehicleid = GetOwnedVehicleID(giveid);
format(VeiculoNome[vehicleid], MAX_PLAYER_NAME, tmp2);
format(vOwner[vehicleid], MAX_PLAYER_NAME, tmp2);
new newcarro[256];
format(newcarro,256,"/RPG/carros/%s.ini",tmp2);
frename(oldcarro, newcarro);
}
new oldcarrov[256];
format(oldcarrov,256,"/RPG/carrosvip/%s.ini",tmp);
if(DOF2_FileExists(oldcarrov))
{
new vehicleid = GetOwnedVehicleID2(giveid);
format(VeiculoNome[vehicleid], MAX_PLAYER_NAME, tmp2);
format(vOwner[vehicleid], MAX_PLAYER_NAME, tmp2);
new newcarrov[256];
format(newcarrov,256,"/RPG/carrosvip/%s.ini",tmp2);
frename(oldcarrov, newcarrov);
}
format(thestring,128,"-OperServ- Vocк renomeou a conta '%s' para '%s'.", tmp, tmp2);
SendClientMessage(playerid, COLOR_YELLOW, thestring);
format(thestring,128,"%s renomeou a conta '%s' para '%s'.", ReturnPlayer(playerid), tmp, tmp2);
WriteLog("Admins2", thestring);
GivePlayerGP(giveid,-50000);
OnPlayerSave(giveid);
frename(oldfile, file);
SetPlayerName(giveid, tmp2);
format(Player[giveid][pName],MAX_PLAYER_NAME,tmp2);
if(Player[giveid][pMember] > 0)
{
new org[128];
format(org,128,"/RPG/orgs/%s.ini",OrgsNamesSmall[Player[giveid][pMember]]);
for(new i=0;i<sizeof(OrgsCargos);i++)
if(strcmp(DOF2_GetString(org,OrgsCargos[i]),tmp,true)==0)
DOF2_SetString(org,OrgsCargos[i],tmp2), DOF2_SaveFile();
}
new h;
if(Player[giveid][pPhousekey] != 255)
{
h = Player[giveid][pPhousekey];
if(strcmp(tmp, hOwner[h], true) == 0)
{
strmid(hOwner[h], tmp2, 0, strlen(tmp2), 255);
OnPropUpdate();
}
}
if(Player[giveid][pPbiskey] != 255)
{
h = Player[giveid][pPhousekey];
if(Player[giveid][pPbiskey] >= 100)
if(strcmp(tmp, sbOwner[h], true) == 0)
{
strmid(sbOwner[h], tmp2, 0, strlen(tmp2), 255);
OnPropUpdate();
}
else
if(strcmp(tmp, bOwner[h], true) == 0)
{
strmid(bOwner[h], tmp2, 0, strlen(tmp2), 255);
OnPropUpdate();
}
}
}
else
return SendClientMessage(playerid,COLOR_RED,"-OperServ- Erro: O jogador nгo й o dono dessa conta.");
}
}
else
return SendClientMessage(playerid,COLOR_GREY,"O jogador nгo estб online");
}
return 1;
}