Problem with /give cmd
#2

Not tested
pawn Код:
COMMAND:give(playerid, params[])
{
    new targetid, option[15];
    new targetname[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME];
    GetPlayerName(targetid, targetname, sizeof(targetname));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(sscanf(params, "us[128]", targetid, option))
    {
        SendClientMessage(playerid, RED, "[LOST:RP] /give [ID] [OPTION");
        SendClientMessage(playerid, RED, "[LOST:RP] Options: Matches,Firewood,WaterBottle,FishingRod,FishingNet,Heroin");
    }
    if(targetid == playerid) return SendClientMessage(playerid, RED, "[LOST:RP] You cant give yourself stuff");
    {
        if(!strfind(option, "Matches", false))
        {
            if(PlayerInfo[playerid][pMatches] > 0)
            {
                PlayerInfo[playerid][pMatches] -= 1;
                PlayerInfo[targetname][pMatches] += 1;
                format(string, sizeof(string), "%s hands some matches to %s", sendername,targetname);
                ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
            }
            else
            {
                SendClientMessage(playerid, RED, "[LOST:RP] You dont have any matches to give");
            }
        }
        if(!strfind(option, "Firewood", false))
        {
            if(PlayerInfo[playerid][pWood] > 0)
            {
                PlayerInfo[playerid][pWood] -= 1;
                PlayerInfo[targetname][pWood] += 1;
                format(string, sizeof(string), "%s hands fire wood to %s", sendername,targetname);
                ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
            }
            else
            {
                SendClientMessage(playerid, RED, "[LOST:RP] You dont have any firewoods to give");
            }
        }
        if(!strfind(option, "WaterBottle", false))
        {
            if(PlayerInfo[playerid][pWaterBottle] > 0)
            {
                PlayerInfo[playerid][pWaterBottle] -= 1;
                PlayerInfo[targetname][pWaterBottle] += 1;
                format(string, sizeof(string), "%s hands a WaterBottle to %s", sendername,targetname);
                ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
            }
            else
            {
                SendClientMessage(playerid, RED, "[LOST:RP] You dont have any WaterBottles");
            }
        }
        if(!strfind(option, "FishingRod", false))
        {
            if(PlayerInfo[playerid][pFishingRod] > 0)
            {
                PlayerInfo[playerid][pFishingRod] -= 1;
                PlayerInfo[targetname][FishingRod] += 1;
                format(string, sizeof(string), "%s hands a Fishing Rod to %s", sendername,targetname);
                ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
            }
            else
            {
                SendClientMessage(playerid, RED, "[LOST:RP] You dont have a Fishing Rod");
            }
        }
        if(!strfind(option, "FishingNet", false))
        {
            if(PlayerInfo[playerid][pFishingNet] > 0)
            {
                PlayerInfo[playerid][pFishingNet] -= 1;
                PlayerInfo[targetname][pFishingNet] += 1;
                format(string, sizeof(string), "%s hands a Fishing Net to %s", sendername,targetname);
                ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
            }
            else
            {
                SendClientMessage(playerid, RED, "[LOST:RP] You dont have a Fishing Net");
            }
        }
        if(!strfind(option, "Heroin", false))
        {
            if(PlayerInfo[playerid][pHeroin] >= 0)
            {
                PlayerInfo[playerid][pHeroin] -= 1;
                PlayerInfo[targetname][pHeroin] += 1;
                format(string, sizeof(string), "%s hands a bag of heroin to %s", sendername,targetname);
                ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
            }
            else
            {
                SendClientMessage(playerid, RED, "[LOST:RP] You dont have any heroin");
            }
        }
        return 1;
    }
}
Reply


Messages In This Thread
Problem with /give cmd - by BizzyD - 07.05.2011, 21:19
Re: Problem with /give cmd - by Laronic - 07.05.2011, 21:28
Re: Problem with /give cmd - by BizzyD - 07.05.2011, 21:31
Re: Problem with /give cmd - by Laronic - 07.05.2011, 21:37
Re: Problem with /give cmd - by BizzyD - 07.05.2011, 21:41
Re: Problem with /give cmd - by admantis - 07.05.2011, 21:41
Re: Problem with /give cmd - by Laronic - 07.05.2011, 21:43
Re: Problem with /give cmd - by BizzyD - 07.05.2011, 21:43
Re: Problem with /give cmd - by BizzyD - 07.05.2011, 22:18
Re: Problem with /give cmd - by Laronic - 07.05.2011, 22:20

Forum Jump:


Users browsing this thread: 1 Guest(s)