[AYUDA] Y porque este error? :/
#1

Puse un comando con ! en OnPlayerText pero nose que salio mal...

El codigo

pawn Код:
if(text[0] == '!')
    {
        if(text[1] != '\0')
        {
            if(!IsPlayerConnected(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "No estбs conectado.");
            if(nofac == 1 && Info[playerid][pLeader] < 1) return SendClientMessageEx(playerid, COLOR_GRAD2, "El Chat de faccion esta bloqueado");
            if(!isnull(text[1]))
            {
                new string[128];
                if (Info[playerid][pLeader] > 0 || Info[playerid][pMember] > 0 || Info[playerid][pFMember] < 255)
                {
                    new member = Info[playerid][pMember]
                    new fam = Info[playerid][pFMember];
                    if(member==1)  //SAPD
                    {
                        if(Info[playerid][pRank] == 6) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Comandante %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                        else if(Info[playerid][pRank] == 5) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Teniente %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                        else if(Info[playerid][pRank] == 4) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Sargento %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                        else if(Info[playerid][pRank] == 3) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Detective %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                        else if(Info[playerid][pRank] == 2) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Oficial %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                        else if(Info[playerid][pRank] == 1) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Cadete %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                        else { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Cadete %s: %s", GetPlayerNameEx(playerid), text[1]); }
                        SendFamilyMessage(Info[playerid][pMember], 0x7BDDA5AA, string);
                    }
                }
            }
        }
        return 0;
    }
Lo que me salio al copilar...

pawn Код:
(44349) : error 001: expected token: ")", but found "["
(44349) : error 029: invalid expression, assumed zero
(44349) : error 029: invalid expression, assumed zero
(44349) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
En la pagina 44349 hay esto
pawn Код:
if(!isnull(text[1]))
La verdad que no entiendo, porque el error? son por los [ ] ?

Espero que me ayuden
Reply
#2

Prueba asн:

pawn Код:
if(text[0] == '!')
    {
        if(text[1] != '\0')
        {
            if(!IsPlayerConnected(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "No estбs conectado.");
            if(nofac == 1 && Info[playerid][pLeader] < 1) return SendClientMessageEx(playerid, COLOR_GRAD2, "El Chat de faccion esta bloqueado");
            new string[128];
            if (Info[playerid][pLeader] > 0 || Info[playerid][pMember] > 0 || Info[playerid][pFMember] < 255)
            {
                new member = Info[playerid][pMember]
                new fam = Info[playerid][pFMember];
                if(member==1)  //SAPD
                {
                    if(Info[playerid][pRank] == 6) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Comandante %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                    else if(Info[playerid][pRank] == 5) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Teniente %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                    else if(Info[playerid][pRank] == 4) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Sargento %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                    else if(Info[playerid][pRank] == 3) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Detective %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                    else if(Info[playerid][pRank] == 2) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Oficial %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                    else if(Info[playerid][pRank] == 1) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Cadete %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                    else { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Cadete %s: %s", GetPlayerNameEx(playerid), text[1]); }
                    SendFamilyMessage(Info[playerid][pMember], 0x7BDDA5AA, string);
                    return 0;
                }
            }
        }
    }
Reply
#3

pawn Код:
if(strlen(text[0]) == '!')
{
    if(strlen(text[1]) != '\0')
    {
        if(!IsPlayerConnected(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "No estбs conectado.");
        if(nofac == 1 && Info[playerid][pLeader] < 1) return SendClientMessageEx(playerid, COLOR_GRAD2, "El Chat de faccion esta bloqueado");
        new string[128];
        if (Info[playerid][pLeader] > 0 || Info[playerid][pMember] > 0 || Info[playerid][pFMember] < 255)
        {
            new member = Info[playerid][pMember]
            new fam = Info[playerid][pFMember];
            if(member==1)  //SAPD
            {
                if(Info[playerid][pRank] == 6) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Comandante %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                else if(Info[playerid][pRank] == 5) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Teniente %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                else if(Info[playerid][pRank] == 4) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Sargento %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                else if(Info[playerid][pRank] == 3) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Detective %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                else if(Info[playerid][pRank] == 2) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Oficial %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                else if(Info[playerid][pRank] == 1) { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Cadete %s: %s ", GetPlayerNameEx(playerid), text[1]); }
                else { format(string, sizeof(string), "{0080FF}[Radio] {ffffff}Cadete %s: %s", GetPlayerNameEx(playerid), text[1]); }
                SendFamilyMessage(Info[playerid][pMember], 0x7BDDA5AA, string);
                return 1;
            }
        }
    }
}
//https://sampwiki.blast.hk/wiki/Strlen
Reply
#4

pawn Код:
new var[144] = "!ediciуn limitada";

if(var[1] != '\0')
{

}
pawn Код:
new var[144] = "!ediciуn limitada";

if(!isnull(var[1]))
{

}
Esos 2 cуdigos vendrian a representar lo mismo por lo que es recomendable borrar el segundo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)