SA-MP Forums Archive
[HELP] Compile errors! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Compile errors! (/showthread.php?tid=338393)



[HELP] Compile errors! - NewerthRoleplay - 29.04.2012

Errors:
pawn Код:
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(318) : error 029: invalid expression, assumed zero
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(318) : warning 215: expression has no effect
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(318) : error 001: expected token: ";", but found ")"
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(318) : error 029: invalid expression, assumed zero
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(318) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 * * Copyright (c) 1997-2006, ITB CompuPhase
Here are the lines 314 - 339:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInfo[killerid][pKills]++;
    PlayerInfo[playerid][pDeaths]++;
    if(pInsurance == 1(playerid))
    {
        SendClientMessage(playerid, COLOR_GREEN. "** You have been sent to All Saints Hospital **");
        SetPlayerPos(playerid, 1172.8149, -1325.5315, 15.4003);
        SetPlayerHealth(playerid, 100);
        GivePlayerMoney(playerid, -1000);
    }
    if(pInsurance == 2(playerid))
    {
        SendClientMessage(playerid, COLOR_GREEN. "** You have been sent to General Hospital **");
        SetPlayerPos(playerid, 2030.3564, -1408.9563, 16.9989);
        SetPlayerHealth(playerid, 100);
        GivePlayerMoney(playerid, -1000);
    }
      SendClientMessage(playerid, COLOR_GREEN. "** You have been sent to a hospital **");
      SendClientMessage(playerid, COLOR_GREEN. "** Next time buy insurance! **");
      SetPlayerPos(playerid, 2030.3564, -1408.9563, 16.9989);
      SetPlayerHealth(playerid, 100);
      GivePlayerMoney(playerid, -2500);
    return 1;
}



Re: [HELP] Compile errors! - ViniBorn - 29.04.2012

pawn Код:
if(pInsurance == 1(playerid))

if(pInsurance == 2(playerid))
It's incorrect

Wouldn't be this?
pawn Код:
if(pInsurance[playerid] == 1)

if(pInsurance[playerid] == 2)



Re: [HELP] Compile errors! - Littlehelper - 29.04.2012

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInfo[killerid][pKills]++;
    PlayerInfo[playerid][pDeaths]++;
    if(pInsurance[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_GREEN. "** You have been sent to All Saints Hospital **");
        SetPlayerPos(playerid, 1172.8149, -1325.5315, 15.4003);
        SetPlayerHealth(playerid, 100);
        GivePlayerMoney(playerid, -1000);
    }
    if(pInsurance[playerid] == 2)
    {
        SendClientMessage(playerid, COLOR_GREEN. "** You have been sent to General Hospital **");
        SetPlayerPos(playerid, 2030.3564, -1408.9563, 16.9989);
        SetPlayerHealth(playerid, 100);
        GivePlayerMoney(playerid, -1000);
    }
      SendClientMessage(playerid, COLOR_GREEN. "** You have been sent to a hospital **");
      SendClientMessage(playerid, COLOR_GREEN. "** Next time buy insurance! **");
      SetPlayerPos(playerid, 2030.3564, -1408.9563, 16.9989);
      SetPlayerHealth(playerid, 100);
      GivePlayerMoney(playerid, -2500);
    return 1;
}



Re: [HELP] Compile errors! - MP2 - 29.04.2012

You should also check whether killerid == INVALID_PLAYER_ID before doing

PlayerInfo[killerid][pKills]++;

because if it's INVALID_PLAYER_ID the code after that won't be processed as it will crash, because you're trying to access an index out of bounds.


Re: [HELP] Compile errors! - NewerthRoleplay - 29.04.2012

(face palm) , Thanks guys


Re: [HELP] Compile errors! - NewerthRoleplay - 29.04.2012

pawn Код:
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(318) : error 028: invalid subscript (not an array or too many subscripts): "pInsurance"
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(318) : warning 215: expression has no effect
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(318) : error 001: expected token: ";", but found "]"
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(318) : error 029: invalid expression, assumed zero
C:\Users\Rob\Documents\PAWNO\gamemodes\NRP.pwn(318) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 * * Copyright (c) 1997-2006, ITB CompuPhase
Some lovely new errors! :P


Re: [HELP] Compile errors! - ViniBorn - 29.04.2012

Show the lines


Re: [HELP] Compile errors! - NewerthRoleplay - 29.04.2012

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Show the lines
Its the exact same as the ones on the first post :P


Re: [HELP] Compile errors! - NewerthRoleplay - 29.04.2012

bump


Re: [HELP] Compile errors! - Admigo - 29.04.2012

Change The defined pInsurance(playerid) to
Код:
new pInsurance[MAX_PLAYERS] =0;
At Top of u script,
Or send us u defined pInsurance(playerid)

PS:Thanks for the 1000 post