SA-MP Forums Archive
Mission System Weird Problem - 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: Mission System Weird Problem (/showthread.php?tid=481493)



Mission System Weird Problem - Excelize - 15.12.2013

Hey guys,

I was just working on my new mission system, but for some reason, Pawno doesnt appreciate this command:

Код:
CMD:work(playerid, params[])
{
    if( !IsPlayerInDynamicCP( playerid, job_cp ) ) return SendClientMessage(playerid, -1, "You are not in the checkpoint!"); 
    else
    {
           if( !isPlayerInMission[ playerid ] )
           {
               isPlayerInMission[ playerid ] = true; // he is now doing one
               Player_SetUpForMission( playerid ); // stock coming in later, ignore
           }
           else
                return SendClientMessage(playerid, -1, "You are already doing a mission.");
    }
   return 1;
}
The error that comes up is:

Код:
(578) : error 029: invalid expression, assumed zero



Re: Mission System Weird Problem - Danialdano - 15.12.2013

And the line is?


Re: Mission System Weird Problem - Excelize - 15.12.2013

Line?


Re: Mission System Weird Problem - Danialdano - 15.12.2013

Hold down ctrl and g at the same time and then it will come a number searching search for number 578 and copy that line and then put it here.


Re: Mission System Weird Problem - Excelize - 15.12.2013

Oh sorry, 578, but that is just the first line of the command:
Код:
CMD:work(playerid, params[])
So I'm guessing it's below that line..

Thanks


Re: Mission System Weird Problem - Danialdano - 15.12.2013

pawn Код:
CMD:work(playerid, params[])
{
    if(!IsPlayerInDynamicCP(playerid, job_cp)) return SendClientMessage(playerid, -1, "You are not in the checkpoint!");
    else
    {
           if( !isPlayerInMission[ playerid ] )
           {
               isPlayerInMission[ playerid ] = true; // he is now doing one
               Player_SetUpForMission( playerid ); // stock coming in later, ignore
           }
           else
                return SendClientMessage(playerid, -1, "You are already doing a mission.");
    }
    return 1;
}
try this


Re: Mission System Weird Problem - Excelize - 15.12.2013

Still comes up with that :/


AW: Re: Mission System Weird Problem - Nero_3D - 15.12.2013

Quote:
Originally Posted by Excelize
Посмотреть сообщение
Oh sorry, 578, but that is just the first line of the command:
Код:
CMD:work(playerid, params[])
So I'm guessing it's below that line..

Thanks
If the compiler displays a line the two possibilities are that it is the exact line or that it is above

Since this line if perfectly fine it is above this cmd

Maybe you just missed a semicolon ';'


Re: Mission System Weird Problem - Excelize - 15.12.2013

I don't see any missing semicolons, but maybe you can spot something?


This is the code extended a bit, with the start of OnPlayerText, and more commands after.
Код:
public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
//----------------
//**All Commands**
//----------------

//Mission Commands
CMD:work(playerid, params[])
{
    if(!IsPlayerInDynamicCP(playerid, job_cp)) return SendClientMessage(playerid, -1, "You are not in the checkpoint!");
    else
    {
           if( !isPlayerInMission[ playerid ] )
           {
               isPlayerInMission[ playerid ] = true; // he is now doing one
               Player_SetUpForMission( playerid ); // stock coming in later, ignore
           }
           else
                return SendClientMessage(playerid, -1, "You are already doing a mission.");
    }
    return 1;
}
//Player Commands

CMD:kill(playerid, params[])
{
	SendClientMessage(playerid, red, "*You have killed yourself!");
	SetPlayerHealth(playerid, 0);
	return 1;
}



Re: Mission System Weird Problem - Loot - 15.12.2013

Why is 'OnPlayerCommandText' not open and closed with a bracket, or you've forgotten to do add that?
pawn Код:
public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
     return 1;
}
//----------------
//**All Commands**
//----------------

//Mission Commands
CMD:work(playerid, params[])
{
    if(!IsPlayerInDynamicCP(playerid, job_cp)) return SendClientMessage(playerid, -1, "You are not in the checkpoint!");
    else
    {
           if( !isPlayerInMission[ playerid ] )
           {
               isPlayerInMission[ playerid ] = true; // he is now doing one
               Player_SetUpForMission( playerid ); // stock coming in later, ignore
           }
           else
                return SendClientMessage(playerid, -1, "You are already doing a mission.");
    }
    return 1;
}
//Player Commands

CMD:kill(playerid, params[])
{
    SendClientMessage(playerid, red, "*You have killed yourself!");
    SetPlayerHealth(playerid, 0);
    return 1;
}