[AJUDA] ERRO
#1

peguei 1 codigo pra so apenas o dono da casa pode andar no carro so q da esse erro:
pawn Код:
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(13277) : error 033: array must be indexed (variable "hOwner")
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(13279) : error 033: array must be indexed (variable "hOwner")
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(13283) : error 033: array must be indexed (variable "hOwner")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
Codigo:
pawn Код:
if(newstate == 2)
    {
    for(new i = 0; i < sizeof(HouseInfo); i++)
        {
            new carrocasa = GetPlayerVehicleID(playerid);
            if(carrocasa == HouseInfo[i][hVec])
            {
                    if(HouseInfo[i][hOwned]==0)
                    {
                        SendClientMessage(playerid, 0xFFFF00AA, "Esse carro nгo tem dono :O !!");
                        RemovePlayerFromVehicle(playerid);
                    }
                    if(HouseInfo[i][hOwned]==1)
                    {
                        new playername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, playername, sizeof(playername));
                        if(strcmp(playername,HouseInfo[i][hOwner],true)==0)
                    {
                        format(string,sizeof(string),"Bem Vindo ao seu veнculo, %s.",HouseInfo[i][hOwner]);
                        SendClientMessage(playerid, 0xFFFF00AA, string);
                    }else
                    {
                        format(string,sizeof(string),"Apenas %s pode dirigir esse veнculo por ser o dono.",HouseInfo[i][hOwner]);
                        SendClientMessage(playerid, 0xFFFF00AA, string);
                        RemovePlayerFromVehicle(playerid);
                    }
                }
            }
        }
    }
Reply
#2

na enum hInfo
adicione o que esta dentro das "{}" chaves logo aki abaixo...

PHP код:
enum hInfo
{
    
hOwner[MAX_PLAYER_NAME],

Reply
#3

na enum hinfo, o hOwner estб dessa maneira 'hOwner[MAX_PLAYER_NAME],' ?

@Edit
Posto primeiro ↑
Reply
#4

Quote:
Originally Posted by EditPawn
Посмотреть сообщение
na enum hInfo
adicione o que esta dentro das "{}" chaves logo aki abaixo...

PHP код:
enum hInfo
{
    
hOwner[MAX_PLAYER_NAME],

Eu coloquei mais deu isso:

pawn Код:
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(2915) : error 021: symbol already defined: "hOwner"
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(13278) : error 033: array must be indexed (variable "hOwner")
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(13280) : error 033: array must be indexed (variable "hOwner")
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(13284) : error 033: array must be indexed (variable "hOwner")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
e tem 1 new criada:
new hOwner[MAX_HOUSES][MAX_PLAYER_NAME];
Reply
#5

Bom nas linhas 13289,13280 e 13284 que sгo as que tгo dando os errados apenas colocar assim.

pawn Код:
lб estarб

hOnwer = // alguma coisa... estб errado...

// mas o correto й assim
hOwner[playerid] = // alguma coisa ........ Provavelmente estб sem [playerid]
Apenas substituir.

Espero ter ajudado.
Reply
#6

pawn Код:
if(newstate == 2) {
    for(new i = 0; i < sizeof(HouseInfo); i++) {
        new carrocasa = GetPlayerVehicleID(playerid);
        if(carrocasa == HouseInfo[i][hVec]) {
            if(!HouseInfo[i][hOwned]) {
                SendClientMessage(playerid, 0xFFFF00AA, "Esse carro nгo tem dono :O !!");
                RemovePlayerFromVehicle(playerid);
            }
            else {
                new playername[MAX_PLAYER_NAME];
                GetPlayerName(playerid, playername, sizeof(playername));
                if(!strcmp(playername,hOwner[i],true)) {
                    format(string,sizeof(string),"Bem Vindo ao seu veнculo, %s.",hOwner[i]);
                    SendClientMessage(playerid, 0xFFFF00AA, string);
                } else {
                    format(string,sizeof(string),"Apenas %s pode dirigir esse veнculo por ser o dono.",hOwner[i]);
                    SendClientMessage(playerid, 0xFFFF00AA, string);
                    RemovePlayerFromVehicle(playerid);
                }
            }
        }
    }
}
Reply
#7

Quote:
Originally Posted by paulor
Посмотреть сообщение
pawn Код:
if(newstate == 2) {
    for(new i = 0; i < sizeof(HouseInfo); i++) {
        new carrocasa = GetPlayerVehicleID(playerid);
        if(carrocasa == HouseInfo[i][hVec]) {
            if(!HouseInfo[i][hOwned]) {
                SendClientMessage(playerid, 0xFFFF00AA, "Esse carro nгo tem dono :O !!");
                RemovePlayerFromVehicle(playerid);
            }
            else {
                new playername[MAX_PLAYER_NAME];
                GetPlayerName(playerid, playername, sizeof(playername));
                if(strcmp(playername,hOwner[i],true)==0) {
                    format(string,sizeof(string),"Bem Vindo ao seu veнculo, %s.",hOwner[i]);
                    SendClientMessage(playerid, 0xFFFF00AA, string);
                } else {
                    format(string,sizeof(string),"Apenas %s pode dirigir esse veнculo por ser o dono.",hOwner[i]);
                    SendClientMessage(playerid, 0xFFFF00AA, string);
                    RemovePlayerFromVehicle(playerid);
                }
            }
        }
    }
}
Deu erro:

pawn Код:
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(13270) : error 003: declaration of a local variable must appear in a compound block
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(13270) : error 017: undefined symbol "playername"
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(13270) : warning 215: expression has no effect
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(13270) : error 001: expected token: ";", but found "]"
C:\Users\gta\Desktop\servidor\gamemodes\gm.pwn(13270) : 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.
Reply
#8

pawn Код:
if(newstate == 2) {
    for(new i = 0; i < sizeof(HouseInfo); i++) {
        new carrocasa = GetPlayerVehicleID(playerid);
        if(carrocasa == HouseInfo[i][hVec]) {
            if(!HouseInfo[i][hOwned]) {
                SendClientMessage(playerid, 0xFFFF00AA, "Esse carro nгo tem dono :O !!");
                RemovePlayerFromVehicle(playerid);
            }
            else {
                new PTNome[24];
                GetPlayerName(playerid, PTNome, 24);
                if(!strcmp(PTNome, hOwner[i], true)) {
                    format(string,sizeof(string),"Bem Vindo ao seu veнculo, %s.",hOwner[i]);
                    SendClientMessage(playerid, 0xFFFF00AA, string);
                } else {
                    format(string,sizeof(string),"Apenas %s pode dirigir esse veнculo por ser o dono.",hOwner[i]);
                    SendClientMessage(playerid, 0xFFFF00AA, string);
                    RemovePlayerFromVehicle(playerid);
                }
            }
        }
    }
}
Reply
#9

Quote:
Originally Posted by paulor
Посмотреть сообщение
pawn Код:
if(newstate == 2) {
    for(new i = 0; i < sizeof(HouseInfo); i++) {
        new carrocasa = GetPlayerVehicleID(playerid);
        if(carrocasa == HouseInfo[i][hVec]) {
            if(!HouseInfo[i][hOwned]) {
                SendClientMessage(playerid, 0xFFFF00AA, "Esse carro nгo tem dono :O !!");
                RemovePlayerFromVehicle(playerid);
            }
            else {
                new PTNome[24];
                GetPlayerName(playerid, PTNome, 24);
                if(!strcmp(PTNome, hOwner[i], true)) {
                    format(string,sizeof(string),"Bem Vindo ao seu veнculo, %s.",hOwner[i]);
                    SendClientMessage(playerid, 0xFFFF00AA, string);
                } else {
                    format(string,sizeof(string),"Apenas %s pode dirigir esse veнculo por ser o dono.",hOwner[i]);
                    SendClientMessage(playerid, 0xFFFF00AA, string);
                    RemovePlayerFromVehicle(playerid);
                }
            }
        }
    }
}
Ae pegou, so q os carro da casa, qualquer 1 pode pega ainda...
nem as mensagem aparece :O
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)