SA-MP Forums Archive
help with smoke command, he dont start to smoke - 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: help with smoke command, he dont start to smoke (/showthread.php?tid=424447)



help with smoke command, he dont start to smoke - Don_Cage - 22.03.2013

Well when ever i type /smoke it only starts an animation, but when ever i type like /smokef or /smokem wich have another animation the same annimation as /smoke comes up, Here is the /smoke
pawn Код:
if(!strcmp(cmdtext, "/smoke", true)) // By LordMan
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You need to login first !");
                return 1;
            }
            if(IsSmoking[playerid] == 0)
            {
                if(PlayerInfo[playerid][pLighter] == 0)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You don't have a lighter to light up your cigarette ! ");
                    return 1;
                }
                if(PlayerInfo[playerid][pCigarettes] == 0)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You don't have a cigarette to smoke ! ");
                    return 1;
                }
                new randsmoke = random(2)+1;
                if(randsmoke == 1)
                {
                    PlayerInfo[playerid][pLighter] -= 1;
                    PlayerInfo[playerid][pCigarettes] -= 1;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), "* Stranger takes out his lighter and cigarette and lights it up."); }
                    else { format(string, sizeof(string), "* Stranger takes out her lighter and cigarette and lights it up."); }
                    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY)
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                    IsSmoking[playerid] = 60;
                    SendClientMessage(playerid, COLOR_WHITE, "TIP: You will Loose your Cigarrete after 10 Smokes, You can Drop it by Pressing 'F' or 'Enter' !");
                    SendClientMessage(playerid, COLOR_WHITE, "TIP: You can use /smokeanim if you want to.");
                    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY)
                    return 1;
                }
                else
                {
                    PlayerInfo[playerid][pLighter] -= 1;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), "* %s takes out his lighter and cigarette and tries to light it up but fails.", sendername); }
                    else { format(string, sizeof(string), "* %s takes out her lighter and cigarette and tries to light it up but fails.", sendername); }
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are already smoking ! ");
                return 1;
            }
        }
        return 1;
    }
and here is the other smoke commands
pawn Код:
if(strcmp(cmd, "/smokeanim", true) == 0)
    {
        if (!strlen(cmdtext[7])) return SendClientMessage(playerid,0xEFEFF7AA,"USAGE: /smoke [1-4]");
        switch (cmdtext[7])
        {
            case '1': LoopingAnim(playerid,"SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0); // male
            case '2': LoopingAnim(playerid,"SMOKING", "F_smklean_loop", 4.0, 1, 0, 0, 0, 0); //female
            case '3': LoopingAnim(playerid,"SMOKING","M_smkstnd_loop", 4.0, 1, 0, 0, 0, 0); // standing-fucked
            case '4': LoopingAnim(playerid,"SMOKING","M_smk_out", 4.0, 1, 0, 0, 0, 0); // standing
            default: SendClientMessage(playerid,0xEFEFF7AA,"USAGE: /smoke [1-4]");
        }
        return 1;
    }
pawn Код:
else if (strcmp("/smokem", cmdtext, true, 4) == 0) {
        ApplyAnimation(playerid,"SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0); // Smoke
        return 1;
    }

    else if (strcmp("/smokef", cmdtext, true) == 0) {
        ApplyAnimation(playerid, "SMOKING", "F_smklean_loop", 4.0, 1, 0, 0, 0, 0); // Female Smoking
        return 1;
    }
pawn Код:
if(!strcmp(cmdtext, "/smokeanim", true)) // By LordMan
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You need to login first !");
                return 1;
            }
            if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You can only use /smokeanim while you are at your foot !");
                return 1;
            }
            if(IsSmoking[playerid] != 0)
            {
                UsingSmokeAnim[playerid] = 1;
                ApplyAnimation(playerid,"SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You need to /smoke to use this animation ! ");
                return 1;
            }
        }
        return 1;
     }
as you can see not all of them have the same animation but still i get the same animation whenever i type any of these commands. Also in the /smoke he only makes the animation, nothing else happens. The text dosnt show or anything like that


Re: help with smoke command, he dont start to smoke - Rock - 22.03.2013

You don't have to stop current animation before using another?


Re: help with smoke command, he dont start to smoke - Don_Cage - 22.03.2013

I stop it with right mouse click, and it dosnt mather wich command i type first, it is still the sameanimation that shows