SA-MP Forums Archive
CMD 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: CMD problem? (/showthread.php?tid=348462)



CMD problem? - N0FeaR - 05.06.2012

Error
Код:
../gamemodes/OnPlayerCommandZCMD.pwn(2704) : warning 209: function "cmd_putgun" should return a value
pawn Код:
}
COMMAND:putgun(playerid, params[])
{
    if(PlayerInfo[playerid][pInvWeapon] != 0 && PlayerInfo[playerid][pInvAmmo] != 0)
    {
        new gunname[100];
        new string[128];
        GetWeaponName(PlayerInfo[playerid][pInvWeapon], gunname, sizeof(gunname));
        GivePlayerWeaponEx(playerid, PlayerInfo[playerid][pInvWeapon], PlayerInfo[playerid][pInvAmmo]);
        format(string, sizeof(string), "   You took %s from your inventory.", gunname);
        SendClientMessage(playerid, COLOR_GREY, string);
        PlayerInfo[playerid][pInvWeapon] = 0;
        PlayerInfo[playerid][pInvAmmo] = 0;
        AttachWeaponCorrectly(playerid, 99);
     }
     else
     {
         SendClientMessage(playerid, COLOR_GREY, "  You haven't placed any gun at your inventory !");
         return 1;
    }
}



Re: CMD problem? - newbienoob - 05.06.2012

Try this
pawn Код:
COMMAND:putgun(playerid, params[])
{
    if(PlayerInfo[playerid][pInvWeapon] != 0 && PlayerInfo[playerid][pInvAmmo] != 0)
    {
        new gunname[100];
        new string[128];
        GetWeaponName(PlayerInfo[playerid][pInvWeapon], gunname, sizeof(gunname));
        GivePlayerWeaponEx(playerid, PlayerInfo[playerid][pInvWeapon], PlayerInfo[playerid][pInvAmmo]);
        format(string, sizeof(string), "   You took %s from your inventory.", gunname);
        SendClientMessage(playerid, COLOR_GREY, string);
        PlayerInfo[playerid][pInvWeapon] = 0;
        PlayerInfo[playerid][pInvAmmo] = 0;
        AttachWeaponCorrectly(playerid, 99);
     }
     else
     {
         SendClientMessage(playerid, COLOR_GREY, "  You haven't placed any gun at your inventory !");
         return 1;
    }
    return 1;
}