[Ajuda] Carregamento
#1

Eu quero que de para /entregarcarga somente neste local mas nгo estб indo, olhe o jeito que deixei:


New:
pawn Код:
new AreaEntrega[MAX_PLAYERS];

Areб pra entregar:
pawn Код:
if (PlayerToPoint(10.0, i, 1704.3691, 2332.8310, 10.5472)){
GameTextForPlayer(i,"~b~Area ~n~~y~De ~n~~r~Descarregamento ~n~~p~/entregarcarga",3000,4);
AreaEntrega[i] = 1;
} else {
if(AreaEntrega[i] == 1){
AreaEntrega[i] = 0;

pawn Код:
if(strcmp(cmd,"/entregarcarga",true) == 0){
if(CargaCaminhao[playerid] == 0){
SendClientMessage(playerid,Vermelho,"[ERRO] Seu veнculo nгo estб com a carga!");
return 1;
} else {
CargaCaminhao[playerid] = 1;
if(AreaEntrega[playerid] == 1){
SendClientMessage(playerid,COLOR_GREEN,"(INFO) Sua carga foi entregada e vocк ganhou R$: 1.500,00 reais.");
GivePlayerGrana(playerid,1500);
return 1;
} else {
SendClientMessage(playerid, Vermelho, "[ERRO] Vocк nгo estб na area de entrega de carga de caminhгo.");
return 1;
}
}
Reply
#2

pawn Код:
if(strcmp(cmd,"/entregarcarga",true) == 0)
    {
   
        if( !IsPlayerInPlace( playerid, 1704.3691, 2332.8310, 10.5472 ))
        {
            SendClientMessage( playerid, Vermelho, "[ x ] Vocк nгo estб na area de carregamento !" );
            return 1;
        }
        else if(CargaCaminhao[playerid] == 0)
        {
            SendClientMessage(playerid,Vermelho,"[ERRO] Seu veнculo nгo estб com a carga!");
            return 1;
        }
        else if(AreaEntrega[playerid] == 1)
        {
            SendClientMessage(playerid,COLOR_GREEN,"(INFO) Sua carga foi entregada e vocк ganhou R$: 1.500,00 reais.");
            GivePlayerGrana(playerid,1500);
            CargaCaminhao[playerid] = 1;
            return 1;
        } else {
            SendClientMessage(playerid, "Vermelho", "[ERRO] Vocк nгo estб na area de entrega de carga de caminhгo.");
            return 1;
        }
    }
Tente assiim !
Reply
#3

Deu 26 Erros
Reply
#4

Quote:
Originally Posted by ZaturN
Посмотреть сообщение
Deu 26 Erros
pere vou ver o que fiz de errado e bota os erros acho q n fechei chave ^^!

@EDIT As chaves estava normal veja assim

pawn Код:
if(strcmp(cmd,"/entregarcarga",true) == 0)
    {
        if( !IsPlayerInPlace( playerid, 1704.3691, 2332.8310, 10.5472 ))
        {
            SendClientMessage( playerid, Vermelho, "[ x ] Vocк nгo estб na area de carregamento !" );
            return 1;
        }
        if(CargaCaminhao[playerid] == 0)
        {
            SendClientMessage(playerid,Vermelho,"[ERRO] Seu veнculo nгo estб com a carga!");
            return 1;
        }
        if(AreaEntrega[playerid] == 1)
        {
            SendClientMessage(playerid,COLOR_GREEN,"(INFO) Sua carga foi entregada e vocк ganhou R$: 1.500,00 reais.");
            GivePlayerGrana(playerid,1500);
            CargaCaminhao[playerid] = 1;
            return 1;
        }
        else
        {
            SendClientMessage(playerid, "Vermelho", "[ERRO] Vocк nгo estб na area de entrega de carga de caminhгo.");
            return 1;
        }
    }
Reply
#5

Ainda estб dando os 26 erros !


#EDIT
Vк se isto pode lhe ajuda !

pawn Код:
if(strcmp(cmd, "/abastecer", true) == 0) {
new tmp[256];
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
new quantidade;
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "[ERRO] Use: /abastecer [litros]");
return 1;
}
quantidade = strval(tmp);
if(quantidade <= 0 || GetPlayerGrana(playerid) < quantidade){
SendClientMessage(playerid, Vermelho, "[ERRO] Vocк nгo tem dinheiro suficiente para pagar o frentista.");
return 1;
}
if(AreaPosto[playerid] == 1){ // se estiver na area
if(quantidade + dini_Int(file, "Combustivel") < 100){
dini_IntSet(file, "Combustivel", dini_Int(file, "Combustivel") + quantidade);
format(string, sizeof(string), "(INFO) Vocк completou seu tanque com %d litros de combustнvel.", quantidade);
SendClientMessage(playerid, COLOR_GREEN, string);
GivePlayerGrana(playerid, - quantidade);
return 1;
}
if(quantidade + dini_Int(f0D
if(quantidade + dini_Int(file, "Combustivel")){
new quantia;
quantia = 100 - dini_Int(file, "Combustivel");
dini_IntSet(file, "Combustivel", 100);
format(string, sizeof(string), "(INFO) Pronto tanque cheio foram colocados %d litros.", quantia);
SendClientMessage(playerid, COLOR_GREEN, string);
GivePlayerGrana(playerid, - quantia);
return 1;
}
}else{
SendClientMessage(playerid, Vermelho, "[ERRO] Vocк nгo estб no posto.");//quando nгo estiver na area
return 1;
}
}
Reply
#6

Manda os errros e tbm manda mais code acima do seu comando de entregar Carga!

pawn Код:
if(strcmp(cmd, "/abastecer", true) == 0) {
        new tmp[256];
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
        format(file, sizeof(file), PASTA_CONTAS, aname);
        new quantidade;
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,sizeof(pName));
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)){
            SendClientMessage(playerid, Vermelho, "[ERRO] Use: /abastecer [litros]");
            return 1;
        }
        quantidade = strval(tmp);
        if(quantidade <= 0 || GetPlayerGrana(playerid) < quantidade){
            SendClientMessage(playerid, Vermelho, "[ERRO] Vocк nгo tem dinheiro suficiente para pagar o frentista.");
            return 1;
        }
        if(AreaPosto[playerid] == 1){ // se estiver na area
            if(quantidade + dini_Int(file, "Combustivel") < 100){
                dini_IntSet(file, "Combustivel", dini_Int(file, "Combustivel") + quantidade);
                format(string, sizeof(string), "(INFO) Vocк completou seu tanque com %d litros de combustнvel.", quantidade);
                SendClientMessage(playerid, COLOR_GREEN, string);
                GivePlayerGrana(playerid, - quantidade);
                return 1;
            }
            if(quantidade + dini_Int(f0D
            if(quantidade + dini_Int(file, "Combustivel")){
                new quantia;
                quantia = 100 - dini_Int(file, "Combustivel");
                dini_IntSet(file, "Combustivel", 100);
                format(string, sizeof(string), "(INFO) Pronto tanque cheio foram colocados %d litros.", quantia);
                SendClientMessage(playerid, COLOR_GREEN, string);
                GivePlayerGrana(playerid, - quantia);
                return 1;
            }
        }else{
            SendClientMessage(playerid, Vermelho, "[ERRO] Vocк nгo estб no posto.");//quando nгo estiver na area
            return 1;
        }
    }

    if(strcmp(cmd,"/entregarcarga",true) == 0)
    {
        if( !IsPlayerInPlace( playerid, 1704.3691, 2332.8310, 10.5472 ))
        {
            SendClientMessage( playerid, Vermelho, "[ x ] Vocк nгo estб na area de carregamento !" );
            return true;
        }
        if(CargaCaminhao[playerid] == 0)
        {
            SendClientMessage(playerid,Vermelho,"[ERRO] Seu veнculo nгo estб com a carga!");
            return true;
        }
        if(AreaEntrega[playerid] == 1)
        {
            SendClientMessage(playerid,COLOR_GREEN,"(INFO) Sua carga foi entregada e vocк ganhou R$: 1.500,00 reais.");
            GivePlayerGrana(playerid,1500);
            CargaCaminhao[playerid] = 1;
            return true;
        }
        else
        {
            SendClientMessage(playerid, "Vermelho", "[ERRO] Vocк nгo estб na area de entrega de carga de caminhгo.");
            return true;
        }
    }
Uma dica tente identar seus codigos ^^

https://sampforum.blast.hk/showthread.php?tid=361455
Reply
#7

New:
pawn Код:
new AreaEntrega[MAX_PLAYERS];

Comandos:
pawn Код:
if(strcmp(cmd, "/pegarcarga", true) == 0) {
new VehicleID;
VehicleID = GetPlayerVehicleID(playerid);
new modelo;
modelo = GetVehicleModel(VehicleID);
if(modelo == 515) {
if(CargaCaminhao[playerid] == 0){
SendClientMessage(playerid,COLOR_GREEN,"Carga pegada!");
SendClientMessage(playerid,COLOR_GREEN,"Para entrega-lб, siga os pontos para chegar no local");
CargaCaminhao[playerid] = 1;
return 1;
} else {
SendClientMessage(playerid,Vermelho,"[ERRO] Seu caminhгo jб estб carregado!");
return 1;
}
} else {
SendClientMessage(playerid, Vermelho, "[ERRO] Vocк nгo estб em um caminhгo de entregar de carga.");
return 1;
}
}

if(strcmp(cmd,"/entregarcarga",true) == 0){
if(CargaCaminhao[playerid] == 0){
SendClientMessage(playerid,Vermelho,"[ERRO] Seu veнculo nгo estб com a carga!");
return 1;
} else {
CargaCaminhao[playerid] = 1;
SendClientMessage(playerid,COLOR_GREEN,"(INFO) Sua carga foi entregada e vocк ganhou R$: 1.500,00 reais.");
GivePlayerGrana(playerid,1500);
return 1;
}
}

Local pra pegAWN]


Local pra pegar e entregar:
pawn Код:
if (PlayerToPoint(10.0, i, 2203.1601, -2252.2939, 13.2739)){
GameTextForPlayer(i,"~b~Area ~n~~y~De ~n~~g~Carregamento ~n~~p~/pegarcarga",3000,4);
}
if (PlayerToPoint(10.0, i, 1704.3691, 2332.8310, 10.5472)){
GameTextForPlayer(i,"~b~Area ~n~~y~De ~n~~r~Descarregamento ~n~~p~/entregarcarga",3000,4);
}
}
}
}
}
}
}
Eu tirei o AreaEntrega, pra vк se vocк consegue colocar
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)