[Ajuda] Converter comando.
#1

Olб, bom dia!

Gostaria que alguem me ajudasse a converter esses 3 comandos...

pawn Код:
CMD:meuvip(playerid)
{
    GetPlayerName(playerid,Nome,sizeof(Nome));
    format(Falao,sizeof(Falao),"Vips/%s.ini",Nome);

    if(dini_Exists(Falao))
    {
        new Falao2[140];
        new Hoje = getdate();
        new Vencimento = dini_Int(Falao,"Vencimento");

        format(Falao2,sizeof(Falao2),"Olб %s!\n\nO admin cujo setou seu VIP, setou %d dias.\n\nE vocк Jб usou %d dias com o mesmo!\n\nAproveite antes que acabe!",Nome,dini_Int(Falao,"Dias"),Hoje-Vencimento);
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Seu VIP",Falao2,"Cancelar","");
    }
    return 1;
}
pawn Код:
CMD:darvip(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new ID;
        new Dias;

        if(!sscanf(params,"dd",ID,Dias))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Use: /darvip ID Dias.");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Player nгo online.");
            return 1;
        }
        else
        {
            if(VIP[ID] == 1)
            {
                SendClientMessage(playerid,0xBFBFBFAA,"O mesmo Jб й VIP.");
                return 1;
            }
            else
            {
                GetPlayerName(ID,Nome,sizeof(Nome));
                format(Falao,sizeof(Falao),"Vips/%s.ini",Nome);

                dini_Create(Falao);
                dini_IntSet(Falao,"Vencimento",getdate());
                dini_IntSet(Falao,"Dias",Dias);

                VIP[ID] = 1;

                format(Falao,sizeof(Falao),"O administrador deu VIP para o player %s por %d dias.",Nome,Dias);
                SendClientMessageToAll(0xFF8080AA,Falao);
            }
        }
    }
    return 1;
}
pawn Код:
CMD:removervip(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new ID;
        if(!sscanf(params,"d",ID))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Use: /removervip ID.");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Player nгo online.");
            return 1;
        }
        else
        {
            if(VIP[ID] == 0)
            {
                SendClientMessage(playerid,0xBFBFBFAA,"O mesmo nгo й VIP.");
                return 1;
            }
            else
            {
                GetPlayerName(ID,Nome,sizeof(Nome));
                format(Falao,sizeof(Falao),"Vips/%s.ini",Nome);

                dini_Remove(Falao);

                VIP[ID] = 0;

                format(Falao,sizeof(Falao),"O administrador removeu o VIP do player %s.",Nome);
                SendClientMessageToAll(0xFF8080AA,Falao);
            }
        }
    }
    return 1;
}
Obrigado!
Reply
#2

Converter para? ...
Reply
#3

Olб, bom dia!

FelipeAMC, se nгo me engano й strcmp...

pawn Код:
if(strcmp(cmd, "/matar", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "USE: /matar [playerid/PartOfName]");
                return 1;
            }
            new playa;
            playa = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >=1)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    SetPlayerHealth(playa, 0.0);
                    SetPlayerVirtualWorld(playa,0);
                    format(string, 128, "AdmCmd: %s matou %s",sendername, giveplayer);
                    ABroadCast(0xC2CA7FFF,string,1);
                    }
                }
            }
            else
            {
            SendClientMessage(playerid, 0xFFFFFFFF, " Vocк nгo pode utilizar esse comando!");
            }
        }
        return 1;
    }
Vlw!
Reply
#4

ZCMD e muito melhor, de qualquer forma ae esta

pawn Код:
if(strcmp(cmd, "/meuvip", true) == 0)
{
    GetPlayerName(playerid,Nome,sizeof(Nome));
    format(Falao,sizeof(Falao),"Vips/%s.ini",Nome);

    if(dini_Exists(Falao))
    {
        new Falao2[140];
        new Hoje = getdate();
        new Vencimento = dini_Int(Falao,"Vencimento");

        format(Falao2,sizeof(Falao2),"Olб %s!\n\nO admin cujo setou seu VIP, setou %d dias.\n\nE vocк Jб usou %d dias com o mesmo!\n\nAproveite antes que acabe!",Nome,dini_Int(Falao,"Dias"),Hoje-Vencimento);
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Seu VIP",Falao2,"Cancelar","");
    }
    return 1;
}

if(strcmp(cmd, "/darvip", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        new ID;
        new Dias;

        if(!sscanf(cmdtext,"ud",ID,Dias))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Use: /darvip ID Dias.");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Player nгo online.");
            return 1;
        }
        else
        {
            if(VIP[ID] == 1)
            {
                SendClientMessage(playerid,0xBFBFBFAA,"O mesmo Jб й VIP.");
                return 1;
            }
            else
            {
                GetPlayerName(ID,Nome,sizeof(Nome));
                format(Falao,sizeof(Falao),"Vips/%s.ini",Nome);

                dini_Create(Falao);
                dini_IntSet(Falao,"Vencimento",getdate());
                dini_IntSet(Falao,"Dias",Dias);

                VIP[ID] = 1;

                format(Falao,sizeof(Falao),"O administrador deu VIP para o player %s por %d dias.",Nome,Dias);
                SendClientMessageToAll(0xFF8080AA,Falao);
            }
        }
    }
    return 1;
}

if(strcmp(cmd, "/removervip", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        new ID;
        if(!sscanf(cmdtext,"u",ID))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Use: /removervip ID.");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Player nгo online.");
            return 1;
        }
        else
        {
            if(VIP[ID] == 0)
            {
                SendClientMessage(playerid,0xBFBFBFAA,"O mesmo nгo й VIP.");
                return 1;
            }
            else
            {
                GetPlayerName(ID,Nome,sizeof(Nome));
                format(Falao,sizeof(Falao),"Vips/%s.ini",Nome);

                dini_Remove(Falao);

                VIP[ID] = 0;

                format(Falao,sizeof(Falao),"O administrador removeu o VIP do player %s.",Nome);
                SendClientMessageToAll(0xFF8080AA,Falao);
            }
        }
    }
    return 1;
}
Reply
#5

Olб, bom dia!

Apos a conversгo o comando parou de funcionar. Alguйm poderia me ajudar ?!

Vlw!
Reply
#6

Quote:
Originally Posted by NuTShoT
Посмотреть сообщение
Olб, bom dia!

Apos a conversгo o comando parou de funcionar. Alguйm poderia me ajudar ?!

Vlw!
Vocк estб colocando esse codigo dentro dessa CallBack ao menos ? OnPlayerCommandText?

Se nгo:

PHP код:
public OnPlayerCommandText(playeridcmdtext[]) {
if(
strcmp(cmd"/meuvip"true) == 0)
{
    
GetPlayerName(playerid,Nome,sizeof(Nome));
    
format(Falao,sizeof(Falao),"Vips/%s.ini",Nome);
    if(
dini_Exists(Falao))
    {
        new 
Falao2[140];
        new 
Hoje getdate();
        new 
Vencimento dini_Int(Falao,"Vencimento");
        
format(Falao2,sizeof(Falao2),"Olб %s!\n\nO admin cujo setou seu VIP, setou %d dias.\n\nE vocк Jб usou %d dias com o mesmo!\n\nAproveite antes que acabe!",Nome,dini_Int(Falao,"Dias"),Hoje-Vencimento);
        
ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Seu VIP",Falao2,"Cancelar","");
    }
    return 
1;
}
if(
strcmp(cmd"/darvip"true) == 0)
{
    if(
IsPlayerAdmin(playerid))
    {
        new 
ID;
        new 
Dias;
        if(!
sscanf(cmdtext,"ud",ID,Dias))
        {
            
SendClientMessage(playerid,0xBFBFBFAA,"Use: /darvip ID Dias.");
            return 
1;
        }
        if(!
IsPlayerConnected(ID))
        {
            
SendClientMessage(playerid,0xBFBFBFAA,"Player nгo online.");
            return 
1;
        }
        else
        {
            if(
VIP[ID] == 1)
            {
                
SendClientMessage(playerid,0xBFBFBFAA,"O mesmo Jб й VIP.");
                return 
1;
            }
            else
            {
                
GetPlayerName(ID,Nome,sizeof(Nome));
                
format(Falao,sizeof(Falao),"Vips/%s.ini",Nome);
                
dini_Create(Falao);
                
dini_IntSet(Falao,"Vencimento",getdate());
                
dini_IntSet(Falao,"Dias",Dias);
                
VIP[ID] = 1;
                
format(Falao,sizeof(Falao),"O administrador deu VIP para o player %s por %d dias.",Nome,Dias);
                
SendClientMessageToAll(0xFF8080AA,Falao);
            }
        }
    }
    return 
1;
}
if(
strcmp(cmd"/removervip"true) == 0)
{
    if(
IsPlayerAdmin(playerid))
    {
        new 
ID;
        if(!
sscanf(cmdtext,"u",ID))
        {
            
SendClientMessage(playerid,0xBFBFBFAA,"Use: /removervip ID.");
            return 
1;
        }
        if(!
IsPlayerConnected(ID))
        {
            
SendClientMessage(playerid,0xBFBFBFAA,"Player nгo online.");
            return 
1;
        }
        else
        {
            if(
VIP[ID] == 0)
            {
                
SendClientMessage(playerid,0xBFBFBFAA,"O mesmo nгo й VIP.");
                return 
1;
            }
            else
            {
                
GetPlayerName(ID,Nome,sizeof(Nome));
                
format(Falao,sizeof(Falao),"Vips/%s.ini",Nome);
                
dini_Remove(Falao);
                
VIP[ID] = 0;
                
format(Falao,sizeof(Falao),"O administrador removeu o VIP do player %s.",Nome);
                
SendClientMessageToAll(0xFF8080AA,Falao);
            }
        }
    }
    return 
1;
}

Reply
#7

Olб, boa tarde!

Agora o comando estб funcionando, porйm o nгo estб pegando...


Vlw!
Reply
#8

isso ae e erro no sscanf eu to com esse problema e nao sei resolver tambem
Reply
#9

Olб, boa tarde!

Amigos, jб resolvi o problema.

Vlw!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)