[Help]Console error
#1

hey all,
I'm getting this message on the server console
Код:
script[gamemodes/cod.amx]: runtime error 20: "invalid index parameter <bad entry point>"
this is the script. DO NOT STEAL
pawn Код:
#include <a_samp>
#include <a_players>

forward CheckKillstreak(killerid);

public OnGameModeInit()
{
    SetGameModeText("COD");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPVarInt(playerid, "killstreak", 0);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid == INVALID_PLAYER_ID)
        {
        SetPVarInt(playerid, "killstreak", 0);
        }
        else
        {
        SetPVarInt(killerid ,"killstreak", GetPVarInt(killerid, "var") + 1);
        CheckKillstreak(killerid);
        }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public CheckKillstreak(killerid)
{
    if(GetPVarInt(killerid, "killstreak") == 3)
    {
            SendClientMessage(killerid, 0x00ff0000,"You can now use Emergency Airdrop, press 8 on your keypad");
            SetPVarInt(killerid, "EAdrop", 1);
    }
    return 1;
}
do you see any problems? i never had such errors
Reply
#2

pawn Код:
#include <a_samp>
#include <a_players>

forward CheckKillstreak(killerid);

public OnGameModeInit()
{
    SetGameModeText("COD");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPVarInt(playerid, "killstreak", 0);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid == INVALID_PLAYER_ID)
        {
        SetPVarInt(playerid, "killstreak", 0);
        }
        else
        {
        SetPVarInt(killerid ,"killstreak", GetPVarInt(killerid, "var") + 1); //var should be  killstreak, there is the error
        CheckKillstreak(killerid);
        }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public CheckKillstreak(killerid)
{
    if(GetPVarInt(killerid, "killstreak") == 3)
    {
            SendClientMessage(killerid, 0x00ff0000,"You can now use Emergency Airdrop, press 8 on your keypad");
            SetPVarInt(killerid, "EAdrop", 1);
    }
    return 1;
}
Reply
#3

1.what have u changed?
2. its not working

sorry for quicktext
Reply
#4

He made a comment in your code where an issue is, here:

pawn Код:
SetPVarInt(killerid ,"killstreak", GetPVarInt(killerid, "var") + 1); //var should be  killstreak, there is the error
It should be

pawn Код:
SetPVarInt(killerid ,"killstreak", GetPVarInt(killerid, "killstreak") + 1);
Although the problem is caused by the fact your script does not contain main()

pawn Код:
main()
{

}
Reply
#5

thanx,

i deleted main cause i didn't used it and the variable var was not to steal my idea on my first problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)