Easy Question about /GiveWeapon
#3

add this under OnPlayerCommandText
pawn Код:
dcmd_giveweapon(playerid,params[]) {
    if(IsPlayerCommandLevel(playerid,"giveweapon")) {
        new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index),tmp2 = strtok(params,Index),tmp3 = strtok(params,Index);
        if(!strlen(tmp)||!strlen(tmp2)||!strlen(tmp3)||!IsNumeric(tmp3)||!(strval(tmp3) <= 0 || strval(tmp3) <= 10000)) return SendClientMessage(playerid,red,"Syntax Error: \"/GIVEWEAPON <NICK OR ID> <WEAPON NAME | ID> <1-10,000>\".");
        new id,id2; if(!IsNumeric(tmp)) id = ReturnPlayerID(tmp); else id = strval(tmp); if(!IsNumeric(tmp2)) id2 = ReturnWeaponID(tmp2); else id2 = strval(tmp2);
        if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID) {
            if(id2==-1||id2==19||id2==20||id2==21||id2==0||id2==44||id2==45) return SendClientMessage(playerid,red,"ERROR: You have selected an invalid weapon ID.");
            SendCommandMessageToAdmins(playerid,"GIVEWEAPON");
            new string[256],name[24],ActionName[24],WeaponName[24]; GetPlayerName(playerid,name,24); GetPlayerName(id,ActionName,24); GetWeaponName(id2,WeaponName,24); if(id2 == 18) WeaponName = "Molotov";
            if(id != playerid) { format(string,256,"Administrator \"%s\" has given you %d %s.",name,strval(tmp3),WeaponName); SendClientMessage(id,yellow,string); format(string,256,"You have given \"%s\" %d %s.",ActionName,strval(tmp3),WeaponName); SendClientMessage(playerid,yellow,string); }
            else { format(string,256,"You have given yourself %d %s.",strval(tmp3),WeaponName); SendClientMessage(playerid,yellow,string); }
            return GivePlayerWeapon(id,id2,strval(tmp3));
        } else return SendClientMessage(playerid,red,"ERROR: You can not give a disconnected player a weapon.");
    } else return SendLevelErrorMessage(playerid,"giveweapon");
}
and
pawn Код:
{
    dcmd(giveweapon,10,cmdtext);
        return 0;
}
above dcmd_giveweapon
Reply


Messages In This Thread
Easy Question about /GiveWeapon - by Alexy_Dramon - 17.03.2012, 14:06
Re: Easy Question about /GiveWeapon - by Dan_Barocu - 17.03.2012, 14:10
Re: Easy Question about /GiveWeapon - by Faisal_khan - 17.03.2012, 14:11
Re: Easy Question about /GiveWeapon - by Alexy_Dramon - 17.03.2012, 14:11
Re: Easy Question about /GiveWeapon - by Dan_Barocu - 17.03.2012, 14:13
Re: Easy Question about /GiveWeapon - by Alexy_Dramon - 17.03.2012, 14:21
Re: Easy Question about /GiveWeapon - by Dan_Barocu - 17.03.2012, 14:24
Re: Easy Question about /GiveWeapon - by Alexy_Dramon - 17.03.2012, 14:29
Re: Easy Question about /GiveWeapon - by ReneG - 17.03.2012, 14:31
Re: Easy Question about /GiveWeapon - by Alexy_Dramon - 17.03.2012, 14:33

Forum Jump:


Users browsing this thread: 2 Guest(s)