SA-MP Forums Archive
/mechduty problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /mechduty problem (/showthread.php?tid=306157)



/mechduty problem - ChristofferHoffmann - 25.12.2011

Код:
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


Re: /mechduty problem - rinori - 25.12.2011

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;
}



Re: /mechduty problem - spedico - 25.12.2011

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

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


Re: /mechduty problem - ChristofferHoffmann - 25.12.2011

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


Re: /mechduty problem - ChristofferHoffmann - 25.12.2011

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


Re: /mechduty problem - ChristofferHoffmann - 25.12.2011

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?


Re: /mechduty problem - VanHalen9898 - 25.12.2011

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.


Re: /mechduty problem - ChristofferHoffmann - 25.12.2011

I don't understand what just happend... :P


Re: /mechduty problem - ChristofferHoffmann - 25.12.2011

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


Re: /mechduty problem - rinori - 25.12.2011

Are you using other command processors?