Mission System Weird Problem
#1

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
Reply
#2

And the line is?
Reply
#3

Line?
Reply
#4

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.
Reply
#5

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
Reply
#6

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
Reply
#7

Still comes up with that :/
Reply
#8

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 ';'
Reply
#9

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;
}
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)