[Pedido] /prender [id] [motivo] [tempo]
#1

Procurei procurei e nгo achei, o unico que achei foi o do Lуs, sу que esta todo bugado e nem funfa direito, pois ele abandonou o script e deixou de atualizar, entгo lб vai, alguem tem o code completo do /prender [id] [motivo] [tempo] para admins prenderem players na cadeia, e se o player relogar ele voltara preso ate cumprir o seu tempo.

Obrigado.
Reply
#2

Use este jб й o sistema completo.

https://sampforum.blast.hk/showthread.php?tid=328660
Reply
#3

Links quebrados. Tem outro?
Reply
#4

new id, motivo, tempo;
sscanf("dds[128]", id, tempo, motivo);

pхe motivo como ultimo cara.

ai vocк salva, e faz o que quiser..
Reply
#5

Cara o codigo nгo estб dando mano vc n entendeu? LINKS QUEBRADOS, COMO VOU ACHAR O SISTEMA DESSE CARA AE?
Reply
#6

achei esse na internet

http://pastebin.com/Gmvy5YCF

e esse pedido de ajuda antigo

ve se te ajuda

https://sampforum.blast.hk/showthread.php?tid=457227
Reply
#7

o do pastebin salva quando o player deslogar ele volta pra cadeia ate cumprir o tempo?
Reply
#8

pawn Код:
CMD:prender(playerid, params[]) {

    static
        id,
        tempo,
        motivo[32]
    ;
   
    if ( sscanf(params, "uis[32]", id, tempo, motivo) )
        return SendClientMessage(playerid, -1, "Use: /prender [id] [tempo(em minutos)] [motivo]");
       
    if (!IsPlayerConnected(id))
        return SendClientMessage(playerid, -1, "Jogador offline!");
       
    static
        tempo_s,
        nome[24],
        nome_admin[24],
        arquivo[35],
        str[128]
    ;
   
    tempo_s = tempo * 60;
   
    GetPlayerName(playerid, nome_admin, 24);
    GetPlayerName(id, nome, 24);

    format (arquivo, 35, "Presos/%s.ini", nome);
   
    if (!fexist(arquivo))
        DOF2_CreateFile(arquivo));
       
    DOF2_SetInt(arquivo, "tempo", tempo_s);
    DOF2_SetString(arquivo, "admin", nome_admin);
    DOF2_SetString(arquivo, "motivo", motivo);
    DOF2_SaveFile();
   
    SetPVarInt(id, "tempo_cadeia", tempo_s);
   
    SetTimerEx("reduzirTempo", 1000, false, "d", id);
   
    // SetPlayerPos(....); // posiзгo da cadeia
    // SetPlayerInterior(..); // interior cadeia
   
    format (str, 128, "AdmCmd: %s prendeu %s por %d minutos, motivo: %s", nome_admin, nome, tempo, motivo);
    SendClientMessageToAll(-1, str);
   
    return 1;
}
forward reduzirTempo(i);
public reduzirTempo(i) {

    SetPVarInt(i, "tempo_cadeia", (GetPVarInt(i, "tempo_cadeia") - 1) );
   
    if ( GetPVarInt(i, "tempo_cadeia") <= 0 ) {
   
        DeletePVar(i, "tempo_cadeia");
       
        static
            nome[24],
            local[35]
        ;
       
        GetPlayerName(i, nome, 24);
       
        format(local, 35, "Presos/%s.ini", nome);
        fremove(local);
       
        SendClientMessage(i, -1, "Vocк esta solto!");
        SpawnPlayer(i);
   
        return 1;
    }
   
    SetTimerEx("reduzirTempo", 1000, false, "d", i);
   
    return 1;
}

public OnPlayerDisconnect(playerid, reason) {

    if ( GetPVarInt(playerid, "tempo_cadeia") != 0 ) {
   
        static
            nome[24],
            local[35]
        ;

        GetPlayerName(playerid, nome, 24);

        format(local, 35, "Presos/%s.ini", nome);
       
        DOF2_SetInt(local, "tempo", GetPVarInt(playerid, "tempo_cadeia"));
        DOF2_SaveFile();
   
    }

    return 1;
}
Logo apуs o jogador efetuar o login e necessбrio verificar se a puniзгo jб foi cumprida.

pawn Код:
static
    nome[24],
    arquivo[35],
    str[128]
;

GetPlayerName(playerid, nome, 24);

format (arquivo, 35, "Presos/%s.ini", nome);

if (fexist(arquivo)) {

    format (str, 128, "Admin: %s - Motivo: %s - Tempo restante: %d segundos", DOF2_GetString(arquivo, "admin"), DOF2_GetString(arquivo, "motivo"), DOF2_GetInt(arquivo, "tempo") );
    SendClientMessage(playerid, -1, "Sentenзa incompleta! Detalhes da prisгo:");
    SendClientMessage(playerid, -1, str);
   
    SetPVarInt(playerid, "tempo_cadeia", DOF2_GetInt(arquivo, "tempo") );
    SetTimerEx("reduzirTempo", 1000, false, "d", playerid);

    // SetPlayerPos(....); // posiзгo da cadeia
    // SetPlayerInterior(..); // interior cadeia
   
}

OBS: Nгo testei, muito menos compilei.

OBS2: Crie a pasta Presos!
Reply
#9

Muito bom sу de olhar o code pirei na batatinha, vou testar jaja obrigado ae, ja dou um edit aqui.
Reply
#10

Aff, deu 9 erros, chaves abertas que n foram fechadas, e agr como vou achar..
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)