SA-MP Forums Archive
[AJUDA] Comandos - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA] Comandos (/showthread.php?tid=309103)



[AJUDA] Comandos - Rodrigo_Avenged - 06.01.2012

e ae Galera Beleza ?
Queria saber se tem como tipo Olha exemplo abaixo :

se eu desse /darsocio [id] [Niveldosocio] , que nesse comando ele ja ganhava + Grana e Level ,

acho que se deve criar umas variavel entao ja criei , sу nao sei o comando ... rss

entao , Poderia me ajudar ?


Re: [AJUDA] Comandos - AleeFerreira - 06.01.2012

pawn Код:
CMD:darsocio(playerid, params[])
{
   new id,nivel;
   if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Vocк nгo й admin");
   if(sscanf(params,"ud",id,nivel)) return SendClientMessage(playerid,-1,"Use: /darsocio [id] [nivel]");
   VariaveldoVIP[id] = nivel;
   GivePlayerMoney(id, GRANAQUETUQUER);
   SetPlayerScore(id, LEVELQUETUQUER);
   return true;
}
Pronto, ai tem uma base em zcmd e sscanf, se vocк usar strcmp e strtok й sу modificar , mais ja tem uma base *-*


Re: [AJUDA] Comandos - Rodrigo_Avenged - 06.01.2012

Olha meu CMD :

PHP код:
    if(strcmp(cmd"/darsocio"true) == 0)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))    return SendClientMessage(playeridCOLOR_GRAD2"USE: /darsocio [id] [nivel de 1 a 3]");
        new 
para1 ReturnUser(tmp);
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))    return SendClientMessage(playeridCOLOR_GRAD2"USE: /darsocio [id] [nivel de 1 a 3]");
        if (
PlayerInfo[playerid][pAdmin] >= 1341)
        {
            if(
IsPlayerConnected(para1))
            {
                if(
para1 != INVALID_PLAYER_ID)
                {
                    
GetPlayerName(para1giveplayersizeof(giveplayer));
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    new 
socio_nivel strval(tmp);
                    
PlayerInfo[para1][pSocio] = socio_nivel;
                    
format(stringsizeof(string), "Vocк ganhou VIP socio nнvel %d do admin %s."socio_nivelsendername);
                    
SendClientMessage(para1COLOR_LIGHTBLUEstring);
                    
format(stringsizeof(string), "Vocк deu VIP socio nнvel %d para %s."socio_nivelgiveplayer);
                    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                    new 
celulas[100], Nome[24];
                    if(!
fexist("Socio.log")) return CriarLog("Socio.log");
                    
GetPlayerName(playeridNome24);
                    
format(celulassizeof(celulas), "%s deu sуcio nнvel %d para %s."Nomesocio_nivelgiveplayer);
                    
EscreverLog("Socio.log"celulas);
                }
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GRAD1" Vocк nгo esta autorizado a usar este comando!");
        }
        return 
1;
    } 



Re: [AJUDA] Comandos - AleeFerreira - 06.01.2012

tenta assim:

pawn Код:
if(strcmp(cmd, "/darsocio", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))    return SendClientMessage(playerid, COLOR_GRAD2, "USE: /darsocio [id] [nivel de 1 a 3]");
        new para1 = ReturnUser(tmp);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))    return SendClientMessage(playerid, COLOR_GRAD2, "USE: /darsocio [id] [nivel de 1 a 3]");
        if (PlayerInfo[playerid][pAdmin] >= 1341)
        {
            if(IsPlayerConnected(para1))
            {
                if(para1 != INVALID_PLAYER_ID)
                {
                    GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    new socio_nivel = strval(tmp);
                    PlayerInfo[para1][pSocio] = socio_nivel;
                    SetPlayerScore(para1, 200);
                    GivePlayerMoney(para1, 1000);
                    format(string, sizeof(string), "Vocк ganhou VIP socio nнvel %d do admin %s.", socio_nivel, sendername);
                    SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                    format(string, sizeof(string), "Vocк deu VIP socio nнvel %d para %s.", socio_nivel, giveplayer);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    new celulas[100], Nome[24];
                    if(!fexist("Socio.log")) return CriarLog("Socio.log");
                    GetPlayerName(playerid, Nome, 24);
                    format(celulas, sizeof(celulas), "%s deu sуcio nнvel %d para %s.", Nome, socio_nivel, giveplayer);
                    EscreverLog("Socio.log", celulas);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, " Vocк nгo esta autorizado a usar este comando!");
        }
        return 1;
    }
Sу trocar as linhas:

pawn Код:
SetPlayerScore(para1, 200); //troque o "200" pelo level que quer dar pro player
GivePlayerMoney(para1, 1000); //troque o "1000" pela grana que quer dar pro player



Re: [AJUDA] Comandos - Rodrigo_Avenged - 06.01.2012

Ok , Valeu ae mano + rep


Re: [AJUDA] Comandos - Rodrigo_Avenged - 06.01.2012

Sim Amigo , mas eu nao queria setar a o Level e a Grana , eu queria dar , pra eles ficarem com mais Isto .> exemplo :


o player com level 3 , eu deu socio pra ele , ai subisse + 200 levels pra ele = 203
entende ? nao queria setar quero dar +200 , nao setar para 200


haa , e tambem se Pude-sse separar por niveis , pois meu tem 3 Leveis de socio .


Re: [AJUDA] Comandos - AleeFerreira - 06.01.2012

pawn Код:
//apenas altere o SetPlayerScore(playerid, 200); por:

SetPlayerScore(para1, GetPlayerScore(para1) + QUANTIDADEDELEVELQUEVOCEQUER);



Re: [AJUDA] Comandos - Rodrigo_Avenged - 06.01.2012

e Como separo , para cada level de socio ganhar levis e granas diferentes ?


Re: [AJUDA] Comandos - Rodrigo_Avenged - 06.01.2012

Deixa , Ja Fiz Isto , Topico Fechado !