Help with cmd
#1

I need so if player is not in turf send the message you are not in a turf.

pawn Код:
COMMAND:turf(playerid)
{
    for(new i = 0; i < MAX_TURFS; i++){
    if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY])){
    SendClientMessage(playerid, 0xE0FF97FF, "You are in a turf.");}}
    return 1;
}
Reply
#2

pawn Код:
COMMAND:turf(playerid)
{
    for(new i = 0; i < MAX_TURFS; i++){
    if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY])){
    SendClientMessage(playerid, 0xE0FF97FF, "You are in a turf.");
    }else{
    SendClientMessage(playerid, 0xE0FF97FF, "you are not in a turf.");}}
    return 1;
}
some like this?
Reply
#3

Quote:
Originally Posted by [ISS]jumbo
Посмотреть сообщение
pawn Код:
COMMAND:turf(playerid)
{
    for(new i = 0; i < MAX_TURFS; i++){
    if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY])){
    SendClientMessage(playerid, 0xE0FF97FF, "You are in a turf.");
    }else{
    SendClientMessage(playerid, 0xE0FF97FF, "you are not in a turf.");}}
    return 1;
}
some like this?
This sends me 2 times the message (you are not in a turf.)
Reply
#4

You have try some like this?

pawn Код:
COMMAND:turf(playerid)
{
    for(new i = 0; i < MAX_TURFS; i++)
    {
        if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY]))
        {
            SendClientMessage(playerid, 0xE0FF97FF, "You are in a turf.");
        }
        if(!IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY]))
        {
            SendClientMessage(playerid, 0xE0FF97FF, "you are not in a turf.");
        }
    }
    return 1;
}
and try put else if ... if not work
Reply
#5

Quote:
Originally Posted by [ISS]jumbo
Посмотреть сообщение
You have try some like this?

pawn Код:
COMMAND:turf(playerid)
{
    for(new i = 0; i < MAX_TURFS; i++)
    {
        if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY]))
        {
            SendClientMessage(playerid, 0xE0FF97FF, "You are in a turf.");
        }
        if(!IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY]))
        {
            SendClientMessage(playerid, 0xE0FF97FF, "you are not in a turf.");
        }
    }
    return 1;
}
and try put else if ... if not work
same...
Reply
#6

you seek this?
pawn Код:
COMMAND:turf(playerid)
{
    new bool:inturf=false;
    for(new i = 0; i < MAX_TURFS; i++)
     {
        if(IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY])) {
        inturf = true; break; }
     }
    if(inturf == true) SendClientMessage(playerid, 0xE0FF97FF, "you are in a turf.");
    else SendClientMessage(playerid, 0xE0FF97FF, "you are not in a turf.");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)