[Duda] Por quй tengo estos errores?
#1

Buenas, estaba pasando un cуdigo de pastebin a mi GM, y ahora, al terminar de ponerlo, me saltan estos errores:

Код:
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(326) : error 012: invalid function call, not a valid address
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(326) : warning 215: expression has no effect
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(326) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(326) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(326) : fatal error 107: too many error messages on one line
Lнnea 326: i = GetATMID(playerid);

Comando en el que me tira el error:
pawn Код:
zcmd(balance, playerid, params[])
{
    new i;
    i = GetATMID(playerid);
    if(IsPlayerInRangeOfPoint(playerid, 3.0,2316.5034,-10.0475,26.7422))
    {
        new string[256];
        format(string, sizeof(string), "There is %d in your bank account.", Informacion[playerid][pBank]);
        SendClientMessage(playerid, COLOR_ORANGE, string);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 3.0,abInfo[i][ATMx],abInfo[i][ATMy],abInfo[i][ATMz]))
    {
        new string[256];
        format(string, sizeof(string), "There is %d in your bank account.", Informacion[playerid][pBank]);
        SendClientMessage(playerid, COLOR_ORANGE, string);
        return 1;
    }
    else return SendClientMessage(playerid,COLOR_RED,"Not around the bank.");
}
Esos errores (los de arriba) me salen cuando lo tengo definido como
pawn Код:
new GetATMID[MAX_ATM];
Y estos errores me salen, cuando no lo defino (en el sistema no viene definido el new GetATMID[MAX_ATM] yo lo definн asн)

Код:
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(325) : error 017: undefined symbol "GetATMID"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(442) : error 017: undefined symbol "GetATMID"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(4495) : warning 203: symbol is never used: "ATMi"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(401) : warning 204: symbol is assigned a value that is never used: "ATMm"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(401 -- 4495) : warning 203: symbol is never used: "AddATM"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(401 -- 4495) : warning 203: symbol is never used: "ret_memcpy"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(401 -- 4495) : warning 203: symbol is never used: "strtok"
De aquн saquй el sistema:

pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <dini>
#include <dudb>
#include <zcmd>
#include <sscanf2>
#include <foreach>

#define MAX_ATM 100
#define ATM_FILE_NAME       "DATM.txt"
#define MAX_DISTANCE_TO_PROP 1.5
//colours
#define COLOR_YELLOW    0xD8D8D8FF
#define COLOR_FADE1     0xE6E6E6E6
#define COLOR_FADE2     0xC8C8C8C8
#define COLOR_FADE3     0xAAAAAAAA
#define COLOR_FADE4     0x8C8C8C8C
#define COLOR_FADE5     0x6E6E6E6E
#define COLOR_FADE      0xC8C8C8C8
#define COLOR_WHITE     0xFFFFFFAA
#define COLOR_GRAD2     0xBFC0C2FF
#define COLOR_DARKRED   0x8B0000AA
#define COLOR_RED       0xFF0000AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_GREY      0xAFAFAFAA
#define COLOR_PINK      0xDC00DDAA
#define COLOR_BLUE      0x0259EAAA
#define COLOR_GREEN     0x00A800AA
#define COLOR_ORANGE    0xFF8000AA
#define COLOR_CYAN      0xFF8080AA
#define COLOR_WHITE     0xFFFFFFAA
#define COLOR_DARKBLUE  0x0000A0AA
#define COLOR_BLACK     0x000000AA
#define COLOR_DARKGOLD  0x808000AA
#define COLOR_PURPLE    0xC2A2DAAA
#define COLOR_BROWN     0x804000AA
#define COLOR_BLACK2    0x000000ff
#define ATM_USER_FILE "ATMs/ATMUsers/%s.ini"
//atm system crap
new ATMObject[MAX_ATM];
new Text3D:ATMLabel[MAX_ATM];
new Object[MAX_PLAYERS];
new oModel[MAX_PLAYERS];
new ATMi,ATMm;

enum ATMInfo
{
    Float:ATMx,
    Float:ATMy,
    Float:ATMz,
    ATMInt,
    ATMvw,
    ATMMoney
}
new abInfo[MAX_ATM][ATMInfo];

enum pInfo
{
    pBank
}
new PlayerInfo[MAX_PLAYERS][pInfo];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    //bank enter
    ServerInfo();
    CreatePickup(1318, 1, 1465.2404,-1010.2532,26.8438, -1);
    Create3DTextLabel("/enter to enter the bank.", 0x008080FF, 1465.2404,-1010.2532,26.8438, 40.0, 0, 1);
    return 1;
}

public OnPlayerConnect(playerid)
{
    new name[MAX_PLAYER_NAME], sfile[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(sfile, sizeof(sfile), ATM_USER_FILE, name);
    dini_IntSet(sfile,"Bank",PlayerInfo[playerid][pBank]);
    if (!dini_Exists(sfile)) {
        dini_Create(sfile);
        dini_IntSet(sfile, "Bank",PlayerInfo[playerid][pBank] = 5000);
        PlayerInfo[playerid][pBank] = 5000;
    }
    if(fexist(sfile)) {
        PlayerInfo[playerid][pBank] = dini_Int(sfile, "Bank");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], sfile[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(sfile, sizeof(sfile), ATM_USER_FILE, name);
    dini_IntSet(sfile,"Bank",PlayerInfo[playerid][pBank]);
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

AddATM(ATMid, Float:ATMxx, Float:ATMyy, Float:ATMzz, Float:ATMrxx, Float:ATMryy, Float:ATMrzz, ATMMoneyy, ATMIntt, ATMvww)
{
    new ATM[256];
    format(ATM, sizeof(ATM), "ATMs/ATMid%d",ATMid);
    if(!dini_Exists(ATM))
    {
        dini_Create(ATM);
        abInfo[ATMid][ATMMoney] = ATMMoneyy;
        dini_IntSet(ATM, "Money", ATMMoneyy);
        abInfo[ATMid][ATMInt] = ATMIntt;
        dini_IntSet(ATM, "Interior", ATMIntt);
        dini_IntSet(ATM, "Virtualworld", ATMvww);
        abInfo[ATMid][ATMvw] = ATMvww;
        abInfo[ATMid][ATMx] = ATMxx;
        abInfo[ATMid][ATMy] = ATMyy;
        abInfo[ATMid][ATMz] = ATMzz;
        dini_FloatSet(ATM, "aX", ATMxx);
        dini_FloatSet(ATM, "aY", ATMyy);
        dini_FloatSet(ATM, "aZ", ATMzz);
        dini_FloatSet(ATM, "rX", ATMrxx);
        dini_FloatSet(ATM, "rY", ATMryy);
        dini_FloatSet(ATM, "rZ", ATMrzz);
        print("-");
        print("--------------ATM Created--------------");
    }
    else
    {
        abInfo[ATMid][ATMMoney] = dini_Int(ATM, "Money");
        abInfo[ATMid][ATMInt] = dini_Int(ATM, "Interior");
        abInfo[ATMid][ATMx] = dini_Float(ATM, "aX");
        abInfo[ATMid][ATMy] = dini_Float(ATM, "aY");
        abInfo[ATMid][ATMz] = dini_Float(ATM, "aZ");
        abInfo[ATMid][ATMvw] = dini_Int(ATM, "Virtualworld");
    }
    ATMObject[ATMid] = CreateObject(2942,ATMxx, ATMyy, ATMzz,ATMrxx,ATMryy,ATMrzz,0);//bought
    new string[256];
    format(string, sizeof(string), "ATM type /atmwithdraw and /atmbalance.\nMoney left $%d",abInfo[ATMid][ATMMoney]);
    ATMLabel[ATMid] = Create3DTextLabel(string, 0x008080FF, ATMxx,ATMyy,ATMzz, 10.0, 0, 1);
}

//commands
COMMAND:enter(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0,1465.2404,-1010.2532,26.8438))
    {
        SetPlayerPos(playerid, 2315.952880,-1.618174,26.742187);
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 1);
        SendClientMessage(playerid, COLOR_ORANGE, "Welcome to the bank, Go up to the desk and use /deposit, /withdraw and /balance.");
    }
    return 1;
}

COMMAND:exit(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0,2315.952880,-1.618174,26.742187))
    {
        SetPlayerPos(playerid, 1464.6573,-1012.9962,26.8438);
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 0);
    }
    return 1;
}

COMMAND:balance(playerid, params[])
{
    new i;
    i = GetATMID(playerid);
    if(IsPlayerInRangeOfPoint(playerid, 3.0,2316.5034,-10.0475,26.7422))
    {
        new string[256];
        format(string, sizeof(string), "There is %d in your bank account.", PlayerInfo[playerid][pBank]);
        SendClientMessage(playerid, COLOR_ORANGE, string);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 3.0,abInfo[i][ATMx],abInfo[i][ATMy],abInfo[i][ATMz]))
    {
        new string[256];
        format(string, sizeof(string), "There is %d in your bank account.", PlayerInfo[playerid][pBank]);
        SendClientMessage(playerid, COLOR_ORANGE, string);
        return 1;
    }
    else return SendClientMessage(playerid,COLOR_RED,"Not around the bank.");
}

COMMAND:deposit(playerid, params[])
{
    new amount;
    if(IsPlayerInRangeOfPoint(playerid, 3.0,2316.5034,-10.0475,26.7422))
    {
        if(!sscanf(params, "i", amount))
        {
            if(amount > 0 && amount < 100000000)
            {
                if(GetPlayerMoney(playerid) >= amount)
                {
                    PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank]+amount;
                    GivePlayerMoney(playerid,-amount);
                    return 1;
                }
                else return SendClientMessage(playerid,COLOR_RED,"You are not carrying this much money.");
            }
            else return SendClientMessage(playerid,COLOR_RED,"Invalid amount.");
        }
        else return SendClientMessage(playerid,COLOR_RED,"USAGE: /deposit [amount]");
    }
    else return SendClientMessage(playerid,COLOR_RED,"Not around the bank.");
}

COMMAND:withdraw(playerid, params[])
{
    new amount;
    if(IsPlayerInRangeOfPoint(playerid, 3.0,2316.5034,-10.0475,26.7422))
    {
        if(!sscanf(params, "i", amount))
        {
            if(amount > 0 && amount < 100000000)
            {
                if(PlayerInfo[playerid][pBank] >= amount)
                {
                    PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank]-amount;
                    GivePlayerMoney(playerid,amount);
                    return 1;
                }
                else return SendClientMessage(playerid,COLOR_RED,"You don't have this much in your account.");
            }
            else return SendClientMessage(playerid,COLOR_RED,"Invalid amount.");
        }
        else return SendClientMessage(playerid,COLOR_RED,"USAGE: /withdraw [amount]");
    }
    else return SendClientMessage(playerid,COLOR_RED,"Not around the bank.");
}

COMMAND:addatm(playerid, params[])
{
    new hCost;
    if(IsPlayerAdmin(playerid))
    {
        if(!sscanf(params, "i", hCost))
        {
            new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
            GetPlayerPos(playerid, OX, OY, OZ);
            oModel[playerid] = 2942;
            ATMm = hCost;
            ORX = 0.0;
            ORY = 0.0;
            ORZ = 0.0;
            Object[playerid] = CreateObject(2942, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
            SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
            EditObject(playerid, Object[playerid]);
            return 1;
        }
        else return SendClientMessage(playerid, COLOR_RED, "USAGE: /addatm [amount of money]");
    }
    else return SendClientMessage(playerid, COLOR_RED, "You do not have the rights to use this command.");
}

COMMAND:setatmcash(playerid, params[])
{
    new amount;
    new atid;
    new Biz[128];
    new string[256];
    if(IsPlayerAdmin(playerid))
    {
        if(!sscanf(params, "ii", atid, amount))
        {
            format(Biz, sizeof(Biz), "ATMs/ATMid%d",atid);
            abInfo[atid][ATMMoney] = amount;
            dini_IntSet(Biz, "Money", abInfo[atid][ATMMoney]);
            Delete3DTextLabel(ATMLabel[atid]);
            format(string, sizeof(string), "ATM type /atmwithdraw and /atmbalance.\nMoney left $%d",abInfo[atid][ATMMoney]);
            ATMLabel[atid] = Create3DTextLabel(string, 0x008080FF, abInfo[atid][ATMx],abInfo[atid][ATMy],abInfo[atid][ATMz], 10.0, 0, 1);
            return 1;
        }
        else return SendClientMessage(playerid,COLOR_RED,"USAGE: /setatmcash [atmid] [amount]");
    }
    else return SendClientMessage(playerid,COLOR_RED,"You can not use this command!");
}

COMMAND:getatmid(playerid, params[])
{
    new string[256];
    new i;
    i = GetATMID(playerid);
    if(IsPlayerAdmin(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0,abInfo[i][ATMx],abInfo[i][ATMy],abInfo[i][ATMz]))
        {
            format(string, sizeof(string), "ATM ID %d",i);
            SendClientMessage(playerid,COLOR_ORANGE,string);
            return 1;
        }
        else return SendClientMessage(playerid,COLOR_RED,"You are not around any cash machines.");
    }
    else return SendClientMessage(playerid,COLOR_RED,"You can not use this command!");
}
Reply
#2

En ese cуdigo falta la funciуn GetATMID
Reply
#3

pawn Код:
stock GetATMID(playerid)
{
    for(new i=0; i<MAX_ATM; i++)
    {
        if(PlayerToPoint(MAX_DISTANCE_TO_PROP, playerid, ATMInfo[i][ATMx],ATMInfo[i][ATMy],ATMInfo[i][ATMz]))
        {
            return i;
        }
    }
    return 1;
}
Reply
#4

Gracias por responder, ahora me salen estos errores:

pawn Код:
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(4494) : error 028: invalid subscript (not an array or too many subscripts): "ATMInfo"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(4494) : warning 215: expression has no effect
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(4494) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(4494) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(4494) : fatal error 107: too many error messages on one line
Reply
#5

Quote:
Originally Posted by asfawfas
Посмотреть сообщение
Gracias por responder, ahora me salen estos errores:

pawn Код:
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(4494) : error 028: invalid subscript (not an array or too many subscripts): "ATMInfo"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(4494) : warning 215: expression has no effect
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(4494) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(4494) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(4494) : fatal error 107: too many error messages on one line
pero pasa esa linea o parte del cуdigo (4494)
Reply
#6

El error estб en el code que me pasaste:

Код:
stock GetATMID(playerid)
{
	for(new i=0; i<MAX_ATM; i++)
	{
		if(PlayerToPoint(MAX_DISTANCE_TO_PROP, playerid, ATMInfo[i][ATMx],ATMInfo[i][ATMy],ATMInfo[i][ATMz]))
		{
			return i;
		}
	}
	return 1;
}
Esta es la linea del error:
Код:
if(PlayerToPoint(MAX_DISTANCE_TO_PROP, playerid, ATMInfo[i][ATMx],ATMInfo[i][ATMy],ATMInfo[i][ATMz]))
Reply
#7

Quote:
Originally Posted by asfawfas
Посмотреть сообщение
El error estб en el code que me pasaste:

Код:
stock GetATMID(playerid)
{
	for(new i=0; i<MAX_ATM; i++)
	{
		if(PlayerToPoint(MAX_DISTANCE_TO_PROP, playerid, ATMInfo[i][ATMx],ATMInfo[i][ATMy],ATMInfo[i][ATMz]))
		{
			return i;
		}
	}
	return 1;
}
Esta es la linea del error:
Код:
if(PlayerToPoint(MAX_DISTANCE_TO_PROP, playerid, ATMInfo[i][ATMx],ATMInfo[i][ATMy],ATMInfo[i][ATMz]))
їAcaso no es?: if(PlayerToPoint(MAX_DISTANCE_TO_PROP, playerid, abInfo[i][ATMx],abInfo[i][ATMy],abInfo[i][ATMz]))
Reply
#8

Al parecer era asн, pero ahora tengo estos warn's:

Код:
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(3052) : warning 203: symbol is never used: "ATMi"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(408) : warning 204: symbol is assigned a value that is never used: "ATMm"
C:\Documents and Settings\Nazareno\Escritorio\RP NUEVO\gamemodes\CH-RP.pwn(408 -- 3052) : warning 203: symbol is never used: "AddATM"
el CMD donde me da el error:
pawn Код:
zcmd(addatm, playerid, params[])
{
    new hCost;
    if(IsPlayerAdmin(playerid))
    {
        if(!sscanf(params, "i", hCost))
        {
            new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
            GetPlayerPos(playerid, OX, OY, OZ);
            oModel[playerid] = 2942;
            ATMm = hCost;
            ORX = 0.0;
            ORY = 0.0;
            ORZ = 0.0;
            Object[playerid] = CreateObject(2942, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
            SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
            EditObject(playerid, Object[playerid]);
            return 1;
        }
        else return SendClientMessage(playerid, COLOR_RED, "USAGE: /addatm [amount of money]");
    }
    else return SendClientMessage(playerid, COLOR_RED, "You do not have the rights to use this command.");
}
La lнnea del warning.

Код:
ATMm = hCost;
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)