Correct usage?
#1

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;
}
Reply
#2

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;
Reply
#3

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...
Reply
#4

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;
}
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)