SetPlayerAmmo Question
#7

Wait.. i don't even know why i made the command /cash lol. I didn't even do anything involving cash. try this:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/ammo", true))
    {
        GiveAmmo(playerid, 100);
        SendClientMessage(playerid, 0xFFFFFFAA, "You got 100 rounds of ammo!");
        return true;
    }
    return false;
}

//------------------------------------------------

stock GiveAmmo(playerid, amount)
{
    new pAmmo = GetPlayerAmmo(playerid), //get ammo for current weapon
        pWeapon = GetPlayerWeapon(playerid), //get current weapon to determine slot
        pSlot; //to store the slot
    switch(pWeapon) //find the weapon slot
    {
        case 331: pSlot = 0;
        case 333,334,335,336,337,338,339,341: pSlot = 1;
        case 346,347,348: pSlot = 2;
        case 349,350,351: pSlot = 3;
        case 352,353,372: pSlot = 4;
        case 355,356: pSlot = 5;
        case 357,358: pSlot = 6;
        case 359,360,361,362: pSlot = 7;
        case 342,343,344,363: pSlot = 8;
        case 365,366,367: pSlot = 9;
        case 321,322,323,324,325,326: pSlot = 10;
        case 368,369,371: pSlot = 11;
    }
    SetPlayerAmmo(playerid, pSlot, (pAmmo+amount)); //set their new ammo!
    return true;
}
not sure what i was thinking before, lol. thats what i get for thinking too early in the morning!
Reply


Messages In This Thread
SetPlayerAmmo Question - by oliverrud - 12.07.2010, 10:35
Re: SetPlayerAmmo Question - by DeathOnaStick - 12.07.2010, 10:42
Re: SetPlayerAmmo Question - by oliverrud - 12.07.2010, 10:44
Re: SetPlayerAmmo Question - by oliverrud - 12.07.2010, 10:58
Re: SetPlayerAmmo Question - by novox - 12.07.2010, 11:03
Re: SetPlayerAmmo Question - by oliverrud - 12.07.2010, 11:07
Re: SetPlayerAmmo Question - by novox - 12.07.2010, 11:12
Re: SetPlayerAmmo Question - by oliverrud - 12.07.2010, 11:20
Re: SetPlayerAmmo Question - by novox - 12.07.2010, 11:22
Re: SetPlayerAmmo Question - by oliverrud - 12.07.2010, 11:31

Forum Jump:


Users browsing this thread: 1 Guest(s)