Creating a locker instead of /lspd & /fbi
#1

I've been trying to create a locker so that both LSPD and FBI can use eachothers. My current code is;

Код:
CMD:locker(playerid, params[])
{
	if(PlayerInfo[playerid][pFaction] == 1 || PlayerInfo[playerid][pLeader] == 1)
	{
		if(IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263, 1003.640625 || IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338 && 3.5,255.385696, 77.201263)))
		{
			ShowPlayerDialogEx(playerid, DUTYMENU, DIALOG_STYLE_LIST, "LSPD Menu","Duty\nEquipment\nTactical\nUniform\nUndercover\nClear Suspect", "Select", "Cancel");
		}
		else
		{
			SendClientMessage(playerid, COLOR_WHITE, "You're not in range of your lockers.");
		}
	}
	if(PlayerInfo[playerid][pFaction] == 2 || PlayerInfo[playerid][pLeader] == 2)
	{
		if(IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338 && 3.5,255.385696, 77.201263 || IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263, 1003.640625)))
		{
			ShowPlayerDialogEx(playerid, FDUTYMENU, DIALOG_STYLE_LIST, "FBI Menu","Duty\nEquipment\nSWAT Uniform\nUniform\nUndercover\nClear Suspect", "Select", "Cancel");
		}
		else
		{
			SendClientMessage(playerid, COLOR_WHITE, "You're not in range of your lockers.");
		}
	}
	return 1;
}
I'm getting these warnings though;

Код:
C:\Users\cyro\Desktop\rp\gamemodes\rp.pwn(24020) : warning 213: tag mismatch
C:\Users\cyro\Desktop\rp\gamemodes\rp.pwn(24020) : warning 202: number of arguments does not match definition
C:\Users\cyro\Desktop\rp\gamemodes\rp.pwn(24020) : warning 202: number of arguments does not match definition
C:\Users\cyro\Desktop\rp\gamemodes\rp.pwn(24020) : warning 213: tag mismatch
It also just tells me in game that I'm not in range of my lockers. Help
Reply
#2

You're problem are here:

Quote:

if(IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263, 1003.640625 || IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338 && 3.5,255.385696, 77.201263)))

Reply
#3

How would I fix it?
Reply
#4

I've trying with your code... but look :

pawn Код:
if( // line 5
    IsPlayerInRangeOfPoint(playerid, 3.5, 255.385696, 77.201263, 1003.640625) ||
    (
        IsPlayerInRangeOfPoint(playerid, 3.5, 310.3679, -1537.5204, -45.1338) &&
        IsPlayerInRangeOfPoint(playerid, 3.5, 310.3679, -1537.5204, -45.1338) // they're same
    )
)
{

}
// But what is it ? 3.5 radius? and where is posZ?
3.5,255.385696, 77.201263
Reply
#5

I've managed to only knock it down to two warnings;

Код:
C:\Users\Cyro\Desktop\rp\gamemodes\rp.pwn(24020) : warning 213: tag mismatch
C:\Users\Cyro\Desktop\rp\gamemodes\rp.pwn(24031) : warning 213: tag mismatch
I don't know how I'd get rid of these though. Do you?

Edit:
Код:
CMD:locker(playerid, params[])
{
	if(PlayerInfo[playerid][pFaction] == 1 || PlayerInfo[playerid][pLeader] == 1)
	{
		if(IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263, 1003.640625 || IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338 )))
		{
			ShowPlayerDialogEx(playerid, DUTYMENU, DIALOG_STYLE_LIST, "LSPD Menu","Duty\nEquipment\nTactical\nUniform\nUndercover\nClear Suspect", "Select", "Cancel");
		}
		else
		{
			SendClientMessage(playerid, COLOR_WHITE, "You're not in range of your lockers.");
		}
	}
	if(PlayerInfo[playerid][pFaction] == 2 || PlayerInfo[playerid][pLeader] == 2)
	{
		if(IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338 || IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263, 1003.640625)))
		{
			ShowPlayerDialogEx(playerid, FDUTYMENU, DIALOG_STYLE_LIST, "FBI Menu","Duty\nEquipment\nSWAT Uniform\nUniform\nUndercover\nClear Suspect", "Select", "Cancel");
		}
		else
		{
			SendClientMessage(playerid, COLOR_WHITE, "You're not in range of your lockers.");
		}
	}
	return 1;
}
Reply
#6

Looked a bit through your code, and added some comments in your code.
Maybe it helps, I did my best to help you.

pawn Код:
CMD:locker(playerid, params[])
{
    if(PlayerInfo[playerid][pFaction] == 1 || PlayerInfo[playerid][pLeader] == 1)
    {
        if(IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263, 1003.640625 || IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338 && 3.5,255.385696, 77.201263)))
        // line above just won't work, some parameters are missing and it's a misuse of the function
        {
            ShowPlayerDialogEx(playerid, DUTYMENU, DIALOG_STYLE_LIST, "LSPD Menu","Duty\nEquipment\nTactical\nUniform\nUndercover\nClear Suspect", "Select", "Cancel");
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "You're not in range of your lockers.");
        }
    }
    if(PlayerInfo[playerid][pFaction] == 2 || PlayerInfo[playerid][pLeader] == 2)
    {
        if(IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338 && 3.5,255.385696, 77.201263 || IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263, 1003.640625)))
        // again, line above won't work.
        {
            ShowPlayerDialogEx(playerid, FDUTYMENU, DIALOG_STYLE_LIST, "FBI Menu","Duty\nEquipment\nSWAT Uniform\nUniform\nUndercover\nClear Suspect", "Select", "Cancel");
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "You're not in range of your lockers.");
        }
    }
    return 1;
}

// when you use the if function, you can only use one native. For example:
// IsPlayerInRangeOfPoint(playerid, range, X, Y, Z) || IsPlayerInrangeOfPoint(playerid, range, X, Y, Z)
// So close the native before you want to use the "or" function or "equals" function.

// Also, the latest parameter in IsPlayerInRangeOfPoint is missing. You're missing a Z-coord.

CMD:locker(playerid, params[])
{
    if(PlayerInfo[playerid][pFaction] == 1 || PlayerInfo[playerid][pLeader] == 1)
    {
        if(IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263, 1003.640625) || IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338) || IsPlayerInRangeOfPoint(playerid, 3.5,255.385696, 77.201263, /*Z-coord missing*/))
        {
            ShowPlayerDialogEx(playerid, DUTYMENU, DIALOG_STYLE_LIST, "LSPD Menu","Duty\nEquipment\nTactical\nUniform\nUndercover\nClear Suspect", "Select", "Cancel");
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "You're not in range of your lockers.");
        }
    }
    if(PlayerInfo[playerid][pFaction] == 2 || PlayerInfo[playerid][pLeader] == 2)
    {
        if(IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338) || IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263,/* Z-coord missing*/) || IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263, 1003.640625))
        {
            ShowPlayerDialogEx(playerid, FDUTYMENU, DIALOG_STYLE_LIST, "FBI Menu","Duty\nEquipment\nSWAT Uniform\nUniform\nUndercover\nClear Suspect", "Select", "Cancel");
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "You're not in range of your lockers.");
        }
    }
    return 1;
}
Reply
#7

pawn Код:
CMD:locker(playerid, params[])
{
    if(PlayerInfo[playerid][pFaction] == 1 || PlayerInfo[playerid][pLeader] == 1)
    {
        if(IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263, 1003.640625 || IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338 )))
        {
            ShowPlayerDialogEx(playerid, DUTYMENU, DIALOG_STYLE_LIST, "LSPD Menu","Duty\nEquipment\nTactical\nUniform\nUndercover\nClear Suspect", "Select", "Cancel");
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "You're not in range of your lockers.");
        }
    }
    if(PlayerInfo[playerid][pFaction] == 2 || PlayerInfo[playerid][pLeader] == 2)
    {
        if(IsPlayerInRangeOfPoint(playerid,3.5,255.385696, 77.201263, 1003.640625 || IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338 )))
        {
            ShowPlayerDialogEx(playerid, FDUTYMENU, DIALOG_STYLE_LIST, "FBI Menu","Duty\nEquipment\nSWAT Uniform\nUniform\nUndercover\nClear Suspect", "Select", "Cancel");
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "You're not in range of your lockers.");
        }
    }
    return 1;
}
Updated the Z-Coord. Is there anyway to make it work? Or would it just be easier to stick to /lspd and /fbi and have their own seperate lockers. I'm stumped.
Reply
#8

pawn Код:
if(IsPlayerInRangeOfPoint(playerid,3.5, 255.385696, 77.201263, 1003.640625) || IsPlayerInRangeOfPoint(playerid,3,310.3679,-1537.5204,-45.1338 ))
{

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)