/mechduty problem
#1

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/mechduty", true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438))
        SetPlayerSkin(playerid, 50);
        SendClientMessage(playerid,0xFFFFFFFF,"You are now on duty as a Mechanic");
        return 1;
    }
    return 1;
}
I'm trying to get this code, to react when player is in the range of the given point. Even though, I'm sure how Im going to make it do it, since that code makes you able to do it everywhere. Can somebody try to fix the code, and maybe, tell me what you've done. I'm trying to learn as much as possible, and sometimes I just get stuck in these things.

Cheers
Christoffer
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/mechduty", true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438))
        {
            SetPlayerSkin(playerid, 50);
            SendClientMessage(playerid,0xFFFFFFFF,"You are now on duty as a Mechanic");
        }
        else
        {
            SendClientMessage(playerid, 0xFFFFFFF, "You are not a mechanic duty position");
        }
        return 1;
    }
    return 1;
}
Reply
#3

I'd suggest you to use ZCMD, it's faster and easier to use.

https://sampforum.blast.hk/showthread.php?tid=91354
Reply
#4

Quote:
Originally Posted by spedico
Посмотреть сообщение
I'd suggest you to use ZCMD, it's faster and easier to use.

https://sampforum.blast.hk/showthread.php?tid=91354
Thanks for the tip
Reply
#5

Quote:
Originally Posted by rinori
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/mechduty", true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438))
        {
            SetPlayerSkin(playerid, 50);
            SendClientMessage(playerid,0xFFFFFFFF,"You are now on duty as a Mechanic");
        }
        else
        {
            SendClientMessage(playerid, 0xFFFFFFF, "You are not a mechanic duty position");
        }
        return 1;
    }
    return 1;
}
I suppose it was quite important to use the bracket located under "if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.843)"

Thanks man
Reply
#6

Uhm, there is a bug. Whenever I place this in filterscripts or in my main script, it blocks all other commands. I can't use anything else than /mechduty lol :P Is it something with the return thingy?
Reply
#7

try putting it in the same filter script with the other job commands. thats what i did and it worked perfectly, and make sure you have the commands defined correctly as well.
Reply
#8

I don't understand what just happend... :P
Reply
#9

Keeps telling me that everything below the place I paste my code is unreachable?
Reply
#10

Are you using other command processors?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)