[AJUDA] Ajeitar GM
#1

Galera tava fazendo esse gm, e comзei a pegar parte de um outro e me enrrolei um pouco e ficou com esses erros e warning

erros e war:

PHP код:
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(35) : warning 217loose indentation
C
:\Users\Antonio\samp host\filterscripts\Mala.pwn(21) : warning 204symbol is assigned a value that is never used"string"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(21 -- 38) : error 010invalid function or declaration
C
:\Users\Antonio\samp host\filterscripts\Mala.pwn(21 -- 40) : error 010invalid function or declaration
C
:\Users\Antonio\samp host\filterscripts\Mala.pwn(21 -- 43) : error 010invalid function or declaration
C
:\Users\Antonio\samp host\filterscripts\Mala.pwn(21 -- 43) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

Linhas:

PHP код:
#include <a_samp>
main()
{
    print(
"\n----------------------------------");
    print(
" Teste Mala");
    print(
"----------------------------------\n");
}
public 
OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
        new 
string[256];
        new 
cmd[256];
        new 
idx;
        
cmd strtok(cmdtextidx);
//==================================[mala]=====================================
        
if(strcmp(cmdtext"/comprarmala"true) == 0)
        {
               if(
IsPlayerConnected(playerid))
            {
                if(
GetPlayerMoney(playerid)<2000)return SendClientMessage(playerid0xFFFFFFFF,"Vocк nгo tem R$1000!");
                
SetPlayerAttachedObjectplayerid0121260.1183110.0292330.0295250.000000260.2143240.0000001.0000001.0000001.000000 );
                
GivePlayerMoney(playerid, -2000);
                }
            }
            return 
1;
        }
        if(
strcmp(cmd"/darmala"true) == 0)
        {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD1"USO: /darmala [playerid/Parte-do-Nick] [quantia]");
                return 
1;
            }
            
//giveplayerid = strval(tmp);
            
giveplayerid ReturnUser(tmp);
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD1"USO: /darmala [playerid/Parte-do-Nick] [quantia]");
                return 
1;
            }
            
moneys strval(tmp);
            if(
moneys || moneys 99999)
            {
                
SendClientMessage(playeridCOLOR_GRAD1"Escolha entre 1 e R$: 50000");
                return 
1;
            }
            if (
IsPlayerConnected(giveplayerid))
            {
                if(
giveplayerid != INVALID_PLAYER_ID)
                {
                    if(
PlayerInfo[giveplayerid][pLocal] == 106)
                    {
                        
SendClientMessage(playeridCOLOR_GRAD1"Este comando nгo й habilitado para se usar nesse lugar.");
                        return 
1;
                    }
                    if (
ProxDetectorS(5.0playeridgiveplayerid))
                    {
                        
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        
playermoney GetPlayerMoneyEx(playerid);
                        if (
moneys && playermoney >= moneys)
                        {
                            
ConsumingMoney[giveplayerid] = 1;
                            
GivePlayerMoneyEx(playerid, (moneys));
                            
GivePlayerMoneyEx(giveplayeridmoneys);
                            
format(stringsizeof(string), "   Vocк enviou R$: %d para %s(Jogador: %d)"moneysgiveplayer,giveplayerid);
                            
PlayerPlaySound(playerid10520.00.00.0);
                            
SendClientMessage(playeridCOLOR_GRAD1string);
                            
format(stringsizeof(string), "   Vocк recebeu R$: %d de %s(Jogador: %d)."moneyssendernameplayerid);
                            
SendClientMessage(giveplayeridCOLOR_GRAD1string);
                            
format(stringsizeof(string), "%s pagou R$: %d para %s"sendernamemoneysgiveplayer);
                            
PayLog(string);
                            
PlayerPlaySound(giveplayerid10520.00.00.0);
                            
format(stringsizeof(string), "%s deu algum dinheiro para %s."sendername ,giveplayer);
                            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_GRAD1"   Quantia invбlida");
                        }
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GRAD1"   Vocк estб longe do persongem");
                    }
                }
//invalid id
            
}
            else
            {
                
format(stringsizeof(string), "   %d nгo й um jogador Ativo."giveplayerid);
                
SendClientMessage(playeridCOLOR_GRAD1string);
            }
        }
    return 
0;
}
stock strtok(const string[], &index)
{
    new 
length strlen(string);
    while ((
index length) && (string[index] <= ' '))
    {
        
index++;
    }
    new 
offset index;
    new 
result[20];
    while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
    {
        
result[index offset] = string[index];
        
index++;
    }
    
result[index offset] = EOS;
    return 
result;

Reply
#2

simples, mude o comando /comprarmala por:

pawn Код:
if(strcmp(cmdtext, "/comprarmala", true) == 0)
        {
            if(IsPlayerConnected(playerid))
            {
                if(GetPlayerMoney(playerid)<2000)return SendClientMessage(playerid, 0xFFFFFFFF,"Vocк nгo tem R$1000!");
                SetPlayerAttachedObject( playerid, 0, 1212, 6, 0.118311, 0.029233, 0.029525, 0.000000, 260.214324, 0.000000, 1.000000, 1.000000, 1.000000 );
                GivePlayerMoney(playerid, -2000);
            }
            return 1;
        }
e o comando /darmala por:
pawn Код:
if(strcmp(cmd, "/darmala", true) == 0)
        {
            if(IsPlayerConnected(playerid))
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "USO: /darmala [playerid/Parte-do-Nick] [quantia]");
                    return 1;
                }
                //giveplayerid = strval(tmp);
                giveplayerid = ReturnUser(tmp);
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "USO: /darmala [playerid/Parte-do-Nick] [quantia]");
                    return 1;
                }
                moneys = strval(tmp);
                if(moneys < 1 || moneys > 99999)
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "Escolha entre 1 e R$: 50000");
                    return 1;
                }
                if (IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(PlayerInfo[giveplayerid][pLocal] == 106)
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "Este comando nгo й habilitado para se usar nesse lugar.");
                            return 1;
                        }
                        if (ProxDetectorS(5.0, playerid, giveplayerid))
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            playermoney = GetPlayerMoneyEx(playerid);
                            if (moneys > 0 && playermoney >= moneys)
                            {
                                ConsumingMoney[giveplayerid] = 1;
                                GivePlayerMoneyEx(playerid, (0 - moneys));
                                GivePlayerMoneyEx(giveplayerid, moneys);
                                format(string, sizeof(string), "   Vocк enviou R$: %d para %s(Jogador: %d)", moneys, giveplayer,giveplayerid);
                                PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                                SendClientMessage(playerid, COLOR_GRAD1, string);
                                format(string, sizeof(string), "   Vocк recebeu R$: %d de %s(Jogador: %d).", moneys, sendername, playerid);
                                SendClientMessage(giveplayerid, COLOR_GRAD1, string);
                                format(string, sizeof(string), "%s pagou R$: %d para %s", sendername, moneys, giveplayer);
                                PayLog(string);
                                PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
                                format(string, sizeof(string), "%s deu algum dinheiro para %s.", sendername ,giveplayer);
                                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_GRAD1, "   Quantia invбlida");
                            }
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "   Vocк estб longe do persongem");
                        }
                    }//invalid id
                }
                else
                {
                    format(string, sizeof(string), "   %d nгo й um jogador Ativo.", giveplayerid);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
            }
            return 1;
        }
Reply
#3

Deu isso kkk

PHP код:
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(25) : error 017undefined symbol "strtok"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(25) : error 033: array must be indexed (variable "cmd")
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(27) : warning 217loose indentation
C
:\Users\Antonio\samp host\filterscripts\Mala.pwn(31) : error 079inconsistent return types (array & non-array)
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(35) : error 079inconsistent return types (array & non-array)
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(38) : warning 217loose indentation
C
:\Users\Antonio\samp host\filterscripts\Mala.pwn(42) : error 017undefined symbol "tmp"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(42) : error 017undefined symbol "strtok"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(43) : error 017undefined symbol "tmp"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(45) : error 017undefined symbol "COLOR_GRAD1"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(46) : error 079inconsistent return types (array & non-array)
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(49) : error 017undefined symbol "giveplayerid"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(49) : error 017undefined symbol "ReturnUser"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(50) : error 017undefined symbol "tmp"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(50) : error 017undefined symbol "strtok"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(51) : error 017undefined symbol "tmp"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(53) : error 017undefined symbol "COLOR_GRAD1"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(54) : error 079inconsistent return types (array & non-array) 
Reply
#4

Nгo precisa de IsPlayerConnected(playerid) no OnPlayerCommandText, a nгo ser que esteja sendo usado da seguinte forma.

pawn Код:
OnPlayerCommandText(playerid, "/teste");

pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
        index++;

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

Troque COLOR_GRAD1 por -1
Reply
#5

ajeitou mais, como veio de outro gm ficou dando erros nos new, teria como me ajudar nesses new?

pu tira como refazer o segundo CMD ?
Reply
#6

Quais erros ainda persistem?
Reply
#7

Esatamentes as news olhe

erros:

PHP код:
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(56) : error 017undefined symbol "ReturnUser"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(73) : error 017undefined symbol "PlayerInfo"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(73) : warning 215expression has no effect
C
:\Users\Antonio\samp host\filterscripts\Mala.pwn(73) : error 001expected token";"but found "]"
C:\Users\Antonio\samp host\filterscripts\Mala.pwn(73) : error 029invalid expressionassumed zero
C
:\Users\Antonio\samp host\filterscripts\Mala.pwn(73) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase 
Reply
#8

PlayerInfo й do outro GM, nao vai funcionar nesse novo.

pawn Код:
stock ReturnUser(PlayerName[])
{
    if(IsNumeric(PlayerName))
        return strval(PlayerName);
    else
    {
        new found=0, id;
        for(new i=0; i <= MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                new foundname[MAX_PLAYER_NAME];
                GetPlayerName(i, foundname, MAX_PLAYER_NAME);
                new namelen = strlen(foundname);
                new bool:searched=false;
                for(new pos=0; pos <= namelen; pos++)
                {
                    if(searched != true)
                    {
                        if(strfind(foundname,PlayerName,true) == pos)
                        {
                            found++;
                            id = i;
                        }
                    }
                }
            }
        }
        if(found == 1)
            return id;
        else
            return INVALID_PLAYER_ID;
    }
}
Reply
#9

E esse CMD que eu fiz, ta muito bugado a fica dificil editar. Vou tentar criar aki.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)