[Ajuda] Converter alguns comandos.
#1

Bem eu gostaria de adaptar um sistema de Factions em STRCMD, para ZCMD.
Vou deixar aqui os comandos abaixo. Eu sei que sгo muitos comandos, mas agradecia do fundo do coraзao que me ajudassem a converter estes comandos para ZCMD. Obrigado.

pawn Код:
if(strcmp(cmd, "/setfactionspawn", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionspawn [factionid]");
                return 1;
            }
            new id = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                new Float:x,Float:y,Float:z;
                GetPlayerPos(playerid, x, y, z);
                DynamicFactions[id][fX] = x;
                DynamicFactions[id][fY] = y;
                DynamicFactions[id][fZ] = z;
                SaveDynamicFactions();
                format(string, sizeof(string), "Metes-te aqui o spawnpoint da faction: %d", id);
                SendClientMessage(playerid, COLOR_ADMINCMD, string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/resetfaction", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/resetfaction [factionid]");
                return 1;
            }
            new factionid = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 20)
            {
                new rank;
                format(string, sizeof(string), "Faction%d",factionid);
                strmid(DynamicFactions[factionid][fName], string, 0, strlen(string), 255);
                DynamicFactions[factionid][fX] = 0.0;
                DynamicFactions[factionid][fY] = 0.0;
                DynamicFactions[factionid][fZ] = 0.0;
                DynamicFactions[factionid][fMaterials] = 0;
                DynamicFactions[factionid][fDrugs] = 0;
                DynamicFactions[factionid][fBank] = 0;
                rank = 1; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank1], string, 0, strlen(string), 255);
                rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank2], string, 0, strlen(string), 255);
                rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank3], string, 0, strlen(string), 255);
                rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank4], string, 0, strlen(string), 255);
                rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank5], string, 0, strlen(string), 255);
                rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank6], string, 0, strlen(string), 255);
                rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank7], string, 0, strlen(string), 255);
                rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank8], string, 0, strlen(string), 255);
                rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank9], string, 0, strlen(string), 255);
                rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank10], string, 0, strlen(string), 255);
                DynamicFactions[factionid][fSkin1] = 0;
                DynamicFactions[factionid][fSkin2] = 0;
                DynamicFactions[factionid][fSkin3] = 0;
                DynamicFactions[factionid][fSkin4] = 0;
                DynamicFactions[factionid][fSkin5] = 0;
                DynamicFactions[factionid][fSkin6] = 0;
                DynamicFactions[factionid][fSkin7] = 0;
                DynamicFactions[factionid][fSkin8] = 0;
                DynamicFactions[factionid][fSkin9] = 0;
                DynamicFactions[factionid][fSkin10] = 0;
                DynamicFactions[factionid][fJoinRank] = 0;
                DynamicFactions[factionid][fUseSkins] = 0;
                DynamicFactions[factionid][fType] = 0;
                DynamicFactions[factionid][fRankAmount] = 0;
                DynamicFactions[factionid][fUseColor] = 0;
                format(string, sizeof(string), "0xFFFFFFFF");
                strmid(DynamicFactions[factionid][fColor], string, 0, strlen(string), 255);
                format(string, sizeof(string), "Deste reset a faction: %d.", factionid);
                SendClientMessage(playerid, COLOR_ADMINCMD, string);
                SaveDynamicFactions();
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo es administrador ou nгo tens nivel necessario.");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/setfactioncolor", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactioncolor [factionid] [cor]");
                return 1;
            }
            new id = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[128];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactioncolor [factionid] [cor]");
                    return 1;
                }
                if(strfind( result , "|" , true ) == -1)
                {
                    strmid(DynamicFactions[id][fColor], (result), 0, strlen((result)), 128);
                    format(string, sizeof(string), "Defeniste a faction: %d a cor: %s.", id,(result));
                    SendClientMessage(playerid, COLOR_ADMINCMD, string);
                    SaveDynamicFactions();
                }
                else
                {
                    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Simbolo invalido, nгo permitido!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/setfactionname", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionname [factionid] [nome]");
                return 1;
            }
            new id = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[128];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionname [factionid] [nome]");
                    return 1;
                }
                if(strfind( result , "|" , true ) == -1)
                {
                    strmid(DynamicFactions[id][fName], (result), 0, strlen((result)), 128);
                    format(string, sizeof(string), "Metes-te a faction: %d o nome: %s", id,(result));
                    SendClientMessage(playerid, COLOR_ADMINCMD, string);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Simbolo Invalido, nгo permitido.");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/gotofaction", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/gotofaction [id]");
                return 1;
            }
            new id = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 20)
            {
                SetPlayerPos(playerid,DynamicFactions[id][fX],DynamicFactions[id][fY],DynamicFactions[id][fZ]);
                SetPlayerInterior(playerid,0);
                SetPlayerVirtualWorld(playerid,0);
                new form[128];
                format(form, sizeof(form), "Teleportaste-te para a faction: %d.", id);
                SendClientMessage(playerid, COLOR_ADMINCMD, form);
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/setfactiontype", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactiontype [factionid] [tipo]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                    new id;
                    id = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactiontype [factionid] [tipo]");
                        return 1;
                    }
                    new id2;
                    id2 = strval(tmp);

                    DynamicFactions[id][fType] = id2;
                    new form[128];
                    format(form, sizeof form, "Metes-te a faction: %d o tipo: %d.", id,id2);
                    SendClientMessage(playerid, COLOR_ADMINCMD,form);
                    SaveDynamicFactions();
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/setfactionjoinrank", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionjoinrank [factionid] [rank(2-10)]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                    new id;
                    id = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionjoinrank [factionid] [rank(2-10)]");
                        return 1;
                    }
                    new id2;
                    id2 = strval(tmp);

                    if(id2 >= 2 && id2 <= 10)
                    {
                        DynamicFactions[id][fJoinRank] = id2;
                        new form[128];
                        format(form, sizeof form, "Metes-te a faction: %d o rank de entrada numero: %d.", id,id2);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/setfactionbank", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionbank [factionid] [quantia]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 20)
            {
                    new id;
                    id = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionbank [factionid] [quantia]");
                        return 1;
                    }
                    new id2;
                    id2 = strval(tmp);

                    DynamicFactions[id][fBank] = id2;
                    new form[128];
                    format(form, sizeof form, "Defenis-te ao banco da faction: %d a quantia de: %d.", id,id2);
                    SendClientMessage(playerid, COLOR_ADMINCMD,form);
                    SaveDynamicFactions();
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/setfactiondrugs", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactiondrugs [factionid] [quantia]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 20)
            {
                    new id;
                    id = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactiondrugs [factionid] [quantia]");
                        return 1;
                    }
                    new id2;
                    id2 = strval(tmp);

                    DynamicFactions[id][fDrugs] = id2;
                    new form[128];
                    format(form, sizeof form, "Defenis-te na faction: %d as seguintes drogas %d.", id,id2);
                    SendClientMessage(playerid, COLOR_ADMINCMD,form);
                    SaveDynamicFactions();
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/setfactionmats", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/afactionmats [factionid] [quantia]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 20)
            {
                    new id;
                    id = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionmats [factionid] [quantia]");
                        return 1;
                    }
                    new id2;
                    id2 = strval(tmp);

                    DynamicFactions[id][fMaterials] = id2;
                    new form[128];
                    format(form, sizeof form, "Definis-te a faction: %d os seguintes materiais: %d.", id,id2);
                    SendClientMessage(playerid, COLOR_ADMINCMD,form);
                    SaveDynamicFactions();
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/setfactionrankamount", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionrankamount [factionid] [2-10]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                    new id;
                    id = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionrankamount [factionid] [2-10]");
                        return 1;
                    }
                    new id2;
                    id2 = strval(tmp);

                    if(id2 >= 2 && id2 <= 10)
                    {
                        DynamicFactions[id][fRankAmount] = id2;
                        new form[128];
                        format(form, sizeof form, "Tu escolheste a faction ID: %d's  para o rank montante %d.", id,id2);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo estбs autorizado a usar este comando.");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/setfactionrankname", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionrankname [factionid] [Rank ID - 1-10] [Name]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                    new id;
                    id = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionrankname [factionid] [Rank ID - 1-10] [Name]");
                        return 1;
                    }
                    new id2;
                    id2 = strval(tmp);

                    new length = strlen(cmdtext);
                    while ((idx < length) && (cmdtext[idx] <= ' '))
                    {
                        idx++;
                    }
                    new offset = idx;
                    new result[64];
                    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                    {
                        result[idx - offset] = cmdtext[idx];
                        idx++;
                    }
                    result[idx - offset] = EOS;
                    if(!strlen(result))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionrankname [factionid] [Rank ID - 1-10] [Name]");
                        return 1;
                    }
                    if(strfind( result , "|" , true ) == -1)
                    {
                        if(id2 == 1)
                        {
                            strmid(DynamicFactions[id][fRank1], (result), 0, strlen((result)), 128);
                            format(string, sizeof(string), "Defenis-te na faction: %d no Rank: %d o nome: %s", id,id2,result);
                            SendClientMessage(playerid, COLOR_ADMINCMD, string);
                            SaveDynamicFactions();
                        }
                        else if(id2 == 2)
                        {
                            strmid(DynamicFactions[id][fRank2], (result), 0, strlen((result)), 128);
                            format(string, sizeof(string), "Defenis-te na faction: %d no Rank: %d o nome: %s", id,id2,result);
                            SendClientMessage(playerid, COLOR_ADMINCMD, string);
                            SaveDynamicFactions();
                        }
                        else if(id2 == 3)
                        {
                            strmid(DynamicFactions[id][fRank3], (result), 0, strlen((result)), 128);
                            format(string, sizeof(string), "Defenis-te na faction: %d no Rank: %d o nome: %s", id,id2,result);
                            SendClientMessage(playerid, COLOR_ADMINCMD, string);
                            SaveDynamicFactions();
                        }
                        else if(id2 == 4)
                        {
                            strmid(DynamicFactions[id][fRank4], (result), 0, strlen((result)), 128);
                            format(string, sizeof(string), "[Defenis-te na faction: %d no Rank: %d o nome: %s", id,id2,result);
                            SendClientMessage(playerid, COLOR_ADMINCMD, string);
                            SaveDynamicFactions();
                        }
                        else if(id2 == 5)
                        {
                            strmid(DynamicFactions[id][fRank5], (result), 0, strlen((result)), 128);
                            format(string, sizeof(string), "[Defenis-te na faction: %d no Rank: %d o nome: %s", id,id2,result);
                            SendClientMessage(playerid, COLOR_ADMINCMD, string);
                            SaveDynamicFactions();
                        }
                        else if(id2 == 6)
                        {
                            strmid(DynamicFactions[id][fRank6], (result), 0, strlen((result)), 128);
                            format(string, sizeof(string), "Defenis-te na faction: %d no Rank: %d o nome: %s", id,id2,result);
                            SendClientMessage(playerid, COLOR_ADMINCMD, string);
                            SaveDynamicFactions();
                        }
                        else if(id2 == 7)
                        {
                            strmid(DynamicFactions[id][fRank7], (result), 0, strlen((result)), 128);
                            format(string, sizeof(string), "Defenis-te na faction: %d no Rank: %d o nome: %s", id,id2,result);
                            SendClientMessage(playerid, COLOR_ADMINCMD, string);
                            SaveDynamicFactions();
                        }
                        else if(id2 == 8)
                        {
                            strmid(DynamicFactions[id][fRank8], (result), 0, strlen((result)), 128);
                            format(string, sizeof(string), "Defenis-te na faction: %d no Rank: %d o nome: %s", id,id2,result);
                            SendClientMessage(playerid, COLOR_ADMINCMD, string);
                            SaveDynamicFactions();
                        }
                        else if(id2 == 9)
                        {
                            strmid(DynamicFactions[id][fRank9], (result), 0, strlen((result)), 128);
                            format(string, sizeof(string), "Defenis-te na faction: %d no Rank: %d o nome: %s", id,id2,result);
                            SendClientMessage(playerid, COLOR_ADMINCMD, string);
                            SaveDynamicFactions();
                        }
                        else if(id2 == 10)
                        {
                            strmid(DynamicFactions[id][fRank10], (result), 0, strlen((result)), 128);
                            format(string, sizeof(string), "Defenis-te na faction: %d no Rank: %d o nome: %s", id,id2,result);
                            SendClientMessage(playerid, COLOR_ADMINCMD, string);
                            SaveDynamicFactions();
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Simbolo Invalido, nгo permitido.");
                    }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel necessбrio!");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/setfactionskin", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionskin [factionid] [Rank ID - 1-10] [Skinid]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                    new id;
                    id = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionskin [factionid] [Rank ID - 1-10] [Skinid]");
                        return 1;
                    }
                    new id2;
                    id2 = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionskin [factionid] [Rank ID - 1-10] [Skinid]");
                        return 1;
                    }
                    new id3;
                    id3 = strval(tmp);
                   
                    if(id2 == 1)
                    {
                        DynamicFactions[id][fSkin1] = id3;
                        new form[128];
                        format(form, sizeof form, "Defenis-te na faction: %d no rank %d a skin: %d.", id,id2,id3);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
                    else if(id2 == 2)
                    {
                        DynamicFactions[id][fSkin2] = id3;
                        new form[128];
                        format(form, sizeof form, "Defenis-te na faction: %d no rank %d a skin: %d.", id,id2,id3);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
                    else if(id2 == 3)
                    {
                        DynamicFactions[id][fSkin3] = id3;
                        new form[128];
                        format(form, sizeof form, "Defenis-te na faction: %d no rank %d a skin: %d.", id,id2,id3);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
                    else if(id2 == 4)
                    {
                        DynamicFactions[id][fSkin4] = id3;
                        new form[128];
                        format(form, sizeof form, "Defenis-te na faction: %d no rank %d a skin: %d.", id,id2,id3);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
                    else if(id2 == 5)
                    {
                        DynamicFactions[id][fSkin5] = id3;
                        new form[128];
                        format(form, sizeof form, "Defenis-te na faction: %d no rank %d a skin: %d.", id,id2,id3);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
                    else if(id2 == 6)
                    {
                        DynamicFactions[id][fSkin6] = id3;
                        new form[128];
                        format(form, sizeof form, "Defenis-te na faction: %d no rank %d a skin: %d.", id,id2,id3);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
                    else if(id2 == 7)
                    {
                        DynamicFactions[id][fSkin7] = id3;
                        new form[128];
                        format(form, sizeof form, "Defenis-te na faction: %d no rank %d a skin: %d.", id,id2,id3);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
                    else if(id2 == 8)
                    {
                        DynamicFactions[id][fSkin8] = id3;
                        new form[128];
                        format(form, sizeof form, "Defenis-te na faction: %d no rank %d a skin: %d.", id,id2,id3);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
                    else if(id2 == 9)
                    {
                        DynamicFactions[id][fSkin9] = id3;
                        new form[128];
                        format(form, sizeof form, "Defenis-te na faction: %d no rank %d a skin: %d.", id,id2,id3);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
                    else if(id2 == 10)
                    {
                        DynamicFactions[id][fSkin10] = id3;
                        new form[128];
                        format(form, sizeof form, "Defenis-te na faction: %d no rank %d a skin: %d.", id,id2,id3);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SaveDynamicFactions();
                    }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/setfactionusecolor", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionusecolor [factionid]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                    new id;
                    id = strval(tmp);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setfactionusecolor [factionid]");
                        return 1;
                    }
                    if(DynamicFactions[id][fUseColor])
                    {
                        DynamicFactions[id][fUseColor] = 0;
                        new form[128];
                        format(form, sizeof form, "[INFO:] Faction ID: %d's color disabled.", id);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SendFactionMessage(id, COLOR_FACTIONCHAT, "Cor da Faction Desactivado por um Admin.");
                        SaveDynamicFactions();
                       
                        for(new i=0;i<MAX_PLAYERS;i++)
                        {
                            if(IsPlayerConnected(i))
                            {
                                if(PlayerInfo[i][pFaction] == id)
                                {
                                    SetPlayerColor(i,COLOR_CIVILIAN);
                                }
                            }
                        }
                    }
                    else
                    {
                        DynamicFactions[id][fUseColor] = 1;
                        new form[128];
                        format(form, sizeof form, "[INFO:] Faction ID: %d's color enabled.", id);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SendFactionMessage(id, COLOR_FACTIONCHAT, "Cor da Faction Activado por um Admin.");
                        SaveDynamicFactions();
                       
                        for(new i=0;i<MAX_PLAYERS;i++)
                        {
                            if(IsPlayerConnected(i))
                            {
                                if(PlayerInfo[i][pFaction] == id)
                                {
                                    SetPlayerToFactionColor(i);
                                }
                            }
                        }
                    }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");
            }
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/afactionuseskins", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USA:] /afactionuseskins [factionid]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 10)
            {
                    new id;
                    id = strval(tmp);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USA:] /afactionuseskins [factionid]");
                        return 1;
                    }

                    if(DynamicFactions[id][fUseSkins])
                    {
                        DynamicFactions[id][fUseSkins] = 0;
                        new form[128];
                        format(form, sizeof form, "[INFO:] Faction ID: %d's skin's desligadas.", id);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SendFactionMessage(id, COLOR_FACTIONCHAT, "[FACTION:] Faction skin's desligadas por um admin.");
                        SaveDynamicFactions();

                    }
                    else
                    {
                        DynamicFactions[id][fUseSkins] = 1;
                        new form[128];
                        format(form, sizeof form, "[INFO:] Faction ID: %d's skin's enabled.", id);
                        SendClientMessage(playerid, COLOR_ADMINCMD,form);
                        SendFactionMessage(id, COLOR_FACTIONCHAT, "[FACTION:] Faction skin's devolvidas por um admin.");
                        SaveDynamicFactions();

                        for(new i=0;i<MAX_PLAYERS;i++)
                        {
                            if(IsPlayerConnected(i))
                            {
                                if(PlayerInfo[i][pFaction] == id)
                                {
                                    SetPlayerToFactionSkin(i);
                                }
                            }
                        }
                    }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nao es admin.");
            }
        }
        return 1;
    }
Reply
#2

se nao espera ki nos fasa ou alguem de bom caraзao e venha e fasa eu simseramente sem coragem mais ai
CMDeucomando(playerid, params[])
{
funзao geralmente nos comando usa
if(sscanf(params, "seu parametro",coisa do parametro)) return SendClientMessage(playerid , -1, "mensagen do retorno");
Reply
#3

histire, eu sei como se faz comandos em ZCMD.
Eu й que nao percebo como converte-los.
Reply
#4

Mas vc so pediu em ZCMD e nгo ZCMD+SSCANF
pawn Код:
if(strcmp(cmd, "/setfactionspawn", true) == 0)
para
pawn Код:
CMD:setfactionspawn(playerid,params[])
faзa o mesmo com os outros cmds
Reply
#5

Vai_Besta, este tуpico como TU ves й grande. eu nao preciso que venham dizer-me como se faz. Porque EU sei como se faz. o problema й que nao consigo converter o interior do comando. Porra.
Reply
#6

mas vc qer converter o interior do comando de que para que?

pois como esta no inicio do topico
Voce quer converter STRCMP para ZCMD e oq eu disse й isso que vc pediu
Reply
#7

pawn Код:
#include <a_samp>
#include <zcmd>
native sscanf(const data[], const format[], {Float,_}:...);
native unformat(const data[], const format[], {Float,_}:...) = sscanf;

main()
{
    print("print");
}

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return SendClientMessage(playerid, -1 , "SERVER: Comando Desconhecido.");
    return 0x1;
}

CMD:setfactionspawn(playerid, params[])
{
    static FactionID;
    if(sscanf(params, "d", FactionID)) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Use: /setfactionspawn [FactionID]");
    if(PlayerInfo[playerid][pAdmin] < 10) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");

    static Float:Pos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    DynamicFactions[id][fX] = Pos[0];
    DynamicFactions[id][fY] = Pos[1];
    DynamicFactions[id][fZ] = Pos[2];
    SaveDynamicFactions();
    format(string, sizeof(string), "Metes-te aqui o spawnpoint da faction: %d", FactionID);
    SendClientMessage(playerid, COLOR_ADMINCMD, string);
    return 0x1;
}

CMD:resetfaction(playerid, params[])
{
    static FactionID;
    if(sscanf(params, "d", FactionID)) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Use: /resetfaction [FactionID]");
    if(PlayerInfo[playerid][pAdmin] < 20) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");

    new rank;
    format(string, sizeof(string), "Faction%d",FactionID);
    strmid(DynamicFactions[FactionID][fName], string, 0, strlen(string), 255);
    DynamicFactions[FactionID][fX] = 0.0;
    DynamicFactions[FactionID][fY] = 0.0;
    DynamicFactions[FactionID][fZ] = 0.0;
    DynamicFactions[FactionID][fMaterials] = 0;
    DynamicFactions[FactionID][fDrugs] = 0;
    DynamicFactions[FactionID][fBank] = 0;
    rank = 1; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[FactionID][fRank1], string, 0, strlen(string), 255);
    rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[FactionID][fRank2], string, 0, strlen(string), 255);
    rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[FactionID][fRank3], string, 0, strlen(string), 255);
    rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[FactionID][fRank4], string, 0, strlen(string), 255);
    rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[FactionID][fRank5], string, 0, strlen(string), 255);
    rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[FactionID][fRank6], string, 0, strlen(string), 255);
    rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[FactionID][fRank7], string, 0, strlen(string), 255);
    rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[FactionID][fRank8], string, 0, strlen(string), 255);
    rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[FactionID][fRank9], string, 0, strlen(string), 255);
    rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[FactionID][fRank10], string, 0, strlen(string), 255);
    DynamicFactions[FactionID][fSkin1] = 0;
    DynamicFactions[FactionID][fSkin2] = 0;
    DynamicFactions[FactionID][fSkin3] = 0;
    DynamicFactions[FactionID][fSkin4] = 0;
    DynamicFactions[FactionID][fSkin5] = 0;
    DynamicFactions[FactionID][fSkin6] = 0;
    DynamicFactions[FactionID][fSkin7] = 0;
    DynamicFactions[FactionID][fSkin8] = 0;
    DynamicFactions[FactionID][fSkin9] = 0;
    DynamicFactions[FactionID][fSkin10] = 0;
    DynamicFactions[FactionID][fJoinRank] = 0;
    DynamicFactions[FactionID][fUseSkins] = 0;
    DynamicFactions[FactionID][fType] = 0;
    DynamicFactions[FactionID][fRankAmount] = 0;
    DynamicFactions[FactionID][fUseColor] = 0;
    format(string, sizeof(string), "0xFFFFFFFF");
    strmid(DynamicFactions[FactionID][fColor], string, 0, strlen(string), 255);
    format(string, sizeof(string), "Deste reset a faction: %d.", FactionID);
    SendClientMessage(playerid, COLOR_ADMINCMD, string);
    SaveDynamicFactions();
    return 0x1;
}

CMD:gotofaction(playerid, params[])
{
    static FactionID;
    if(sscanf(params, "d", FactionID)) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/gotofaction [id]");
    if(PlayerInfo[playerid][pAdmin] < 10) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nгo йs administrador ou nгo tens nivel suficiente");

    SetPlayerPos(playerid,DynamicFactions[FactionID][fX],DynamicFactions[FactionID][fY],DynamicFactions[FactionID][fZ]);
    SetPlayerInterior(playerid,0);
    SetPlayerVirtualWorld(playerid,0);
    static form[128];
    format(form, sizeof(form), "Teleportaste-te para a faction: %d.", FactionID);
    SendClientMessage(playerid, COLOR_ADMINCMD, form);
    return 0x1;
}

Boa sorte com o resto

Reply
#8

Falcon, obrigado pelo o icentivo. Irei dar continuidade. Se tiver alguma dъvida/erro posto.
Reply
#9

Uma duvida qual diferenзa de usar
pawn Код:
return 0x1;
para
pawn Код:
return 1;
Reply
#10

Quote:
Originally Posted by Vai_Besta
Посмотреть сообщение
Uma duvida qual diferenзa de usar
pawn Код:
return 0x1;
para
pawn Код:
return 1;
nenhuma.

0x1 = 1 ou true
0x0 = 2 ou false.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)