SA-MP Forums Archive
Correct usage? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Correct usage? (/showthread.php?tid=166927)



Correct usage? - Luis- - 10.08.2010

Is this the correct usage for a /duty command for the LSPD?

pawn Код:
dcmd_duty(playerid, params[])
{
    #pragma unused params
    if(PlayerToPoint(5.0, playerid, 302.292877,-143.139099,1004.062500))
    SetPlayerArmedWeapon(playerid, 334);
    SetPlayerAmmo(playerid, 1, 0);
    GivePlayerWeapon(playerid, 334, 0);
    SetPlayerArmour(playerid, 1000);
    SetPlayerHealth(playerid, 1000);
    SetPlayerColor(playerid, COLOR_BLUE);
    SendClientMessage(playerid, COLOR_RED, "Succesfuly equipped");
    return 1;
}



Re: Correct usage? - [HUN]Jaki - 10.08.2010

Did you try to compile it? I don't think so.
I don't know how dcmd works, but if(PlayerToPoint(5.0, playerid, 302.292877,-143.139099,1004.062500)) does not look good.

It should be: if(!PlayerToPoint(5.0, playerid, 302.292877,-143.139099,1004.062500)) return 1;


Re: Correct usage? - Luis- - 10.08.2010

Quote:
Originally Posted by [HUN]Jaki
Посмотреть сообщение
Did you try to compile it? I don't think so.
I don't know how dcmd works, but if(PlayerToPoint(5.0, playerid, 302.292877,-143.139099,1004.062500)) does not look good.

It should be: if(!PlayerToPoint(5.0, playerid, 302.292877,-143.139099,1004.062500)) return 1;
I compiled it and the Armour is working just not getting any weapons...


Re: Correct usage? - Kar - 10.08.2010

pawn Код:
dcmd_duty(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5, 302.292877,-143.139099,1004.062500))
    {
        SetPlayerArmedWeapon(playerid, 334);
        SetPlayerAmmo(playerid, 1, 0);
        GivePlayerWeapon(playerid, 334, 0);
        SetPlayerArmour(playerid, 1000);
        SetPlayerHealth(playerid, 1000);
        SetPlayerColor(playerid, COLOR_BLUE);
        SendClientMessage(playerid, COLOR_RED, "Succesfuly equipped");
    }
    else
    {
        return SendClientMessage(playerid,red,"You Aren't In The Weapon Area!");
    }
    return 1;
}



Re: Correct usage? - Calgon - 10.08.2010

You need to use SA-MP weapon IDs, not model IDs. Furthermore, don't set the players armed weapon, GIVE them the weapon and it'll be set by default, once they receive the weapon.

For a weapon ID list: https://sampwiki.blast.hk/wiki/Weapons