[AJUDA] /mudarnick
#7

pode ser em strcmp?

si for pega ai:

pawn Код:
//no topo do gm:
new mudarnick[MAX_PLAYERS];

// nos comandos:

if(strcmp(cmd, "/mudarnome", true) == 0)
    {
        if(mudarnick[playerid] < 1) return SendClientMessage(playerid,-1,"Vc precisa de uma autorizaзгo para trocar de nick");
        new arq[30],arq2[30],novonome[24],str[50];
        novonome = strtok(cmdtext,idx);
        if(!strlen(novonome)) return SendClientMessage(playerid,-1,"Uso: /mudarnome [nome]");
        format(arq,sizeof(arq),"/contas/%s.ini",pName(playerid));
        format(arq2,sizeof(arq2),"/contas/%s.ini",novonome);
        frename(arq,arq2);
        format(str,50,"Vocк mudou seu nome para: %s",novonome);
        SendClientMessage(playerid,-1,str);
        Kick(playerid);
        mudarnick[playerid] = 0;
        return 1;
    }
   
    if(strcmp(cmd, "/permitirmn", true) == 0)
    {
        if(pAdmin[playerid] < 3) return SendClientMessage(playerid,-1,"Vc nгo pode fazer isto.");
        new id[50];
        id = strtok(cmdtext,idx);
        if(!strlen(id)) return SendClientMessage(playerid,-1,"Uso: /permitirmn [id]");
        if(mudarnick[strval(id)] == 1) return SendClientMessage(playerid,-1,"Esse Player ja estб mudando de nick");
        mudarnick[strval(id)] = 1;
        return 1;
    }

// no final do gm:

stock pName(playerid)
{
    new name[25];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}

frename(oldfile [], newfile []) // by [S]trong
{
    if (!fexist(oldfile))
    {
        return print("Error: Could file not found!");
    }

    new String [256],
        File: oldarchive = fopen(oldfile, io_read),
        File: newarchive = fopen(newfile, io_write);

    while (fread(oldarchive, String))
    {
        fwrite(newarchive, String);
    }
   
    fclose(newarchive);
    fclose(oldarchive);

    return fremove(oldfile);
}
Reply


Messages In This Thread
[AJUDA] /mudarnick - by GuiihCamargo - 18.03.2012, 23:55
Re: [AJUDA] /mudarnick - by shadauer - 18.03.2012, 23:57
Re: [AJUDA] /mudarnick - by GuiihCamargo - 19.03.2012, 00:17
Re: [AJUDA] /mudarnick - by The_Zer0CooL - 19.03.2012, 16:50
Re: [AJUDA] /mudarnick - by humildadeforever - 19.03.2012, 17:28
Re: [AJUDA] /mudarnick - by GuiihCamargo - 19.03.2012, 20:08
Re: [AJUDA] /mudarnick - by steeldark - 19.03.2012, 23:27
Re: [AJUDA] /mudarnick - by GuiihCamargo - 20.03.2012, 01:36
Re: [AJUDA] /mudarnick - by GuiihCamargo - 20.03.2012, 22:37
Re: [AJUDA] /mudarnick - by steeldark - 20.03.2012, 22:44

Forum Jump:


Users browsing this thread: 1 Guest(s)