[Ajuda] /darvip
#1

galera pq quando eu digito /darvip id o server-samp ele fecha o server cai... nгo sei pq, e mais uma coisa se esse cod de dias estб correto
pawn Код:
if(strcmp(cmd, "/Darvip", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid] == 5){
}
new tmp[256];
new plid;
new year, month,day;
new hour, minute, second;
new giveplayer[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, 0x008040AA, "{0099FF}[x]{CCCCFF} Use: /setarvip [id] [Dias].");
return 1;
}
plid = strval(tmp);
if(IsPlayerConnected(plid)){
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_Vips, pname);
getdate(year, month, day);
gettime(hour,minute,second);
format(string, sizeof(string), "%s deu vip ao %s nнvel %d (%d/%d/%d - %d:%d)",sendername,giveplayer,day, month, year,hour, minute);
dini_IntSet(file2, "VIP",1);
SpawnPlayer(plid);
SendClientMessage(playerid, 0x00FF00AA, "{0099FF}(~){CCCCFF} VIP Setado com sucesso");
SendClientMessage(plid, 0x00FF00AA, "{0099FF}(~){CCCCFF} O Administrador(a)%s Ti Deu VIP de %d Dias aproveite");
return 1;
}else{
SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} ID invбlido");
return 1;
}
}
Reply
#2

Tente assim:
pawn Код:
if(strcmp(cmd, "/Darvip", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid] == 5)
    {
        new tmp[256];
        new plid;
        new year, month,day;
        new hour, minute, second;
        new giveplayer[MAX_PLAYER_NAME];
        new sendername[MAX_PLAYER_NAME];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, 0x008040AA, "{0099FF}[x]{CCCCFF} Use: /setarvip [id] [Dias].");
            return 1;
        }
        plid = ReturnUser(tmp);
        if(IsPlayerConnected(plid))
        {
            new pname[MAX_PLAYER_NAME];
            GetPlayerName(plid, pname, MAX_PLAYER_NAME);
            format(file2, sizeof(file2), PASTA_Vips, pname);
            getdate(year, month, day);
            gettime(hour,minute,second);
            format(string, sizeof(string), "%s deu vip ao %s nнvel %d (%d/%d/%d - %d:%d)",sendername,giveplayer,day, month, year,hour, minute);
            dini_IntSet(file2, "VIP",1);
            SpawnPlayer(plid);
            SendClientMessage(playerid, 0x00FF00AA, "{0099FF}(~){CCCCFF} VIP Setado com sucesso");
            SendClientMessage(plid, 0x00FF00AA, "{0099FF}(~){CCCCFF} O Administrador(a)%s Ti Deu VIP de %d Dias aproveite");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} ID invбlido");
            return 1;
        }
    }
}
Reply
#3

Quote:
Originally Posted by Stronda xD
Посмотреть сообщение
Tente assim:
pawn Код:
if(strcmp(cmd, "/Darvip", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid] == 5)
    {
        new tmp[256];
        new plid;
        new year, month,day;
        new hour, minute, second;
        new giveplayer[MAX_PLAYER_NAME];
        new sendername[MAX_PLAYER_NAME];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, 0x008040AA, "{0099FF}[x]{CCCCFF} Use: /setarvip [id] [Dias].");
            return 1;
        }
        plid = ReturnUser(tmp);
        if(IsPlayerConnected(plid))
        {
            new pname[MAX_PLAYER_NAME];
            GetPlayerName(plid, pname, MAX_PLAYER_NAME);
            format(file2, sizeof(file2), PASTA_Vips, pname);
            getdate(year, month, day);
            gettime(hour,minute,second);
            format(string, sizeof(string), "%s deu vip ao %s nнvel %d (%d/%d/%d - %d:%d)",sendername,giveplayer,day, month, year,hour, minute);
            dini_IntSet(file2, "VIP",1);
            SpawnPlayer(plid);
            SendClientMessage(playerid, 0x00FF00AA, "{0099FF}(~){CCCCFF} VIP Setado com sucesso");
            SendClientMessage(plid, 0x00FF00AA, "{0099FF}(~){CCCCFF} O Administrador(a)%s Ti Deu VIP de %d Dias aproveite");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} ID invбlido");
            return 1;
        }
    }
}
Mano ainda continua assim nгo sei oq faser mais
Reply
#4

Quote:
Originally Posted by Cromado
Посмотреть сообщение
*_* vlw man mais agora o meu sistema de vip ai com dias estб correto? ou tem que fazer forward sauvarvip < tipo assim
Ai estб apenas Com ID, E sim vocк precisa fazer uma callback para salva-lo, caso vocк deseja um sistema complexo com vencimento automatico e dias contados Vocк poderia tentar mais ou Menos assim:

pawn Код:
enum vvinfo
{
    vDia,
    vMes,
    vAno,
    vDiaA,
    vMesA,
    vAnoA
};
new VipInfo[100][vvinfo];

if(strcmp(cmd, "/Darvip", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid] == 5)
    {
        new tmp[256];
        new plid;
        new year, month,day;
        new hour, minute, second;
        new giveplayer[MAX_PLAYER_NAME];
        new sendername[MAX_PLAYER_NAME];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, 0x008040AA, "{0099FF}[x]{CCCCFF} Use: /setarvip [id] [Dias].");
            return 1;
        }
        plid = ReturnUser(tmp);
       
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, 0x008040AA, "{0099FF}[x]{CCCCFF} Use: /setarvip [id] [Dias].");
            return 1;
        }
        dias = strval(tmp);
        if(IsPlayerConnected(plid) && dias > 0)
        {
            new pname[MAX_PLAYER_NAME];
            GetPlayerName(plid, pname, MAX_PLAYER_NAME);
            format(file2, sizeof(file2), PASTA_Vips, pname);
            getdate(year, month, day);
            gettime(hour,minute,second);
            VipInfo[playerid][vDia] = day;
            VipInfo[playerid][vMes] = month;
            VipInfo[playerid][vAno] = year;
            VipInfo[playerid][vDiaA] = day+dias;
            VipInfo[playerid][vMesA] = month;
            VipInfo[playerid][vAnoA] = year;
            if(month != 2 && day > 30 || month == 2 && day > 28)
            {
                VipInfo[playerid][vMesA] = month+1;
            }
            if(VipInfo[playerid][vMesA] > 12)
            {
                VipInfo[playerid][vAnoA] = year+1;
            }
            VipInfo[playerid][vAnoA] = year;
            SalvarVIP(playerid);
            format(string, sizeof(string), "%s deu vip ao %s Com %d dias(%d/%d/%d - %d:%d)",sendername,giveplayer,dias, month, year,hour, minute);
            dini_IntSet(file2, "VIP",1);
            SpawnPlayer(plid);
            SendClientMessage(playerid, 0x00FF00AA, "{0099FF}(~){CCCCFF} VIP Setado com sucesso");
            SendClientMessage(plid, 0x00FF00AA, "{0099FF}(~){CCCCFF} O Administrador(a)%s Ti Deu VIP de %d Dias aproveite");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} ID invбlido");
            return 1;
        }
    }
}
Bom, isso estб longe de ser perfeito, Eu nгo to com meu GM aqui para poder mostrar tudo, pois precisa calcular as Mudanзas de mкs, ano e etc, Mais com isso da para fazer uma base sуlida jб.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)