Help finishing a snippet, thanks.
#1

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!
Reply
#2

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

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.
Reply
#4

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
Reply
#5

Thanks! <3
Reply
#6

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

Add this at the top of the cmd

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

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.
Reply
#9

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;
}
Reply
#10

Works perfectly! Thank you!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)