SA-MP Forums Archive
take drug cmd - 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: take drug cmd (/showthread.php?tid=580811)



take drug cmd - STONEGOLD - 08.07.2015

PHP код:
while(DrugsTaken[playerid] < 5)
    {
    
format(stringsizeof(string), "You Have Taken %d Grams of Drugs. Your Health Will Refill Automatically."amount);
    
SendClientMessage(playerid,GREENstring);
    
format(stringsizeof(string), "Remaining Drugs: %d",pData[playerid][pDrugs]);
    
SendClientMessage(playerid,GREENstring);
    
GameTextForPlayer(playerid,"~w~ON DRUGS",5000,3);
    
SetPlayerChatBubble(playerid"On Drugs"COLOR_YELLOW100.05000);
    
SetPlayerDrunkLevel(playerid4999);
    return 
1;
    }
    
    while(
DrugsTaken[playerid] < 10)
    {
    
format(stringsizeof(string), "You Have1 Taken %d Grams of Drugs. Your Health Will Refill Automatically."amount);
    
SendClientMessage(playerid,GREENstring);
    
format(stringsizeof(string), "Remaining Drugs: %d",pData[playerid][pDrugs]);
    
SendClientMessage(playerid,GREENstring);
    
GameTextForPlayer(playerid,"~w~ON DRUGS",5000,3);
    
SetPlayerChatBubble(playerid"On Drugs"COLOR_YELLOW100.05000);
    
SetPlayerDrunkLevel(playerid5999);
    return 
1;
    }
    
    while(
DrugsTaken[playerid] < 20)
    {
    
format(stringsizeof(string), "You Have2 Taken %d Grams of Drugs. Your Health Will Refill Automatically."amount);
    
SendClientMessage(playerid,GREENstring);
    
format(stringsizeof(string), "Remaining Drugs: %d",pData[playerid][pDrugs]);
    
SendClientMessage(playerid,GREENstring);
    
GameTextForPlayer(playerid,"~w~ON DRUGS",5000,3);
    
SetPlayerChatBubble(playerid"On Drugs"COLOR_YELLOW100.05000);
    
SetPlayerDrunkLevel(playerid6999);
    return 
1;
    }
    
    while(
DrugsTaken[playerid] < 25)
    {
    
format(stringsizeof(string), "You Have3 Taken %d Grams of Drugs. Your Health Will Refill Automatically."amount);
    
SendClientMessage(playerid,GREENstring);
    
format(stringsizeof(string), "Remaining Drugs: %d",pData[playerid][pDrugs]);
    
SendClientMessage(playerid,GREENstring);
    
GameTextForPlayer(playerid,"~w~ON DRUGS",5000,3);
    
SetPlayerChatBubble(playerid"On Drugs"COLOR_YELLOW100.05000);
    
SetPlayerDrunkLevel(playerid7999);
    return 
1;
    } 
Well, It's not working. If i type /td 15 or 20 it apply as 1 - 5.

I mean it applys to this
PHP код:
while(DrugsTaken[playerid] < 5)
    {
    
format(stringsizeof(string), "You Have Taken %d Grams of Drugs. Your Health Will Refill Automatically."amount);
    
SendClientMessage(playerid,GREENstring);
    
format(stringsizeof(string), "Remaining Drugs: %d",pData[playerid][pDrugs]);
    
SendClientMessage(playerid,GREENstring);
    
GameTextForPlayer(playerid,"~w~ON DRUGS",5000,3);
    
SetPlayerChatBubble(playerid"On Drugs"COLOR_YELLOW100.05000);
    
SetPlayerDrunkLevel(playerid4999);
    return 
1;
    } 
FULL CMD:

PHP код:

COMMAND
:takedrugs(playeridparams[])
{
    new 
amount,string[256];
    if(
sscanf(params"d"amount))
    {
        if(
pData[playerid][pDrugs] >= 10)
        {
                 
DrugsTaken[playerid] += 10;
                 
pData[playerid][pDrugs] -= 10;
                 
pData[playerid][pDrugsTime] = 10*8;
                 while(
DrugsTaken[playerid] > 60)
                 {
                 
pData[playerid][pCustomDeath] = WEAPON_OVERDOSE;
                 
SendDeathMessage(INVALID_PLAYER_IDplayerid47);
                 
GameTextForPlayer(playerid,"~r~Drug Overdose",5000,3);
                 
SetPlayerHealth(playerid,0);
                 
DrugsTaken[playerid] = 0;
                 return 
1;
                 }
                 
SendClientMessage(playerid,GREEN"You Have Taken 10 Grams of Drugs. Your Health Will Refill Automatically.");
                 
format(stringsizeof(string), "Remaining Drugs: %d",pData[playerid][pDrugs]);
                 
SendClientMessage(playerid,GREENstring);
                 
GameTextForPlayer(playerid,"~w~ON DRUGS",5000,3);
                 
SetPlayerChatBubble(playerid"On Drugs"COLOR_YELLOW100.05000);
                 
SetPlayerDrunkLevel(playerid4999);
                 
ON_DRUGS[playerid]=1;
                 
GivePlayerHealth(playerid12);
        }
        else
        {
        
SendClientMessage(playeridRED"You Don't have Any Amount Of Drugs.");
        }
        return 
1;
    }
    if(
amount 1)
    {
    
SendClientMessage(playeridRED,"Invalid Amount - Take Atleast 1g.");
    return 
1;
    }
    if (
amount pData[playerid][pDrugs])
    {
    
format(stringsizeof(string), "You Do Not Have Enough Drugs.  You Are Carrying %d Grams Of Drugs.",pData[playerid][pDrugs]);
    
SendClientMessage(playerid,REDstring);
    return 
1;
    }
    
DrugsTaken[playerid] += amount;
    
pData[playerid][pDrugs] -= amount;
    
pData[playerid][pDrugsTime] = amount*8;
    if(
DrugsTaken[playerid] > 60)
    {
    
pData[playerid][pCustomDeath] = WEAPON_OVERDOSE;
    
SendDeathMessage(INVALID_PLAYER_IDplayerid47);
    
GameTextForPlayer(playerid,"~r~Drug Overdose",5000,3);
    
SetPlayerHealth(playerid,0);
    
DrugsTaken[playerid] = 0;
    return 
1;
    }
    while(
DrugsTaken[playerid] < 5)
    {
    
format(stringsizeof(string), "You Have Taken %d Grams of Drugs. Your Health Will Refill Automatically."amount);
    
SendClientMessage(playerid,GREENstring);
    
format(stringsizeof(string), "Remaining Drugs: %d",pData[playerid][pDrugs]);
    
SendClientMessage(playerid,GREENstring);
    
GameTextForPlayer(playerid,"~w~ON DRUGS",5000,3);
    
SetPlayerChatBubble(playerid"On Drugs"COLOR_YELLOW100.05000);
    
SetPlayerDrunkLevel(playerid4999);
    return 
1;
    }
    
    while(
DrugsTaken[playerid] < 10)
    {
    
format(stringsizeof(string), "You Have1 Taken %d Grams of Drugs. Your Health Will Refill Automatically."amount);
    
SendClientMessage(playerid,GREENstring);
    
format(stringsizeof(string), "Remaining Drugs: %d",pData[playerid][pDrugs]);
    
SendClientMessage(playerid,GREENstring);
    
GameTextForPlayer(playerid,"~w~ON DRUGS",5000,3);
    
SetPlayerChatBubble(playerid"On Drugs"COLOR_YELLOW100.05000);
    
SetPlayerDrunkLevel(playerid5999);
    return 
1;
    }
    
    while(
DrugsTaken[playerid] < 20)
    {
    
format(stringsizeof(string), "You Have2 Taken %d Grams of Drugs. Your Health Will Refill Automatically."amount);
    
SendClientMessage(playerid,GREENstring);
    
format(stringsizeof(string), "Remaining Drugs: %d",pData[playerid][pDrugs]);
    
SendClientMessage(playerid,GREENstring);
    
GameTextForPlayer(playerid,"~w~ON DRUGS",5000,3);
    
SetPlayerChatBubble(playerid"On Drugs"COLOR_YELLOW100.05000);
    
SetPlayerDrunkLevel(playerid6999);
    return 
1;
    }
    
    while(
DrugsTaken[playerid] < 25)
    {
    
format(stringsizeof(string), "You Have3 Taken %d Grams of Drugs. Your Health Will Refill Automatically."amount);
    
SendClientMessage(playerid,GREENstring);
    
format(stringsizeof(string), "Remaining Drugs: %d",pData[playerid][pDrugs]);
    
SendClientMessage(playerid,GREENstring);
    
GameTextForPlayer(playerid,"~w~ON DRUGS",5000,3);
    
SetPlayerChatBubble(playerid"On Drugs"COLOR_YELLOW100.05000);
    
SetPlayerDrunkLevel(playerid7999);
    return 
1;
    }
    return 
1;