/useweed help
#1

pawn Код:
CMD:useweed(playerid,params[])
{
    if(PlayerInfo[playerid][pStressweed] > 1)
    {
        new Float:Health;
        GetPlayerHealth(playerid, Health);
        SetPlayerHealth(playerid, Health+05);
        SetPlayerWeather(playerid, -66);
        PlayerInfo[playerid][pStressweed] -= 1;
        SetTimerEx("Usedrugs", 10000, false, "d", playerid);
        SendClientMessage(playerid, -1, "INFO: You smoked a bowl of Stress.");
    }
    if(PlayerInfo[playerid][pChronicweed] > 1)
    {
        new Float:Health;
        GetPlayerHealth(playerid, Health);
        SetPlayerHealth(playerid, Health+12);
        SetPlayerWeather(playerid, -66);
        PlayerInfo[playerid][pChronicweed] -= 1;
        SetTimerEx("Usedrugs", 10000, false, "d", playerid);
        SendClientMessage(playerid, -1, "INFO: You smoked a bowl of Chronic.");
    }
    if(PlayerInfo[playerid][pKushweed] > 1)
    {
        new Float:Health;
        GetPlayerHealth(playerid, Health);
        SetPlayerHealth(playerid, Health+16);
        SetPlayerWeather(playerid, -66);
        PlayerInfo[playerid][pKushweed] -= 1;
        SetTimerEx("Usedrugs", 10000, false, "d", playerid);
        SendClientMessage(playerid, -1, "INFO: You smoked a Bowl of kush.");
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You don't have anyweed, hit up a dealer.");
    }
    return 1;
}
How would I make it so you have to type /useweed <weedtype>
Reply
#2

Use sscanf: click

pawn Код:
new weed[5];
if(sscanf(params,"s[5]",weed))return SendClientMessage(playerid,-1,"/useweed [type: test]");
if(!strcmp(weed,"test",true))
{
// code
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)