[Ajuda] Retirar arma
#3

Testah aew, Avisa se funcionou Aki Manin '-'

pawn Код:
if(pickupid == EntrarDP)
    {
    SaveWeapons(playerid); // ADICIONADO
    SendClientMessage(playerid, 0xBCD2EEAA,"(INFO) Vocк entrou no Departamento de Polнcia de Fort Carson,   tenha muito respeito dentro do mesmo!");
    GameTextForPlayer(playerid, "~b~DP", 3000, 6);
    SetPlayerPos(playerid,322.0163,304.4047,999.1484);
    SetPlayerInterior(playerid,5);
    ResetPlayerWeapons(playerid); // ADICIONADO
    }
    if(pickupid == SairDP)
    {
    SendClientMessage(playerid, 0xBCD2EEAA,"(INFO) Vocк saiu do Departamento de  Polнcia de Fort Carson!");
    SetPlayerPos(playerid,-213.9483,979.2734,19.3348);
    SetPlayerInterior(playerid,0);
    LoadWeapons(playerid); // ADICIONADO
    }



stock SaveWeapons(playerid)  // ADICIONADO
{
    new File:arquivo, File:ftmp, tmp[256], fname[30], pname[30], arma[13], municao[13];
    arquivo = fopen(WEAPON_FILE, io_readwrite);
    ftmp = fopen(WEAPON_FILE#.tmp, io_write);
    GetPlayerName(playerid, pname, sizeof pname);
    while(fread(arquivo, tmp, sizeof tmp, false))
    {
        new off[256], index;
        off = strtok(tmp, index);
        strmid(fname, off, 0, strlen(off));
        if(!strcmp(pname, fname, false))continue;
        format(tmp, sizeof tmp, "%s", tmp);
        fwrite(ftmp, tmp);
    }
    fclose(arquivo);
    fclose(ftmp);
    fremove(WEAPON_FILE);
    arquivo = fopen(WEAPON_FILE, io_write);
    ftmp = fopen(WEAPON_FILE#.tmp, io_read);
    while(fread(ftmp, tmp))
    {
        format(tmp, sizeof tmp, "%s", tmp);
        fwrite(arquivo, tmp);
    }
    fclose(ftmp);
    fremove(WEAPON_FILE#.tmp);
    for(new i; i < 12; i++)GetPlayerWeaponData(playerid, i+1, arma[i+1], municao[i+1]);
    format(tmp, sizeof tmp, "%s ", pname);
    for(new a; a < 24; a++)
    {
        new s[10];
        if(a < 12)
        {
            format(s, sizeof s, "%d ", arma[a]);
            strcat(tmp, s);
        } else {
            format(s, sizeof s, "%d ", municao[a-12]);
            strcat(tmp, s);
        }
    }
    strcat(tmp, "\r\n");
    fwrite(arquivo, tmp);
    fclose(arquivo);
    return 1;
}


stock LoadWeapons(playerid)  // ADICIONADO
{
    new File:arquivo, tmp[256], fname[30], pname[30], arma[13], municao[13];
    arquivo = fopen(WEAPON_FILE, io_read);
    GetPlayerName(playerid, pname, sizeof pname);
    while(fread(arquivo, tmp, sizeof tmp, false))
    {
        new off[256], index;
        off = strtok(tmp, index);
        strmid(fname, off, 0, strlen(off));
        if(strcmp(pname, fname, false) != 0)continue;
        for(new a; a < 12; a++)arma[a] = strval(strtok(tmp, index));
        for(new m; m < 12; m++)municao[m] = strval(strtok(tmp, index));
        for(new i; i < 12; i++)
        {
            if(arma[i] > 0 && arma[i] < 47 && municao[i] > 0)GivePlayerWeapon(playerid, arma[i], municao[i]);
        }
    }
    fclose(arquivo);
    return 1;
}
Em Caso de Dъvidas manda Msg por Privado ^_^
Reply


Messages In This Thread
Retirar arma - by clerISoN - 02.06.2013, 18:29
Re: Retirar arma - by Cromado - 02.06.2013, 18:49
Re: Retirar arma - by VivendoVirtual - 02.06.2013, 18:54
Re: Retirar arma - by Cromado - 02.06.2013, 19:13
Re: Retirar arma - by clerISoN - 02.06.2013, 21:04
Re: Retirar arma - by Cromado - 02.06.2013, 21:06
Re: Retirar arma - by clerISoN - 02.06.2013, 21:12
Re: Retirar arma - by VivendoVirtual - 02.06.2013, 21:25
Re: Retirar arma - by clerISoN - 02.06.2013, 21:30
Re: Retirar arma - by Don_Speed - 02.06.2013, 21:31

Forum Jump:


Users browsing this thread: 1 Guest(s)