/gethere in dialog
#8

Here's what you're trying to do, not sure if it works because I can't test it, I literally wrote it in in the reply itself so there could be some error etc. because I can't really test it, also some parts might be displaced either way this should give you the idea or you can even use the whole code if it works as intended. Things you'll need to get it working are: mostly basic scripting knowledge, ZCMD(or IZCMD), sscanf and, well, I think that's it.


PHP код:
#define DIALOG_GETHERE 1337
CMD:gethere(playerid)
{
    if(
AdminLevel[playerid] > 1// replace it with whatever variable you use
    
{
        
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
    }
    else return 
SendClientMessage(playerid, -1"You are not authorized to use this command.");
    return 
1;
}
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_GETHERE:
        {
            if(
response)
            {
                new 
inputid;
                if(
sscanf(inputtext"u"inputid))
                {
                    
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
                    
SendClientMessage(playerid, -1"Invalid input.");
                    return 
1;
                }
                if(
inputid == playerid)
                {
                    
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
                    
SendClientMessage(playerid, -1"You can't teleport yourself to yourself.");
                    return 
1;
                }
                if(!
IsPlayerConnected(inputid))
                {
                    
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
                    
SendClientMessage(playerid, -1"This player is not connected.");
                    return 
1;
                }
                new 
Float:posxFloat:posyFloat:posz;
                
GetPlayerPos(playeridposxposyposz);
                
SetPlayerPos(inputidposxposy+1.5posz);
                new 
string[128], pname[MAX_PLAYER_NAME];
                
GetPlayerName(inputidpnameMAX_PLAYER_NAME);
                
format(stringsizeof(string), "You have teleported %s (ID: %i) to yourself."pnameinputid);
                
SendClientMessage(playerid, -1string);
                
GetPlayerName(playeridpnameMAX_PLAYER_NAME);
                
format(stringsizeof(string), "%s (ID: %i) have teleported you to himself."pnameplayerid);
                
SendClientMessage(inputid, -1string);
                
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
            }
            if(!
response)
            {
                
ShowPlayerDialog(playerid, -1DIALOG_STYLE_MSGBOX"BLAH""BLAH""BLAH""BLAH");
                
SendClientMessage(playerid, -1"Teleport dialog closed.");
            }
        }
    }

Reply


Messages In This Thread
/gethere in dialog - by 3agle - 06.12.2017, 17:32
Re: /gethere in dialog - by Sabur - 06.12.2017, 18:00
Re: /gethere in dialog - by Lucases - 06.12.2017, 18:07
Re: /gethere in dialog - by 3agle - 06.12.2017, 18:48
Re: /gethere in dialog - by Lucases - 06.12.2017, 18:52
Re: /gethere in dialog - by Sew_Sumi - 06.12.2017, 18:52
Re: /gethere in dialog - by Lucases - 06.12.2017, 18:55
Re: /gethere in dialog - by thefirestate - 06.12.2017, 19:50
Re: /gethere in dialog - by Sew_Sumi - 06.12.2017, 20:00
Re: /gethere in dialog - by 3agle - 07.12.2017, 18:23

Forum Jump:


Users browsing this thread: 1 Guest(s)