Simple command - help!
#1

Hi, I haven't touched pawn for.... a long time so I need help with a command I'm making. I want a /knock command to knock on a door, however I want to be able to do it in various places using the same command instead of /knock1, /knock2 etc. And if I'm not at the door it should say "[Error]: You need to be at the right door to knock".
Reply
#2

You could do something similar to this

pawn Код:
CMD:knock(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
    {
   
    }
    else if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
    {
   
    } else return SendClientMessage(playerid, -1, "[Error]: You need to be at the right door to knock"");
    return 1;
}
Reply
#3

Thanks.
Reply
#4

pawn Код:
CMD:knock(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 1852.2755,-1990.1522,13.5469))
    {
        SendClientMessage(playerid, -1, "Yo.");
    }
    else if(IsPlayerInRangeOfPoint(playerid, 5.0, 2637.0984,-1991.6788,14.3240))
    {
        SendClientMessage(playerid, -1, "Yo.");
    }
    else SendClientMessage(playerid, COLOR_RED, "[Error]: You need to be at the right door to knock");
    return 1;
}
Reply
#5

If you're reading them from a database it would be better to run a loop on an array of co-ordinates.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)