Correct Command Codes not working? +REP
#1

Ok here are the commands ive created :
Код:
if (strcmp("/closetank88", cmdtext, true, 10) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, 2, 658.70001220703, -1506, 23.5))
		{
		    SendClientMessage(playerid, 0x10F441AA, "Tank Closed!");
		    Create3DTextLabel("Tank Closed!", 0x10F441AA, 658.70001220703, -1506, 22, 40.0, 0, 1);
		}
		else
		{
		    SendClientMessage(playerid, 0xAFAFAFAA, "Get Closer to the Tank!");
		    return 1;
		}
		return 1;
	}
	if (strcmp("/closetank47", cmdtext, true, 10) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, 2, 652.20001220703, -1506.3000488281, 23.5))
		{
		    SendClientMessage(playerid, 0x10F441AA, "Tank Closed!");
		    Create3DTextLabel("Tank Closed!", 0x10F441AA, 658.70001220703, -1507.5999755859, 22, 40.0, 0, 1);
		}
		else
		{
		    SendClientMessage(playerid, 0xAFAFAFAA, "Get Closer to the Tank!");
		    return 1;
		}
		return 1;
	}
	if (strcmp("/closetank7", cmdtext, true, 10) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, 2, 653.40002441406, -1509.5999755859, 23.5))
		{
		    SendClientMessage(playerid, 0x10F441AA, "Tank Closed!");
		    Create3DTextLabel("Tank Closed!", 0x10F441AA, 658.70001220703, -1507.5999755859, 22, 40.0, 0, 1);
		}
		else
		{
		    SendClientMessage(playerid, 0xAFAFAFAA, "Get Closer to the Tank!");
		    return 1;
		}
		return 1;
	}
The problem is that the first command works fine, as for the others they do not.

The commands are supposed to be activated at a certain position.
/closetank88 works, But the other commands only work if they are in the spot of the /closetank88 command.
Why wont the other commands work at their desired position?
Reply
#2

You have to make the 10 in all the commands greater. You are only checking if the first 10 chars are the same, Which applies to all the commands.

Why aren't u using Y_CMD BTW?
Reply
#3

pawn Код:
if (strcmp("/closetank88", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, 658.70001220703, -1506, 23.5))
        {
            SendClientMessage(playerid, 0x10F441AA, "Tank Closed!");
            Create3DTextLabel("Tank Closed!", 0x10F441AA, 658.70001220703, -1506, 22, 40.0, 0, 1);
        }
        else
        {
            SendClientMessage(playerid, 0xAFAFAFAA, "Get Closer to the Tank!");
        }
        return 1;
    }
    if (strcmp("/closetank47", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, 652.20001220703, -1506.3000488281, 23.5))
        {
            SendClientMessage(playerid, 0x10F441AA, "Tank Closed!");
            Create3DTextLabel("Tank Closed!", 0x10F441AA, 658.70001220703, -1507.5999755859, 22, 40.0, 0, 1);
        }
        else
        {
            SendClientMessage(playerid, 0xAFAFAFAA, "Get Closer to the Tank!");
        }
        return 1;
    }
    if (strcmp("/closetank7", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, 653.40002441406, -1509.5999755859, 23.5))
        {
            SendClientMessage(playerid, 0x10F441AA, "Tank Closed!");
            Create3DTextLabel("Tank Closed!", 0x10F441AA, 658.70001220703, -1507.5999755859, 22, 40.0, 0, 1);
        }
        else
        {
            SendClientMessage(playerid, 0xAFAFAFAA, "Get Closer to the Tank!");
        }
        return 1;
    }
Reply
#4

try it
Reply
#5

@Devilx97 Could you tell me what you changed about it? I dont see anything different
Reply
#6

this is your . .
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 2, 658.70001220703, -1506, 23.5))
        {
            SendClientMessage(playerid, 0x10F441AA, "Tank Closed!");
            Create3DTextLabel("Tank Closed!", 0x10F441AA, 658.70001220703, -1506, 22, 40.0, 0, 1);
        }
        else
        {
            SendClientMessage(playerid, 0xAFAFAFAA, "Get Closer to the Tank!");
            return 1;
        }
this is mine . .
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 2, 658.70001220703, -1506, 23.5))
        {
            SendClientMessage(playerid, 0x10F441AA, "Tank Closed!");
            Create3DTextLabel("Tank Closed!", 0x10F441AA, 658.70001220703, -1506, 22, 40.0, 0, 1);
        }
        else
        {
            SendClientMessage(playerid, 0xAFAFAFAA, "Get Closer to the Tank!");
        }
see what's the different's ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)