SA-MP Forums Archive
Help with switch - 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 switch (/showthread.php?tid=523541)



Help with switch - JessThompson - 02.07.2014

I have this command that makes you able to have a different animation while talking, But it is not working and no amnation is playing, I think it is the switch.

Here is the switch under onplayertext

pawn Код:
if(PlayerCuffed[playerid] == 1)
                {
                    switch(PlayerInfo[playerid][pChatStyle])
                    {
                        case 0: ApplyAnimation(playerid,"PED","IDLE_CHAT",4.1,0,1,1,1,1);
                        case 1: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkA", 3.1,0,1,1,1,1);
                        case 2: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkB", 3.1,0,1,1,1,1);
                        case 3: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkC", 3.1,0,1,1,1,1);
                        case 4: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkD", 3.1,0,1,1,1,1);
                        case 5: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkE", 3.1,0,1,1,1,1);
                        case 6: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkF", 3.1,0,1,1,1,1);
                        case 7: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkG", 3.1,0,1,1,1,1);
                        case 8: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkH", 3.1,0,1,1,1,1);
                    }
                    new time=strlen(text)*100;
                    SetTimerEx("StopTalking",time,0,"i",playerid);
                }

Here is the command /chatstyle

pawn Код:
CMD:chatstyle(playerid, params[])
{
    new aimid;
    if(sscanf(params, "i", aimid)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /chatstyle [0-8]");
    else
    {
        if( PlayerCuffed[playerid] >= 1 ) return SendClientMessage(playerid, COLOR_WHITE, "You are cuffed!");
        if(gPlayerLogged{playerid} == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
        if(PlayerInfo[playerid][pMuted] == 1)return SendClientMessage(playerid, COLOR_LIGHTRED, "You are currently muted !");
        switch(aimid)
        {
            case 0:
            {
          PlayerInfo[playerid][pChatStyle] = 0;
                SendClientMessage(playerid,COLOR_WHITE,"Chatstyle removed.");
            }
            case 1 .. 8:
            {
                PlayerInfo[playerid][pChatStyle] = aimid;
                SendClientMessage(playerid,COLOR_WHITE,"Chatstyle set.");
            }
            default: SendClientMessage(playerid, COLOR_GREY, "USAGE: /chatstyle [0-8]");
        }
    }
    return 1;
}

Also i have added this into my saving system any ideas?


Re: Help with switch - JessThompson - 02.07.2014

Sorry for this post just realised my error i made it

if(PlayerCuffed[playerid] == 1)

and it should be

if(PlayerCuffed[playerid] == 0)