Really quick answer needed, easy thing but I just don't get it
#1

So i'm trying to get something called "auto-crack" working on a blank script ("falling down" when player's HP is under x amount).

And this is the only error I get. I already got fixed a similar error before with a friend's advices, but this one won't just fix up with that way. >.<
pawn Код:
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(75) : error 028: invalid subscript (not an array or too many subscripts): "GetTickCount"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
And here's the code that is bugging out:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/getup", cmdtext, true, 6) == 0)
    {
    if ((GetTickCount() - g_tCrackTick[playerid] > 15000) //This is 74th line
    {
    ApplyAnimation(playerid,"PED","getup_front",5.0,0,1,1,1,1,1);
    TogglePlayerControllable(playerid, false);
    }
    else
    {
        SendClientMessage(playerid, 0xFFFFFF, " Error: You're not auto-cracked or you cannot get up yet! ");
    }
    return 1;
}
Nothing hard but I just don't get it. Of course when it's easy thing it never comes up in your mind, same thing with lost keys!
Reply
#2

Why in earth name are you using GetTickCount?
Reply
#3

Because tick count method is slightly more accurate and efficient, also it's just a blank small gamemode...
Reply
#4

Quote:
Originally Posted by milanosie
Посмотреть сообщение
Why in earth name are you using GetTickCount?
Why not..?

You have a missing bracket on that line. Change it to

pawn Код:
if ((GetTickCount() - g_tCrackTick[playerid]) > 15000) //This is 74th line
Reply
#5

Add a ")" at the end of line 74.
Reply
#6

Quote:
Originally Posted by MP2
Посмотреть сообщение
Why not..?

You have a missing bracket on that line. Change it to

pawn Код:
if ((GetTickCount() - g_tCrackTick[playerid]) > 15000) //This is 74th line
Gets even worst o.o
pawn Код:
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(86) : warning 217: loose indentation
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(86) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(86) : error 004: function "OnPlayerEnterVehicle" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(91) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(91) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(91) : error 004: function "OnPlayerExitVehicle" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(96) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(96) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(96) : error 004: function "OnPlayerStateChange" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(101) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(101) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(101) : error 004: function "OnPlayerEnterCheckpoint" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(106) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(106) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(106) : error 004: function "OnPlayerLeaveCheckpoint" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(111) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(111) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(111) : error 004: function "OnPlayerEnterRaceCheckpoint" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(116) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(116) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(116) : error 004: function "OnPlayerLeaveRaceCheckpoint" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(121) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(121) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(121) : error 004: function "OnRconCommand" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(126) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(126) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(126) : error 004: function "OnPlayerRequestSpawn" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(131) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(131) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(131) : error 004: function "OnObjectMoved" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(136) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(136) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(136) : error 004: function "OnPlayerObjectMoved" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(141) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(141) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(141) : error 004: function "OnPlayerPickUpPickup" is not implemented
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(146) : warning 225: unreachable code
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(146) : error 029: invalid expression, assumed zero
C:\Users\Joni\Desktop\SA-MP Server\gamemodes\fortesting.pwn(146) : error 004: function "OnVehicleMod" is not implemented

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


26 Errors.
Quote:
Originally Posted by DaRealShazz
Посмотреть сообщение
Add a ")" at the end of line 74.
That says the same classic 26 errors.
Reply
#7

pawn Код:
new tick = GetTickCount() - g_tCrackTick[playerid];

if ( tick > 15000 )
//..................
Reply
#8

Quote:
Originally Posted by Marricio
Посмотреть сообщение
pawn Код:
new tick = GetTickCount() - g_tCrackTick[playerid];

if ( tick > 15000 )
//..................
It's already defined. I think..

Here's the full code:
pawn Код:
#include <a_samp>


new
    g_tCrackTick[MAX_PLAYERS],
    g_bCrackState[MAX_PLAYERS];


 #undef MAX_PLAYERS
 #define MAX_PLAYERS 15


 forward AutoCrack(playerid);

public OnGameModeInit()
{
    SetGameModeText("Blank Script");
    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)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    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("/getup", cmdtext, true, 6) == 0)
    {
    if ((GetTickCount() - g_tCrackTick[playerid] > 15000)
    {
    ApplyAnimation(playerid,"PED","getup_front",5.0,0,1,1,1,1,1);
    TogglePlayerControllable(playerid, false);
    }
    else
    {
        SendClientMessage(playerid, 0xFFFFFF, " Error: You're not auto-cracked or you cannot get up yet! ");
    }
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

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

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

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

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

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

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

public AutoCrack(playerid)
{
    new
        Float:health;

    GetPlayerHealth(playerid, health);

    if(health <= 20.0 && !g_bCrackState[playerid])
    {
        ApplyAnimation(playerid,"PED","KO_spin_L",3.0,0,1,1,1,1,1);
        g_bCrackState[playerid] = 1;
        g_tCrackTick[playerid] = GetTickCount();
    }
    return 1;
}
Reply
#9

I don't see it defined, try compiling it.
Reply
#10

Quote:
Originally Posted by Microsoft Windows
Pawn Compiler has stopped working

Windows is checking for solutions...

***LINE HERE***

**BOX**Cancel**BOX**
That's what it tells me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)