IsPlayerInArea help
#1

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new	cmd[256];
if(strcmp(cmd, "/mycommand", true))
{
if(IsPlayerInArea(playerid, -70.06725, 1646.58, 432.0814, 2125.373))
{
GameTextForPlayer(playerid, "Entering Army Territory", 1, 1);
}
return 1;
}
return 0;
}


IsPlayerInArea(playerid, Float:data[4])
{
	new Float:X, Float:Y, Float:Z;
	GetPlayerPos(playerid, X, Y, Z);
	if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3]) {
		return 1;
	}
	return 0;
}
Код:
(81) : error 035: argument type mismatch (argument 2)
line 81
Код:
if(IsPlayerInArea(playerid, -70.06725, 1646.58, 432.0814, 2125.373))
Reply
#2

Change your IsPlayeRInArea function with this:

pawn Код:
IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    {
        DM[playerid] = 1;
        }
    return 0;
}
Reply
#3

Quote:
Originally Posted by $ЂЯĢ
Change your IsPlayeRInArea function with this:

pawn Код:
IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    {
        DM[playerid] = 1;
        }
    return 0;
}
C:\Users\richard\Desktop\samp 0.3 R3\gamemodes\NewProject.pwn(9 : error 017: undefined symbol "DM"
C:\Users\richard\Desktop\samp 0.3 R3\gamemodes\NewProject.pwn(9 : warning 215: expression has no effect
C:\Users\richard\Desktop\samp 0.3 R3\gamemodes\NewProject.pwn(9 : error 001: expected token: ";", but found "]"
C:\Users\richard\Desktop\samp 0.3 R3\gamemodes\NewProject.pwn(9 : error 029: invalid expression, assumed zero
C:\Users\richard\Desktop\samp 0.3 R3\gamemodes\NewProject.pwn(9 : fatal error 107: too many error messages on one line

Код:
98 = DM[playerid] = 1;
Reply
#4

Код:
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
Delete return 1; in that string.
Reply
#5

pawn Код:
IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    return 0;
}
Here you go.
Reply
#6

Thanks, but now i got another problem

Код:
Army = GangZoneCreate(-70.06725, 1646.58, 432.0814, 2125.373);
co-ords for Area 51 gang zone

Код:
new	cmd[256];
if(strcmp(cmd, "/mycommand", true))
{
if(IsPlayerInArea(playerid, -70.06725, 1646.58, 432.0814, 2125.373))
{
GameTextForPlayer(playerid, "Entering Army Territory", 1, 1);
}
return 1;
}
that message is meant to come up when i enter the zone, but it doesnt.. even if i type "/mycommand" it still doesnt come up
Reply
#7

or just change when you call to look like this.
pawn Код:
IsPlayerInArea(playerid, {-70.06725, 1646.58, 432.0814, 2125.373})
so here is your complete code

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
if(strcmp(cmd, "/mycommand", true))
{
if(IsPlayerInArea(playerid, {-70.06725, 1646.58, 432.0814, 2125.373}))
{
GameTextForPlayer(playerid, "Entering Army Territory", 1, 1);
}
return 1;
}
return 0;
}


IsPlayerInArea(playerid, Float:data[4])
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3]) {
        return 1;
    }
    return 0;
}
Reply
#8

Use this function:

pawn Код:
IsPlayerInArea(playerid, Float:minx, Float:miny, Float:maxx, Float:maxy)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    return 0;
}
And

pawn Код:
new cmd[256]; // You don't need it
if(strcmp(cmdtext, "/mycommand", true) == 0) // Few changes here
{
    if(IsPlayerInArea(playerid, -70.06725, 1646.58, 432.0814, 2125.373))
    {
        GameTextForPlayer(playerid, "Entering Army Territory", 1, 1);
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by MadeMan
Use this function:

pawn Код:
IsPlayerInArea(playerid, Float:minx, Float:miny, Float:maxx, Float:maxy)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    return 0;
}
And

pawn Код:
new cmd[256]; // You don't need it
if(strcmp(cmdtext, "/mycommand", true) == 0) // Few changes here
{
    if(IsPlayerInArea(playerid, -70.06725, 1646.58, 432.0814, 2125.373))
    {
        GameTextForPlayer(playerid, "Entering Army Territory", 1, 1);
    }
    return 1;
}
will it show automatically? i'll go test it now
Reply
#10

Quote:
Originally Posted by Ritchie999
will it show automatically? i'll go test it now
No, you have to type /mycommand.

And also https://sampwiki.blast.hk/wiki/GameTextForPlayer check the display time, 1 millisecond is VERY short time.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)