SA-MP Forums Archive
Help finishing a snippet, thanks. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help finishing a snippet, thanks. (/showthread.php?tid=250321)



Help finishing a snippet, thanks. - Andregood - 22.04.2011

Well I'm basically wondering how to finish this snippet;

Код:
COMMAND:vampireembrace(playerid, params[])
{
new player;
if(sscanf(params, "u", playerid)) return SendClientMessage, playerid, 0xAFAFAFAA, "Usage: /vampireembrace [playerid/name]

if(gTeam[playerid] == 2)
if(Player != INVALID_PLAYER_ID)
}
I am not certain that I've done it right at all, but I think so.. Anyway, if you could, please correct it and make the player decide if he wants to become a vampire(gTeam 2 or continue being a human=1)


And please add message to it, maybe it could freeze the player or at least show a brief message saying that you're currently going through the embrace. Thanks!


Re: Help finishing a snippet, thanks. - xir - 22.04.2011

Should this command work for other players or only for the player itself?


Re: Help finishing a snippet, thanks. - Andregood - 22.04.2011

Well the vampire will through /me's attempt to beget or embrace the person basically and he can OOCly decide to be a human or a vampire, if he chooses vampire he'll persist RPing as normal, but if he decides to be a human there's an IC explanation for it, probably. So, merely vampires will be able to use the command upon other humans, basically.


Re: Help finishing a snippet, thanks. - xir - 22.04.2011

Uhm, I am not sure
but something like this

pawn Код:
COMMAND:vampireembrace(playerid, params[])
{
    new player, string[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    if(sscanf(params, "u", player)) return SendClientMessage(playerid, 0xAFAFAFAA, "Usage: /vampireembrace [playerid/name]");
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(player, name, sizeof(name));
    format(string, sizeof(string), "* Vampire %s attemps to embrace %s", pName, name);
    SendClientMessageToAll(-1, string);
    format(string, sizeof(string), "* Vampire %s attemps to embrace you ! Do you want to be a vampire or continue being a human?", pName);
    SendClientMessage(player, -1, string);
    return 1;
}
Edit the code as much as you want


Re: Help finishing a snippet, thanks. - Andregood - 22.04.2011

Thanks! <3


Re: Help finishing a snippet, thanks. - Andregood - 22.04.2011

How do I limitate the command to only vampires(gTeam2)?


Re: Help finishing a snippet, thanks. - xir - 22.04.2011

Add this at the top of the cmd

pawn Код:
if(gTeam[playerid] != Vampires) return SendClientMessage(playerid, -1, "This command is only available for Vampires");



Re: Help finishing a snippet, thanks. - Andregood - 22.04.2011

Thanks! Worked!


Although, I do have a question, how do I make different kind of resolutions? Like, I added this dialog to it;

Код:
ShowPlayerDialog( playerid, 4512, DIALOG_STYLE_MSGBOX, "Vampire or Human", "Select", "Vampire", "Human");
I basically want it to occur as currently you can only press the text but nothing happends(I basically want the player to become a vampire if he decides to press vampire). I'd appreciate some help or a brief walkthrough, thanks!


Also, is it possible to add some extra text to it? Like in subsequent actions if it fails for an example it says; Your blood has rejected the injection of vampire blood and you're suffering from haemorrhage, etc.


Re: Help finishing a snippet, thanks. - SchurmanCQC - 22.04.2011

Okay, so you have your dialog...

pawn Код:
ShowPlayerDialog( playerid, 4512, DIALOG_STYLE_MSGBOX, "Vampire or Human", "Select", "Vampire", "Human");
Now what you want to do is navigate down to your "ondialogresponse" callback, if you can't find it, you can search for it.

When thats done, add something like this.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 4512:
        {
            if(response)
            {
                gTeam[playerid] = 2;
                SendClientMessage(playerid,0xFFFFFFFF,"You're now a vampire!");
                //if you have any other desired code that corresponds with "vampire," put it here.
            }
            if(!response)
            {
                SendClientMessage(playerid,0xFFFFFF,"You've selected Human!");
                //if you have any other desired code that corresponds with "human," put it here.
            }
        }
    }
    return 0;
}



Re: Help finishing a snippet, thanks. - Andregood - 22.04.2011

Works perfectly! Thank you!