SA-MP Forums Archive
ERROR : warning 209: function "OnPlayerEnterDynamicCP" should return a value - 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: ERROR : warning 209: function "OnPlayerEnterDynamicCP" should return a value (/showthread.php?tid=583721)



ERROR : warning 209: function "OnPlayerEnterDynamicCP" should return a value - jamesmith12 - 30.07.2015

Help please?

ERROR : warning 209: function "OnPlayerEnterDynamicCP" should return a value

PHP код:
forward OnPlayerEnterDynamicCP(playeridcheckpointid);
public 
OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if(
checkpointid == CP[CAPZONE])
    {
        if(
UnderAttack[CAPZONE] == 0)
        {
            if(
tCP[CAPZONE] != gTeam[playerid])
            {
                
CountVar[playerid][CAPZONE] = 25;
                
ActiveCAPZONE(playerid);
            } else return 
SendClientMessage(playeridCOLOR_RED,"*This zone is already captured by your team!");
        } else return 
CaptureZoneMessage(playerid2);
    }




Re: ERROR : warning 209: function "OnPlayerEnterDynamicCP" should return a value - youssefehab500 - 30.07.2015

PHP код:
forward OnPlayerEnterDynamicCP(playeridcheckpointid);
public 
OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if(
checkpointid == CP[CAPZONE])
    {
        if(
UnderAttack[CAPZONE] == 0)
        {
            if(
tCP[CAPZONE] != gTeam[playerid])
            {
                
CountVar[playerid][CAPZONE] = 25;
                
ActiveCAPZONE(playerid);
            } else return 
SendClientMessage(playeridCOLOR_RED,"*This zone is already captured by your team!");
        } else return 
CaptureZoneMessage(playerid2);
    }
    return 
1;




Re: ERROR : warning 209: function "OnPlayerEnterDynamicCP" should return a value - Fancy - 30.07.2015

This will work:

Код:
forward OnPlayerEnterDynamicCP(playerid, checkpointid); 
public OnPlayerEnterDynamicCP(playerid, checkpointid) 
{ 
    if(checkpointid == CP[CAPZONE]) 
    { 
        if(UnderAttack[CAPZONE] == 0) 
        { 
            if(tCP[CAPZONE] != gTeam[playerid]) 
            { 
                CountVar[playerid][CAPZONE] = 25; 
                ActiveCAPZONE(playerid); 
            } else return SendClientMessage(playerid, COLOR_RED,"*This zone is already captured by your team!"); 
        } else return CaptureZoneMessage(playerid, 2); 
    }
    return 1;
}



Re: ERROR : warning 209: function "OnPlayerEnterDynamicCP" should return a value - jamesmith12 - 30.07.2015

Oh shit i forgot HAHAH XD thank you all! +1 REP
Quote:

return 1;




Re: ERROR : warning 209: function "OnPlayerEnterDynamicCP" should return a value - Hemeei - 30.07.2015

Yes bro and the error tells you

Quote:

"OnPlayerEnterDynamicCP" should "return" a value

hahaa