[Ayuda] /Clan crear +2000 score
#1

Puse en el sistema de clanes para que sii tiene mas de +2000 de score pueda crear clan.
si tiene menos qe le salga un mensaje qe diga

Код:
TU SCORE DEBE SER MAS DE 2000 PARA CREAR UN CLAN!
coopila perfecto. entro al server y si tengo menos de 2000
el mensaje sale!
si tengo 2000 puedo crearlo..

a lo qe voyy si no tengo mas de 2000 de score
me afecta los demas comandos :S!

como:
Код:
/Clan info
/Clan entrar
/Clan salir
y los comandos que son para el jugador publico!
intente de dos formas:

FORMA 1:

pawn Код:
if(!strcmp(cmd, "/clan", true))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, BLANCO, "Usa: /clan [crear, invitar, rechazar, entrar, salir, expulsar, info, color, colorh] [TAG] [Nombre]");
//-----------------------------------------------
        new Tienescore = GetPlayerScore(playerid);
        if(Tienescore >= 2000)
   {
               } else { //Forma uno qe salga el mensaje y si funciona!
               SendClientMessage(playerid, ROJO, "Tu score debe ser >= 2000 para poder crear un CLAN.");
               return 1;
   }
//-----------------------------------------------
        if(!strcmp(tmp, "crear", true))
        {
            if(Ingresado[playerid] == false) return SendClientMessage(playerid, ROJO, "Necesitas estar logueado para usar este comando");
           
            if(EnClan[playerid] == true) return SendClientMessage(playerid, ROJO, "<Info> Ya tienes clan");
            tmp2 = strtok(cmdtext, idx);
            tmp3 = strrest(cmdtext, idx);
            if(!strlen(tmp2) || !strlen(tmp3)) return SendClientMessage(playerid, BLANCO, "Usa: /clan crear [TAG] [Nombre]");
            if(strlen(tmp2) < 1 || strlen(tmp2) > 3) return SendClientMessage(playerid, ROJO, "<Info> El TAG debe ser de 1 a 3 Caracteres");
            if(strlen(tmp3) < 3 || strlen(tmp3) > 24) return SendClientMessage(playerid, ROJO, "<Info> El Nombre debe ser de 3 a 24 caracteres");
            if(strfind(tmp2, "[", true) != -1 || strfind(tmp2, "]", true) != -1)
            {
                return SendClientMessage(playerid, ROJO, "Sin '[' ']' (corchetes).");
            }
            format(Archivo, sizeof Archivo, "Clanes/%s.ini", tmp2);
            if(!dini_Exists(Archivo))
            {
                format(Clan_TAG[playerid], 4, "%s", tmp2);
                Clan_ID[playerid] = dini_Int("Clan.ini", "Clan_IDs") + 1;
                dini_IntSet("Clan.ini", "Clan_IDs", Clan_ID[playerid]);
                dini_Create(Archivo);
                dini_IntSet(Archivo, "ID", Clan_ID[playerid]);
                dini_Set(Archivo, "Nombre", tmp3);
                dini_Set(Archivo, "TAG", tmp2);
                dini_IntSet(Archivo, "Color", 0);
                dini_Set(Archivo, "Lider", Nickname[playerid]);
                dini_IntSet(Archivo, "Miembros", 1);
                dini_IntSet(Archivo, "Asesinatos", 0);
                dini_IntSet(Archivo, "Muertes", 0);
                dini_FloatSet(Archivo, "Ratio", 0.0);
                dini_Set(Archivo, "Miembro_1", Nickname[playerid]);
                for(new l = 2; l < 21; l++)
                {
                    format(string, sizeof string, "Miembro_%d", l);
                    dini_Set(Archivo, string, "<Vacio>");
                }
                format(Archivo, sizeof Archivo, "Jugadores/%s.ini", Nickname[playerid]);
                dini_Set(Archivo, "Clan", Clan_TAG[playerid]);
                file = fopen("Clanes.txt", io_append);
                format(string, sizeof(string), "%s;\r\n", Clan_TAG[playerid]);
                fwrite(file, string);
                fclose(file);
                format(Nick, sizeof Nick, "[%s]%s", Clan_TAG[playerid], Nickname[playerid]);
                SetPlayerName(playerid, Nick);
                SetPlayerColor(playerid, 0);
                EnClan[playerid] = true;
                format(string, sizeof string, "Has creado el clan '%s' TAG: [%s]", tmp3, tmp2);
                SendClientMessage(playerid, CELESTE, string);
                SendClientMessage(playerid, NARANJA, "Usa /clan color/colorh para cambiar el color de tu clan");
            }   else {
                SendClientMessage(playerid , ROJO, "<Info> El TAG ya estб en uso");
        }
            return 1;
        }
FORMA 2:

pawn Код:
if(!strcmp(cmd, "/clan", true))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, BLANCO, "Usa: /clan [crear, invitar, rechazar, entrar, salir, expulsar, info, color, colorh] [TAG] [Nombre]");
//-----------------------------------------------
        new Tienescore = GetPlayerScore(playerid);
        if(Tienescore >= 2000)
   {
//-----------------------------------------------
        if(!strcmp(tmp, "crear", true))
        {
            if(Ingresado[playerid] == false) return SendClientMessage(playerid, ROJO, "Necesitas estar logueado para usar este comando");
           
            if(EnClan[playerid] == true) return SendClientMessage(playerid, ROJO, "<Info> Ya tienes clan");
            tmp2 = strtok(cmdtext, idx);
            tmp3 = strrest(cmdtext, idx);
            if(!strlen(tmp2) || !strlen(tmp3)) return SendClientMessage(playerid, BLANCO, "Usa: /clan crear [TAG] [Nombre]");
            if(strlen(tmp2) < 1 || strlen(tmp2) > 3) return SendClientMessage(playerid, ROJO, "<Info> El TAG debe ser de 1 a 3 Caracteres");
            if(strlen(tmp3) < 3 || strlen(tmp3) > 24) return SendClientMessage(playerid, ROJO, "<Info> El Nombre debe ser de 3 a 24 caracteres");
            if(strfind(tmp2, "[", true) != -1 || strfind(tmp2, "]", true) != -1)
            {
                return SendClientMessage(playerid, ROJO, "Sin '[' ']' (corchetes).");
            }
            format(Archivo, sizeof Archivo, "Clanes/%s.ini", tmp2);
            if(!dini_Exists(Archivo))
            {
                format(Clan_TAG[playerid], 4, "%s", tmp2);
                Clan_ID[playerid] = dini_Int("Clan.ini", "Clan_IDs") + 1;
                dini_IntSet("Clan.ini", "Clan_IDs", Clan_ID[playerid]);
                dini_Create(Archivo);
                dini_IntSet(Archivo, "ID", Clan_ID[playerid]);
                dini_Set(Archivo, "Nombre", tmp3);
                dini_Set(Archivo, "TAG", tmp2);
                dini_IntSet(Archivo, "Color", 0);
                dini_Set(Archivo, "Lider", Nickname[playerid]);
                dini_IntSet(Archivo, "Miembros", 1);
                dini_IntSet(Archivo, "Asesinatos", 0);
                dini_IntSet(Archivo, "Muertes", 0);
                dini_FloatSet(Archivo, "Ratio", 0.0);
                dini_Set(Archivo, "Miembro_1", Nickname[playerid]);
                for(new l = 2; l < 21; l++)
                {
                    format(string, sizeof string, "Miembro_%d", l);
                    dini_Set(Archivo, string, "<Vacio>");
                }
                format(Archivo, sizeof Archivo, "Jugadores/%s.ini", Nickname[playerid]);
                dini_Set(Archivo, "Clan", Clan_TAG[playerid]);
                file = fopen("Clanes.txt", io_append);
                format(string, sizeof(string), "%s;\r\n", Clan_TAG[playerid]);
                fwrite(file, string);
                fclose(file);
                format(Nick, sizeof Nick, "[%s]%s", Clan_TAG[playerid], Nickname[playerid]);
                SetPlayerName(playerid, Nick);
                SetPlayerColor(playerid, 0);
                EnClan[playerid] = true;
                format(string, sizeof string, "Has creado el clan '%s' TAG: [%s]", tmp3, tmp2);
                SendClientMessage(playerid, CELESTE, string);
                SendClientMessage(playerid, NARANJA, "Usa /clan color/colorh para cambiar el color de tu clan");
            }   else {
                SendClientMessage(playerid , ROJO, "<Info> El TAG ya estб en uso");
        }
               } else {
               SendClientMessage(playerid, ROJO, "Tu score debe ser >= 2000 para poder crear un CLAN."); //Aqui el mensaje
   }
        return 1;
    }
Pero como dije anteriormente afecta los demsa comandos
los publicos :S!

Lo unico qe funciona es sii agrego

pawn Код:
new Tienescore1 = GetPlayerScore(playerid);
        if(Tienescore1 == 0)
   {
               } else {
               SendClientMessage(playerid, ROJO, "");
               return 1;
   }
antes de cada comando! :S! peroo es una ostia xD!

Cual seraa mi error?
Reply
#2

Prueba Ahi

pawn Код:
if(!strcmp(cmd, "/clan", true))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, BLANCO, "Usa: /clan [crear, invitar, rechazar, entrar, salir, expulsar, info, color, colorh] [TAG] [Nombre]");
//-----------------------------------------------
        new Tienescore = GetPlayerScore(playerid);
       
   }
//-----------------------------------------------
        if(!strcmp(tmp, "crear", true))
        {
            if(Ingresado[playerid] == false) return SendClientMessage(playerid, ROJO, "Necesitas estar logueado para usar este comando");
            if(Tienescore<=2000) return SendClientMessage(playerid,Rojo,"Tu score debe ser >= 2000 para poder crear un CLAN.");
            if(EnClan[playerid] == true) return SendClientMessage(playerid, ROJO, "<Info> Ya tienes clan");
            tmp2 = strtok(cmdtext, idx);
            tmp3 = strrest(cmdtext, idx);
            if(!strlen(tmp2) || !strlen(tmp3)) return SendClientMessage(playerid, BLANCO, "Usa: /clan crear [TAG] [Nombre]");
            if(strlen(tmp2) < 1 || strlen(tmp2) > 3) return SendClientMessage(playerid, ROJO, "<Info> El TAG debe ser de 1 a 3 Caracteres");
            if(strlen(tmp3) < 3 || strlen(tmp3) > 24) return SendClientMessage(playerid, ROJO, "<Info> El Nombre debe ser de 3 a 24 caracteres");
            if(strfind(tmp2, "[", true) != -1 || strfind(tmp2, "]", true) != -1)
            {
                return SendClientMessage(playerid, ROJO, "Sin '[' ']' (corchetes).");
            }
            format(Archivo, sizeof Archivo, "Clanes/%s.ini", tmp2);
            if(!dini_Exists(Archivo))
            {
                format(Clan_TAG[playerid], 4, "%s", tmp2);
                Clan_ID[playerid] = dini_Int("Clan.ini", "Clan_IDs") + 1;
                dini_IntSet("Clan.ini", "Clan_IDs", Clan_ID[playerid]);
                dini_Create(Archivo);
                dini_IntSet(Archivo, "ID", Clan_ID[playerid]);
                dini_Set(Archivo, "Nombre", tmp3);
                dini_Set(Archivo, "TAG", tmp2);
                dini_IntSet(Archivo, "Color", 0);
                dini_Set(Archivo, "Lider", Nickname[playerid]);
                dini_IntSet(Archivo, "Miembros", 1);
                dini_IntSet(Archivo, "Asesinatos", 0);
                dini_IntSet(Archivo, "Muertes", 0);
                dini_FloatSet(Archivo, "Ratio", 0.0);
                dini_Set(Archivo, "Miembro_1", Nickname[playerid]);
                for(new l = 2; l < 21; l++)
                {
                    format(string, sizeof string, "Miembro_%d", l);
                    dini_Set(Archivo, string, "<Vacio>");
                }
                format(Archivo, sizeof Archivo, "Jugadores/%s.ini", Nickname[playerid]);
                dini_Set(Archivo, "Clan", Clan_TAG[playerid]);
                file = fopen("Clanes.txt", io_append);
                format(string, sizeof(string), "%s;\r\n", Clan_TAG[playerid]);
                fwrite(file, string);
                fclose(file);
                format(Nick, sizeof Nick, "[%s]%s", Clan_TAG[playerid], Nickname[playerid]);
                SetPlayerName(playerid, Nick);
                SetPlayerColor(playerid, 0);
                EnClan[playerid] = true;
                format(string, sizeof string, "Has creado el clan '%s' TAG: [%s]", tmp3, tmp2);
                SendClientMessage(playerid, CELESTE, string);
                SendClientMessage(playerid, NARANJA, "Usa /clan color/colorh para cambiar el color de tu clan");
            }   else {
                SendClientMessage(playerid , ROJO, "<Info> El TAG ya estб en uso");
        }
            return 1;
        }
El error que tienes es que colocas la condiciуn para todo el comando osea, cualquier acciуn que quieras hacer en el comando te va a checkear si tienes score suficiente, pero ahi en el cуdigo que te puse solo checkeara cuando intentes crear un clan..
Saludos
Reply
#3

Quote:
Originally Posted by MemoX
Посмотреть сообщение
Prueba Ahi

pawn Код:
if(!strcmp(cmd, "/clan", true))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, BLANCO, "Usa: /clan [crear, invitar, rechazar, entrar, salir, expulsar, info, color, colorh] [TAG] [Nombre]");
//-----------------------------------------------
        new Tienescore = GetPlayerScore(playerid);
//-----------------------------------------------
        if(!strcmp(tmp, "crear", true))
        {
            if(Ingresado[playerid] == false) return SendClientMessage(playerid, ROJO, "Necesitas estar logueado para usar este comando");
            if(Tienescore<=2000) return SendClientMessage(playerid,Rojo,"Tu score debe ser >= 2000 para poder crear un CLAN.");
            if(EnClan[playerid] == true) return SendClientMessage(playerid, ROJO, "<Info> Ya tienes clan");
            tmp2 = strtok(cmdtext, idx);
            tmp3 = strrest(cmdtext, idx);
            if(!strlen(tmp2) || !strlen(tmp3)) return SendClientMessage(playerid, BLANCO, "Usa: /clan crear [TAG] [Nombre]");
            if(strlen(tmp2) < 1 || strlen(tmp2) > 3) return SendClientMessage(playerid, ROJO, "<Info> El TAG debe ser de 1 a 3 Caracteres");
            if(strlen(tmp3) < 3 || strlen(tmp3) > 24) return SendClientMessage(playerid, ROJO, "<Info> El Nombre debe ser de 3 a 24 caracteres");
            if(strfind(tmp2, "[", true) != -1 || strfind(tmp2, "]", true) != -1)
            {
                return SendClientMessage(playerid, ROJO, "Sin '[' ']' (corchetes).");
            }
            format(Archivo, sizeof Archivo, "Clanes/%s.ini", tmp2);
            if(!dini_Exists(Archivo))
            {
                format(Clan_TAG[playerid], 4, "%s", tmp2);
                Clan_ID[playerid] = dini_Int("Clan.ini", "Clan_IDs") + 1;
                dini_IntSet("Clan.ini", "Clan_IDs", Clan_ID[playerid]);
                dini_Create(Archivo);
                dini_IntSet(Archivo, "ID", Clan_ID[playerid]);
                dini_Set(Archivo, "Nombre", tmp3);
                dini_Set(Archivo, "TAG", tmp2);
                dini_IntSet(Archivo, "Color", 0);
                dini_Set(Archivo, "Lider", Nickname[playerid]);
                dini_IntSet(Archivo, "Miembros", 1);
                dini_IntSet(Archivo, "Asesinatos", 0);
                dini_IntSet(Archivo, "Muertes", 0);
                dini_FloatSet(Archivo, "Ratio", 0.0);
                dini_Set(Archivo, "Miembro_1", Nickname[playerid]);
                for(new l = 2; l < 21; l++)
                {
                    format(string, sizeof string, "Miembro_%d", l);
                    dini_Set(Archivo, string, "<Vacio>");
                }
                format(Archivo, sizeof Archivo, "Jugadores/%s.ini", Nickname[playerid]);
                dini_Set(Archivo, "Clan", Clan_TAG[playerid]);
                file = fopen("Clanes.txt", io_append);
                format(string, sizeof(string), "%s;\r\n", Clan_TAG[playerid]);
                fwrite(file, string);
                fclose(file);
                format(Nick, sizeof Nick, "[%s]%s", Clan_TAG[playerid], Nickname[playerid]);
                SetPlayerName(playerid, Nick);
                SetPlayerColor(playerid, 0);
                EnClan[playerid] = true;
                format(string, sizeof string, "Has creado el clan '%s' TAG: [%s]", tmp3, tmp2);
                SendClientMessage(playerid, CELESTE, string);
                SendClientMessage(playerid, NARANJA, "Usa /clan color/colorh para cambiar el color de tu clan");
            }   else {
                SendClientMessage(playerid , ROJO, "<Info> El TAG ya estб en uso");
        }
            return 1;
        }
El error que tienes es que colocas la condiciуn para todo el comando osea, cualquier acciуn que quieras hacer en el comando te va a checkear si tienes score suficiente, pero ahi en el cуdigo que te puse solo checkeara cuando intentes crear un clan..
Saludos
Casi bien pero creo que te sobro un }

Porcierto ConecCionMex podias publicar el sistema de clanes

Iva a hacer uno pero nunca encuentro tiempo ni ganas xD
Reply
#4

Quote:
Originally Posted by Rafa122
Посмотреть сообщение
Casi bien pero creo que te sobro un }

Porcierto ConecCionMex podias publicar el sistema de clanes

Iva a hacer uno pero nunca encuentro tiempo ni ganas xD
ya no tengo el original!

el qe tengo ya esta Modificado y le puse otras cosas o comandos! XD!
Reply
#5

encontre el problema esqe el codigo
pawn Код:
new Tienescore = GetPlayerScore(playerid);
       
   }
Tiene qe ir despues del cmdn este caso despues de

pawn Код:
if(!strcmp(tmp, "crear", true))
        {
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)