SA-MP Forums Archive
[HELP] Can someone help me with this script - 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] Can someone help me with this script (/showthread.php?tid=296253)



[HELP] Can someone help me with this script - Stefand - 10.11.2011

Hi everyone,
I have downloaded Vortex roleplay script, and i tryed to make a /mir command.
It works but not good... it only say's to the other player this sentence:

"You have the right to a Phone Call, but only to ONE. Did you understood your rights?"
but it have to say all the 3 sentences.

Please someone help!!

Below is the script....

Код:
command(mir, playerid, params[])
{
        new id, string[128];
        if(sscanf(params, "u", id))
        {
                SendClientMessage(playerid, WHITE, "SYNTAX: /mir [playerid]");
        }
        else
        {
            if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
            {
                if(Player[id][Tazed] == 1)
                {
                    if(GetDistanceBetweenPlayers(playerid, id) < 7)
                    {
                        TogglePlayerControllable(id, true);
                        ApplyAnimation(id, "ped", "cower", 1, 1, 0, 0, 0, 0);
                        Player[id][Cuffed] = 0;
                        Player[id][Tazed] = 0;
                        format(string, sizeof(string), "* %s has said the mir rights to %s.", GetName(playerid), GetName(id));
                        NearByMessage(playerid, NICESKY, string);
                        format(string, sizeof(string), "You have said the mir rights to %s.", GetName(id));
                                        SendClientMessage(playerid, WHITE, string);
                        format(string, sizeof(string), "You have the right to keep silence, Everything you say can be used agaisnt you in a court of the Law", GetName(playerid));
                        format(string, sizeof(string), "You have the right to a Lawyer, If you cannot afford one, the state will appoint you one", GetName(playerid));
                        format(string, sizeof(string), "You have the right to a Phone Call, but only to ONE. Did you understood your rights?", GetName(playerid));
                                        SendClientMessage(id, WHITE, string);
                                        TogglePlayerControllable(id, true);
                    }
                    else
                    {
                        SendClientMessage(playerid, WHITE, "You're too far away!");
                    }
                }
                else
                {
                    if(GetDistanceBetweenPlayers(playerid, id) < 7)
                    {
                        if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_HANDSUP)
                        {
                            TogglePlayerControllable(id, true);
                                ApplyAnimation(id, "ped", "cower", 1, 1, 0, 0, 0, 0);
                                Player[id][Cuffed] = 0;
                                Player[id][Tazed] = 0;
                                format(string, sizeof(string), " %s has said the mir rights to %s.", GetName(playerid), GetName(id));
                        NearByMessage(playerid, NICESKY, string);
                        format(string, sizeof(string), "You have said the mir rights to %s.", GetName(id));
                                        SendClientMessage(playerid, WHITE, string);
                        format(string, sizeof(string), "You have the right to keep silence, Everything you say can be used agaisnt you in a court of the Law", GetName(playerid));
                        format(string, sizeof(string), "You have the right to a Lawyer, If you cannot afford one, the state will appoint you one", GetName(playerid));
                        format(string, sizeof(string), "You have the right to a Phone Call, but only to ONE. Did you understood your rights?", GetName(playerid));
                                        SendClientMessage(id, WHITE, string);
                                        TogglePlayerControllable(id, true);
                        }
                    }
                }
            }
        }
        return 1;
}
Thanks for helping


Re: [HELP] Can someone help me with this script - Mr_Scripter - 10.11.2011

which three sentences i don't understand ...


Re: [HELP] Can someone help me with this script - AdamCooper - 10.11.2011

Try this :
Код:
command(mir, playerid, params[])
{
        new id, string[128];
        if(sscanf(params, "u", id))
        {
                SendClientMessage(playerid, WHITE, "SYNTAX: /mir [playerid]");
        }
        else
        {
            if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
            {
                if(Player[id][Tazed] == 1)
                {
                    if(GetDistanceBetweenPlayers(playerid, id) < 7)
                    {
                        TogglePlayerControllable(id, true);
                        ApplyAnimation(id, "ped", "cower", 1, 1, 0, 0, 0, 0);
                        Player[id][Cuffed] = 0;
                        Player[id][Tazed] = 0;
                        format(string, sizeof(string), "* %s has said the mir rights to %s.", GetName(playerid), GetName(id));
                        NearByMessage(playerid, NICESKY, string);
                        format(string, sizeof(string), "You have said the mir rights to %s.", GetName(id));
                                        SendClientMessage(playerid, WHITE, string);
                        format(string, sizeof(string), "You have the right to keep silence, Everything you say can be used agaisnt you in a court of the Law", GetName(playerid));
                                        SendClientMessage(id, WHITE, string);
                        format(string, sizeof(string), "You have the right to a Lawyer, If you cannot afford one, the state will appoint you one", GetName(playerid));
                                        SendClientMessage(id, WHITE, string);
                        format(string, sizeof(string), "You have the right to a Phone Call, but only to ONE. Did you understood your rights?", GetName(playerid));
                                        SendClientMessage(id, WHITE, string);
                                        TogglePlayerControllable(id, true);
                    }
                    else
                    {
                        SendClientMessage(playerid, WHITE, "You're too far away!");
                    }
                }
                else
                {
                    if(GetDistanceBetweenPlayers(playerid, id) < 7)
                    {
                        if(GetPlayerSpecialAction(id) == SPECIAL_ACTION_HANDSUP)
                        {
                            TogglePlayerControllable(id, true);
                                ApplyAnimation(id, "ped", "cower", 1, 1, 0, 0, 0, 0);
                                Player[id][Cuffed] = 0;
                                Player[id][Tazed] = 0;
                                format(string, sizeof(string), " %s has said the mir rights to %s.", GetName(playerid), GetName(id));
                        NearByMessage(playerid, NICESKY, string);
                        format(string, sizeof(string), "You have said the mir rights to %s.", GetName(id));
                                        SendClientMessage(playerid, WHITE, string);
                        format(string, sizeof(string), "You have the right to keep silence, Everything you say can be used agaisnt you in a court of the Law", GetName(playerid));
                        format(string, sizeof(string), "You have the right to a Lawyer, If you cannot afford one, the state will appoint you one", GetName(playerid));
                        format(string, sizeof(string), "You have the right to a Phone Call, but only to ONE. Did you understood your rights?", GetName(playerid));
                                        SendClientMessage(id, WHITE, string);
                                        TogglePlayerControllable(id, true);
                        }
                    }
                }
            }
        }
        return 1;
}



Re: [HELP] Can someone help me with this script - [MG]Dimi - 10.11.2011

Will you explain me why are you formating messages without any string or integrer? GetName(playerid)); is very useless

Use this:
PHP код:
format(stringsizeof(string), "You have said the mir rights to %s."GetName(id));
SendClientMessage(playeridWHITEstring);
SendClientMessage(idWHITE"You have the right to keep silence, Everything you say can be used agaisnt you in a court of the Law");
SendClientMessage(idWHITE"You have the right to a Lawyer, If you cannot afford one, the state will appoint you one");
SendClientMessage(idWHITE,"You have the right to a Phone Call, but only to ONE. Did you understood your rights?"); 



Re: [HELP] Can someone help me with this script - Stefand - 11.11.2011

Quote:
Originally Posted by Mr_Scripter
Посмотреть сообщение
which three sentences i don't understand ...
Код:
format(string, sizeof(string), "You have the right to keep silence, Everything you say can be used agaisnt you in a court of the Law", GetName(playerid));
                        format(string, sizeof(string), "You have the right to a Lawyer, If you cannot afford one, the state will appoint you one", GetName(playerid));
                        format(string, sizeof(string), "You have the right to a Phone Call, but only to ONE. Did you understood your rights?", GetName(playerid));
those three